Repeated actions in a JMeter test plan belong in one branch instead of copied sampler blocks. A Loop Controller repeats only the elements nested under it, which keeps repeated searches, polling requests, retries, or checkout sub-actions tied to one editable part of the tree.
The controller loop count is multiplied by the loops above it. A thread group with two users, one thread-group loop, and a child Loop Controller count of three records six child sampler samples, because each virtual user enters the controller and runs the nested sampler three times.
Use a fixed number while validating the branch. Forever, or a loop count of -1 in a JMX file, should be reserved for plans that have a duration, scheduler, or external stop condition, because the controller itself will keep re-entering its children.
Steps to configure a JMeter Loop Controller:
- Open the test plan in the JMeter GUI.
- Select the thread group or parent controller that should contain the repeated branch.
Place setup requests, login requests, token extraction, and values needed by later branches outside the Loop Controller when they should not repeat with the child branch.
- Add the controller from Add → Logic Controller → Loop Controller.
- Name the controller for the action it repeats.
Repeat search sampler
- Set the fixed repeat count and leave Forever cleared.
Name: Repeat search sampler Loop Count: 3 Forever: cleared
The official Loop Controller field accepts a function, but a function can be evaluated more than once for child samplers. Use a literal number for a fixed validation pass.
- Move the samplers, assertions, timers, and processors that should repeat under the Loop Controller.
- Save a validation copy of the test plan.
loop-controller-configure.jmx
- Run a non-GUI validation pass.
$ jmeter -n -t loop-controller-configure.jmx -l loop-controller-results.jtl -j jmeter.log Creating summariser <summary> Created the tree successfully using loop-controller-configure.jmx Starting standalone test @ 2026 Jun 30 06:50:54 GMT summary = 6 in 00:00:01 = 11.4/s Avg: 0 Min: 0 Max: 2 Err: 0 (0.00%) Tidying up ... ... end of run
In this validation plan, the thread group has two users and one thread-group loop, while the Loop Controller has a loop count of three. The summary total should therefore be six successful samples.
- Count the result-file rows.
$ wc -l loop-controller-results.jtl 7 loop-controller-results.jtl
The first row is the CSV header, so seven lines means six recorded samples. A different count usually means a child sampler is outside the controller, an outer loop count changed, or Forever is still selected.
Mohd Shakir Zakaria is a cloud architect with deep roots in software development and open-source advocacy. Certified in AWS, Red Hat, VMware, ITIL, and Linux, he specializes in designing and managing robust cloud and on-premises infrastructures.