Loop Controller

If you add Samplers or Controllers to a Loop Controller, JMeter will loop through them a certain number of times, in addition to the loop value you specified for the Thread Group. For example, if you add one HTTP Request to a Loop Controller with a loop count of two, and configure the Thread Group loop count to three, JMeter will send a total of 2 * 3 = 6 HTTP Requests.

Control Panel
http://jakarta.apache.org/jmeter/images/screenshots/logic-controller/loop-controller.gif

Parameters

Attribute

Description

Required

Name

Descriptive name for this controller that is shown in the tree.

No

Loop Count

The number of times the subelements of this controller will be iterated each time through a test run.
Special Case: The Loop Controller embedded in the Thread Group element behaves slightly differently. Unless set to forever, it stops the test after the given number of iterations have been done.

Yes, unless "Forever" is checked

Looping Example

Download this example (see Figure 3). In this example, we created a Test Plan that sends a particular HTTP Request only once and sends another HTTP Request five times.

http://jakarta.apache.org/jmeter/images/screenshots/logic-controller/loop-example.gif

Figure 3 - Loop Controller Example

We configured the Thread Group for a single thread and a loop count value of one. Instead of letting the Thread Group control the looping, we used a Loop Controller. You can see that we added one HTTP Request to the Thread Group and another HTTP Request to a Loop Controller. We configured the Loop Controller with a loop count value of five.

JMeter will send the requests in the following order: Home Page, News Page, News Page, News Page, News Page, and News Page. Note, the File Reporter is configured to store the results in a file named "loop-test.dat" in the current directory.

  • No labels