Random Controller and Random Order Controller in JMeter

Random Controller:
  • Random Controller is similar to Interleave Controller except that it makes samplers/requests to run in random order in each loop.
  • For Example, you have defined 4 Http requests under Random Controller, then these requests will be sent in random order and their order of execution will be decided on rum-time.
Random Order Controller:
  • Random Order controller is similar to Simple Controller, it will make all samplers to run in random order in each thread loop.
  • Let’s consider an example of the Random Order Controller, where Thread Group contains Number of Threads to 1, Loop Count to, and a total of 4 Samplers (Http requests).
  • A total of 1 * 5 * 4 = 20 requests will be sent to the webserver under test.

The following Example Demonstrates the Random controller and Random Order Controller :

  • The first step is to open the JMeter and add the Thread Group to the Test Plan.
  • Next, create four HTTP Request for Admin Login, User Login, Registration, and Flight Booking as shown below.
    admin-login-request-jmeter
  • The UserLogin request is as shown below.
    user-login-request-jmeter
  • Flight booking Request is as follow:
    flight-booking-request-random-controller-jmeter
  • The Registration request is as below:
    registration-request-jmeter
  • Now add one View Result Tree Listener to see the report as shown below and then save and run the Test Plan.
    execution-of-random-controller-jmeter
  • Our requirement here is we need to test FlightBooking and Registration requests but before that, we need to execute either AdminLogin and UserLogin Request.
  • To Choose any one from the User and Admin login we can use the Random controller.
  • Add the Random controller to the Thread group.
    add-random-controller-jmeter
  • Once you add the Random controller, add AdminLogin and UserLogin request under the Random Controller.
    add-admin-user-login-under-random-controller-jmeter
  • Now save and run the test plan, the random controller will randomly select the Requests from either Admin or UserLogin.
  • When we run for the first time the Random controller will choose User Login request and for the second time, the Random Controller will choose the Admin login, and the rest of the requests will execute following them.
    random-controller-execution-jmeter

Random Order Controller :

  • To use the Random Order Controller, first, add the simple controller and then add All the Requests under the Simple Controller.
    add-simple-controller-and-all-requests-jmeter
  • Next, disable the Random Controller.
    disable-random-controller-jmeter
  • Now save and run the Test Plan, after the execution all the requests have been expected successfully.
    execution-of-requests-under-simple-controller-jmeter
  • All the Requests under the simple controller will execute in the same order which in the view results in the tree.
  • By using the Random Order Controller, we can control the orders.
  • Add Random Order Controller to the Thread Group and move all the requests under Random Order Controller and disable the Simple Controller as well.
  • Now save and run the Test Plan. After the execution, all the requests have been executed in random order in each time as shown below
    execution-of-random-order-conntroll-jmeter
Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions