Reputation: 584
Is there a way to reset the counter after i edit the maximum counter with a variable ? For example see the image https://i.sstatic.net/21067.png
Beanshell Sampler vars.put("Loop","5");
Loop 1 Loopcount 5
Loop 2 Loopcount ${Loop}
Counter with ${Loop} as maximum
Beanshell Sampler with log.info(vars.get("Counter").toString());
Beanshell Sampler with vars.put("Loop","2");
When i try this the ${Loop}
in the counter module won't edit.
Upvotes: 1
Views: 6515
Reputation: 584
Im adding a user defined variable Counter with 0. In the loop i add this piece of code:
long number = Long.parseLong(vars.get("Counter"));
number = number + 1;
vars.put("Counter", String.valueOf(number));
Add the end of the loop i reset the counter with
vars.put("Counter","0");
This works for me
Upvotes: 5