top of page

JMeter Logic Controller

What Is Logic Controller In Jmeter ?

Logic controllers define the order of processing Samplers/Requests in a thread. It controls the flow of execution under a thread. It lets you control 'when' and 'how' to send a user request to the web server.

Following is the list of all logic controllers in JMeter :

  • If Controller

  • Transaction Controller

  • Loop Controller

  • While Controller

  • Critical Section Controller

  • ForEach Controller

  • Include Controller

  • Interleave Controller

  • Once Only Controller

  • Random Controller

  • Random Order Controller

  • Recording Controller

  • Runtime Controller

  • Simple Controller

  • Throughput Controller

  • Module Controller

  • Switch Controller

The commonly used logic controller is :

How to Add Logic Controller to Thread Group ?

To add logic controller, follow the given steps :

  • Follow the path as : right-click on Thread Group   >>   hover on Add   >>   hover on Logic Controller   >>   click on required controller

  • An added logic controller node would be reflected under the Test Group.

Loop Controller

Loop Controller specifies the loop count, all the requests under this container would execute for the specified iterations. It can be added at thread group level or its elements level.

For example, suppose you add one HTTP request to a loop controller with a loop count of three, and you've configured the thread group loop count to two, JMeter will send a total of 3 * 2 = 6 HTTP Requests.

Once Only Controller

The Once Only Controller tells the JMeter to execute the requests/controllers(child elements) placed inside it, only one time even when the loop count is a number of times. This controller executes only on the first iteration through the loop.

For example, if you add one HTTP Request to Once Only Controller and two HTTP Request to the outside of the controller under the thread group and the throup group loop count is configured to three, then JMeter will send a total of (1 + 2) + 2 * (3 - 1) = 7 HTTP Requests

Random Controller

If elements added inside the Random Controller as the child elements, then JMeter picks one element at random on each iteration from Random Controller.

For example, suppose you add three HTTP Requests to the Random Controller under the thread group and one HTTP Request to the thread group with the thread group loop count of four, then JMeter will execute one HTTP Request randomly from Random Controller and one thread group child HTTP Request at each iteration , so the total of executed HTTP Requests are (1 + 1) * 4 = 8 HTTP Requests.

Refer next page JMeter Timer

logic controllers.png
Contr Thread Group.png
loop controller.png
controller node.png
loop result.png
once only node.png
once only contr result.png
random contr node.png
random contr result.png
bottom of page