SUBSCRIBE HERE TO GET POST UPDATES VIA EMAIL :

Delivered by FeedBurner

JMeter If Controller Example

If controller is very useful in any software application's load testing using jmeter. If controller in jmeter allows you to set condition to evaluate it and based on condition evaluation result it will decide to run or not to run if controller's child elements. If condition evaluation result is positive then child elements of if controller will run else child elements of if controller will not run. Let's see sample software load testing plan to understand usage of if controller. Also you can view Jmeter Logic controllers examples.

I have created sample software load testing plan to understand usage of If Controller in apache jmeter as below.

Used number of threads = 1 and loop count = 1.
JMeter If Controller

Under first Google Home Page request, I have added Regular Expression Extractor to extract software web application's page title of Google Home Page as shown in below image. When we run test, Result of Regular Expression Extractor will be "Google". That means it will store "Google" in Reference Name title. 

JMeter If Controller example

Latter on we will learn more about Regular Expression Extractor.

You can see in below image, We have used condition "${title}"=="Yahoo" in first if controller. That means child element of 1st if controller will be executed only if value of title reference name is Yahoo. In this case it will be false as value of title reference name will be Google.

JMeter If Controller with example

2nd if controller has "${title}"=="Google" condition. So child request of 2nd if controller will be executed.
 example of JMeter If Controller

Now if you will run above software application load testing plan, It will run child element of 2nd if controller but child element of 1st if controller will be not executed as shown in below image.

example of If Controller in jmeter

So only 2 requests are executed out of 3 requests. This way you can use if controller in any software web application's load testing plan.

No comments:

Post a Comment