i

JMeter Complete Guide

Samplers in JMeter

Sampler

Samplers will tell Jmeter to send requests to a server and wait for a response.
Under Sampler, we have HTTP Request, LDAP Request, BeanShell Sampler, Debug Sampler, etc

BeanShell Sampler: The BeanShell Sampler has a pre-defined variables which we can use in the script. These are SampleRequest, ResponseCode, ResponseMessage, success, Label, FileName, vars, props, and log. Meter by default supports Beanshell so you can write and run Beanshell scripts in the Beanshell sampler.

BeanShell Sampler Script Example: -
var a; vars.put("a","admin"); int tn = ctx.getThreadNum(); log.info("ThreadNumber is:"+" "+tn);

Screenshot Of BeanShell Sampler: -