How to set agruments using beanshell processor in jmeter?

151 Views Asked by At

Request parameters in http request are
username abc
password xyz
GoaheadAndlogin Login
Without hardcoding these values how to set agruments directly through beanshell code

1

There are 1 best solutions below

0
On

You can use sampler.addArgument() method as

sampler.addArgument("username", "abc");
sampler.addArgument("password", "xyz");

moreover, you can use variables:

sampler.addArgument("username", vars.get("username"));

or properties:

sampler.addArgument("password", props.get("password"));

See How to use BeanShell: JMeter's favorite built-in component guide for advanced information on Beanshell scripting in JMeter.