jmeter
  1. jmeter-controllers

Controllers - JMeter Test Plan

In JMeter, Controllers are used to control the flow of requests in a test plan. Controllers help to organize and manage requests in a test plan. In this tutorial, we will discuss different types of Controllers in JMeter and their usage.

Syntax

There is no specific syntax to create Controllers in JMeter. We can add Controllers by right-clicking on the Thread Group and selecting Add > Logic Controller from the drop-down list.

Example

Let's create a Thread Group and add some Controllers to it:

  1. Create a Thread Group by right-clicking on the Test Plan and selecting Add > Threads (Users) > Thread Group.
  2. Add a Sampler to the Thread Group by right-clicking on it and selecting Add > Sampler > Http Request.
  3. Add a Loop Controller to the Thread Group by right-clicking on it and selecting Add > Logic Controller > Loop Controller.
  4. Add a Random Controller to the Loop Controller by right-clicking on it and selecting Add > Logic Controller > Random Controller.
  5. Add a If Controller to the Random Controller by right-clicking on it and selecting Add > Logic Controller > If Controller.
  6. Add a While Controller to the If Controller by right-clicking on it and selecting Add > Logic Controller > While Controller.

Output

The above Controllers will control the flow of requests in the test plan. The Loop Controller will loop the Http Request Sampler, the Random Controller will randomly select the next Controller to execute, the If Controller will execute the next Controller only if a certain condition is met, and the While Controller will iterate the next Controller until a certain condition is met.

Explanation

JMeter Controllers are used to control the order of requests in a test plan and manage the flow of the test plan. Controllers help to organize and group requests in the test plan.

There are different types of Controllers available in JMeter:

  1. Simple Controller - It is used to group Samplers.
  2. Transaction Controller - It is used to group Samplers within a transaction.
  3. Loop Controller - It is used to loop a set of Samplers.
  4. Random Controller - It is used to randomize the order of execution of its child elements.
  5. If Controller - It is used to execute its child elements if a certain condition is met.
  6. While Controller - It is used to iterate its child elements while a certain condition is true.
  7. Switch Controller - It is used to execute one of its child elements based on a specific value.

Each Controller has its own usage and importance.

Use

Controllers are used to organize and manage requests in a JMeter test plan. By using Controllers, we can control the flow of requests and manage them in an organized way.

Important Points

  • JMeter Controllers are used to control the flow of requests in a test plan.
  • Controllers help to organize and manage requests in a test plan.
  • There are different types of Controllers available in JMeter, each having its own usage and importance.

Summary

In this tutorial, we learned about Controllers in JMeter and their usage. We also discussed different types of Controllers and how they help to manage requests in a test plan. By using Controllers in JMeter, we can control the flow of requests and manage them in an organized way.

Published on: