Skip to content

ForEach Controller Start index for loop not using variable #6108

@henkdegroot

Description

@henkdegroot

Expected behavior

I want to control the Start and End index of the ForEach controller using a variable.
At the start of the test I don't know what the value of the Start and End index will be.
Sometimes I want to start at index 5, sometimes at 0, sometimes at 3.

Actual behavior

When the Start index of the ForEach controller is set using a variable, it is not used. The start index is still 0.
In my test plan I want to set the variable at some point in time during the test (based upon changing factors).

In the attached (simplyfied) testplan, I am using some dummy/demo values to demonstrate the issue.

When I add a User Defined Variables config element to the plan, the ForEach controller is using the Start index set specified in that variable, but that does not help me as I want it to be more dynamic.

Steps to reproduce the problem

The test plan starts by creating JSON content and I use a JSON Extractor to create a number of variables which then can be used by the ForEach Controller.

ForeachTest.jmx.txt

After extracting the variables, there is a JSR223 PostProcessor which sets the variables used for the Start and End Index.
The Start index is set to 2, the End index is set to 5. So I am expecting the ForEach controller to use variable 3, 4, and 5.
The End Index is working fine but the Start Index is ignored.

image

JMeter Version

5.6.2

Java Version

java version 1.8.0_391

OS Version

Windows 11 22H2

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions