Apache Jmeter "Switch Controller" With Example

"Switch Controller" is one of the Logic Controller of Apache Jmeter. As name suggest, You can switch your targeted software application page request to run using Switch Controller. You can set your required request id in Switch Controller to execute it so all other requests under Switch Controller will be neglected
during execution. Let we look at practical scenario for better understanding.

Suppose i recorded apache jmeter testing script for 4 pages -> 1. Home Page, 2. My Account Page, 3. Login Page and 4. FAQ Page. Now supposing temporarily i do not want to perform load testing on 'My Account Page'. Then what i can do? 1st idea is i will remove that request from load test script and then run test. 2nd idea is i can use switch controller to exclude that request. Let me show you that jmeter example script with screenshots.

I set Number of Thread = 3 and Loop Count = 2 in thread group property and set Switch Value = 0 in Switch Controller property. I run this test and viewed results in View Results Tree listener as bellow.

See in above image, any request of 'My Account Page' is not display in result because i set Switch Value = 0 in switch controller so jmeter will consider to execute only 1st request from all requests under switch controller. If i set Switch Value =1 then all 3 virtual users of Apache jmeter will execute only My Account Page request. Create script with multiple pages under Switch Controller for your software application and try above example with different Switch Values.


  1. How jmeter identify for which request we set value =0 under switch controller?

  2. if you set value=0 in switch controller, it will execute first request under Switch controller. set value=1 then it will execute only second request under switch controller .

  3. but its not working like that for me if we set value =0 or 1 it is taking o only

  4. can any one help me in this ?