How To Use "Random Controller" In Apache Jmeter For Performance Testing

Apache Jmeter is performance testing tool and you need to customize your software web application test plan as per client's requirement. Jmeter has many tools for test plan customization and one of them is Logic controllers. We will see more about other parameters of load testing tool jmeter but in this post let we look
at one more controller named Random Controller.
As you know, controllers in jmeter are useful to control execution flow in different ways. Random controller will execute any request randomly. It will pick any request from it's request tree and force to execute is. Every time it will pick different request randomly. Let we take simple example as shown in bellow given image.


Added Random Controller and moved 3 requests under it. (Read this Post to know how to add manually controller in apache jmeter.) Set Loop Count = 1 and Number of Threads (users) = 2 in thread group properties. Added View Results Tree listener to view request execution sequence. Now run this test. View Results Tree listener shows me results as shown in bellow image.


Look in to above example, both users has accessed 'Login page' request and 'My Account Page' request but then one user has accessed 'My Orders Page' and one has accessed 'FAQ Page'. Why both user has not accessed any one request? Answer is random controller.

Conclusion is that - Every time random controller will select any request from it's sub requests and it will force that request to execute.

2 comments:

  1. Hi, I am stuck in in doing load testing, pls help.
    I am doing load testing using JM for a portal, I recorded the script for logging in and searching order and parameterised for multiple users, but there is a tab where in users upload csv file and that creates an order, when i tried to record this JM proxy recorder, the csv file is not uploading only, is there any way of setup to be done in JM so it can record this scenario or how can i create a testplan to upload a csv file to that portal?

    ReplyDelete
  2. Try record the session using the free BlazeMeter

    ReplyDelete