I am using jmeter. I set Loop Count to 5 in ThreadGroup and number of Thread to 1. How can I get the current loop number so I can perform some operation in beanshell postprocessor?
Loop Count: You can set the number of iterations for each user in the group using Loop Count. For example, the above configurations with: Number of threads: 10, Ramp-Up period: 10 seconds and Loop Count: 1 means that JMeter will take 10 seconds to get all the 10 threads up and running.
Definition of JMeter Loop Count. JMeter provides different types of functions to the user, in which that loop count is one of the functions that is provided by the JMeter. Basically, loop count means we can set the number of iterations for every user as per our requirement.
The ramp-up period tells JMeter how long to take to "ramp-up" to the full number of threads chosen. If 10 threads are used, and the ramp-up period is 100 seconds, then JMeter will take 100 seconds to get all 10 threads up and running. Each thread will start 10 (100/10) seconds after the previous thread was begun.
You can do it like ${__BeanShell(vars.getIteration();,)}
where:
vars
- shorthand to JMeterVariables class which holds current JMeter variablesgetIteration()
method returns what you're looking forSee How to use BeanShell: JMeter's favorite built-in component guide for more information on Beanshell scripting in JMeter.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With