Skip to main content

JMeter Controller Options

· 5 min read
Avi Stramer
Founder, Testable

JMeter is a popular open-source performance testing tool used by software testers and developers to test the performance and functionality of web applications. In this blog post, we will discuss the different types of JMeter controllers and their uses.

Controllers are an important feature of JMeter that helps you simulate complex user flows through your application.

Be on the look out for additional blog posts where we go deeper into each controller option.

Controller Options

Below is a quick overview of all the controller options that JMeter provides, including some popular plugins.

If Controller

Executes the next request only if a condition is met.

While Controller

Repeats the request until a condition is met.

Switch Controller

Executes one of several requests based on a condition.

Loop Controller

Executes the sequence of child requests a certain number of times.

Random Controller

Executes one of the child requests randomly.

Random Order Controller

Executes the child requests in a random order on each iteration.

ForEach Controller

Given an input array variable it will loop over it, assign the output variable the value at each index and execute the child requests for each output variable value.

Simple Controller

The Simple Controller is used to group test elements into a logical unit. It is often used to group multiple samplers or other controllers. It is a simple way to better organize and manage your test plan without introducing any additional measurements or logic.

Transaction Controller

The Transaction Controller is used to group requests that represent a single transaction. It calculates the response time of the entire transaction and provides a breakdown of the response time for each individual sampler within the transaction as well.

Recording Controller

The Recording Controller is used to record user actions in a web browser and convert them into JMeter test elements. To make it work you need to also add a Non-Test Elements => HTTP(s) Test Script Recorder element to your test plan and choose the Recording Controller element as the target. This controller when combined with the recorder makes it easy to record and replay. Keep in mind that this approach has significant limitations when authentication or other time sensitive requests are involved.

Throughput Controller

The Throughput Controller is used to control the rate of requests sent by virtual users. It allows testers to define a target throughput for a specific sampler or group of samplers. The Throughput Controller adjusts the number of virtual users to achieve the target throughput.

Interleave Controller

The Interleave Controller is used to interleave the execution of two or more sets of samplers. It is often used to simulate multiple users accessing different parts of a web application simultaneously.

Critical Section Controller

The Critical Section Controller ensures that the child elements will only be executed by one virtual user at a time by acquiring a named lock before proceeding to execute the child elements. Two Critical Section Controllers can use the same named lock as well if you only want one thread across both sets of elements executing at a time.

Include Controller

The Include Controller imports all elements from another test plan into this test plan when running a test.

Once Only Controller

The Once Only Controller runs the child elements one time PER THREAD. So for each thread on subsequent iterations through the test plan, the child elements of the controller will not execute.

Runtime Controller

The Runtime Controller allows you to control how long (in seconds) the child elements are allowed to run for before the test moves on.

bzm - Parallel Controller

The Parallel Controller plugin will execute all child elements in parallel. You can ask it to generate a parent sample that unifies all the child requests. You can also limit the concurrency to a certain number of threads.

Module Controller

The Module Controller allows you to introduce reuse into your test plan by chhoosing another controller to execute. So define a controller that executes a group of requests and inject it into your test plan in multiple places without any copy/paste.

jp@gc - Parameterized Controller

The Parameterized Controller plugin works in tandem with the Module Controller. It allows you to pass different parameters to the same module enabling even further reuse and simplicity in your test plan.

Module Controller

Conclusion

In conclusion, JMeter provides a wide range of controller elements to help testers design and execute effective test plans. Each controller element serves a unique purpose and can be used to create complex and realistic test scenarios. By leveraging these controller elements effectively, testers can create accurate load testing scenarios that accurately reflect the behavior of real-world users.

In upcoming blog posts we will dive deeper into each one of these controllers including examples, screenshots, etc.