Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get current loop number of ThreadGroup in jmeter

Tags:

jmeter

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?

like image 439
Ankur Avatar asked May 25 '15 12:05

Ankur


People also ask

How does JMeter calculate loop count?

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.

What is loop count =- 1 in JMeter?

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.

What is number of threads ramp-up period and loop count in JMeter?

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.


1 Answers

You can do it like ${__BeanShell(vars.getIteration();,)} where:

  • __Beanshell - JMeter function allowing execution of arbitrary Beanshell script
  • vars - shorthand to JMeterVariables class which holds current JMeter variables
  • getIteration() method returns what you're looking for

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

like image 61
Dmitri T Avatar answered Oct 08 '22 01:10

Dmitri T