Reputation: 21
I really need your help. In JMeter 4.0 in my JMX script, I tried to create and increase counter variable and I do that with the BeanShell Sampler before the sampler in while loop. The problem that the counter value himself increased but the sampler takes the wrong value from him, not the updated value. Much thanks for all of you. Or.
Upvotes: 1
Views: 56
Reputation: 168072
Amend your code to look like:
temp = Integer.parseInt(vars.get("counterPlugin")) + 1;
vars.put("counterPlugin", String.valueOf(temp));
log.info(vars.get("counterPlugin"));
Since JMeter 4.0 you have ${__jm__Loop Controller__idx}
variable which holds the current iteration number of the Loop Controller
Upvotes: 2