JMeter Controllers
JMeter Controllers
Controllers determine how requests are sent and managed during test execution. They are categorized into:
- Sampler Controllers
- Logic Controllers
Sampler Controllers
Sampler Controllers tell JMeter to send requests to a server and wait for a response and they are processed in the order they appear in the tree. Each Sampler produces sample results that may have various attributes, such as performance, elapsed time, throughput, etc.
For an example, add an HTTP Request Sampler if we want JMeter to send an HTTP request. We can also customize a request by adding one or more Configuration Elements to a Sampler.
These send requests to a server and collect responses. Some common samplers are as follows:
- HTTP Request: Sends an HTTP/HTTPS request to a web server.
- JDBC Request: Executes SQL queries against a database.
- FTP Request: Tests file transfer operations.
Logic Controllers
JMeter Logic Controllers gives us an ability to control “when” to send a user request to a web server under test. With logic controllers, we can manage the execution order of different elements in Test Plan.
Logic Controllers lets you to customize the logic that JMeter uses to decide when to send requests. A Logic Controller can changes the order of requests that come from its child elements. The child elements of a Logic Controller may comprise Samplers, Configuration Elements, and more Logic Controllers. For these requests, JMeter may randomly select (using Random Controller), repeat (using Loop Controller), interchange (using Interleave Controller), etc.
These control the execution flow of samplers. Common logic controllers are as follows:
- Simple Controller
- Loop Controller: Repeats a set of samplers for a specified number of times.
- If Controller: Executes samplers only if a given condition is met.
- Transaction Controller: Measures the total execution time of multiple samplers.