JMeter - contour controller with variable contour

I am using JMeter and I want to define one loop controller. In this loop, I want to determine the number of cycles using the Jmeter variable. Is it possible?

Thank you so much

+14
loops jmeter
source share
3 answers

I know it is very late to help you, but it can help others.

One good way to do this is to define counter inside the loop controller.

For example, if you need a loop with 20 iterations, you put 20 in the loop controller and in the counter, which you set from 0 to 19. In the counter, you can also determine the increment. The output variable is called in the Reference Name field.

loop controller with counter

+14
source share

Yes it is possible.

Define a user variable using the User Defined component , or use the CSV component .

Then, in the loop controller, determine the number of loops: $ {nameOfVar}

Starting with version 4.0 of JMeter, there is an easier way:

JMeter will present the loop index as a variable named

__jm__Name of your element__idx

For example, if your loop controller is called LC, you can access the loop index through $ {__ jm__LC__idx}. Index starts at 0

+10
source share

Inside the "Number of loops" field, you can use the following:

${myVar}

for example for random counting:

${__groovy(java.util.concurrent.ThreadLocalRandom.current().nextLong(128L),)}

You can access the index of the current loop (starting at 0) through ${__jm__Loop Controller__idx} , where Loop Controller is the name of your loop.

+1
source share

All Articles