Over a million developers have joined DZone.

How to Create Decision Points in JMeter Scripts?

DZone's Guide to

How to Create Decision Points in JMeter Scripts?

Check out how JMeter can add decision points to your perfromance tests for more precise results and more targeted analysis.

· Performance Zone ·
Free Resource

SignalFx is the only real-time cloud monitoring platform for infrastructure, microservices, and applications. The platform collects metrics and traces across every component in your cloud environment, replacing traditional point tools with a single integrated solution that works across the stack.

Performance test scenarios are not like the automated test scenarios. While automated test scripts focus on a few functionalities, performance test scenarios might be focused on more functionalities.

There might be some unexpected conditions in your scenarios and you have to take the necessary actions to resolve them. To deal with them effectively it is advised that you add decision points in your scripts.

Apache JMeter allows you to create decision points in your test scripts.

First of all, you need to analyze the response and take an action to it.

  • Create an HTTP request sampler
  • Attach a response extractor as a child element to the sampler. This response extractor might be any extractor.


This in this example, we have used a CSS Extractor. It will fetch values in your HTML via  [data-name=’brand’] expression. Then it will find this web element’s data-href attribute and assign it to the brandLink variable. In case there are no results, the variable will be set to noBrand.

  • Add If Controller to your Test Plan
  • Condition field accepts Javascript so add  “${brandLink}” == “noBrand”  or  “${brandLink}” != “noBrand” , depending on your preference. This is our decision point. This usage might differ in JMeter versions.

performance test

  • Then add a new HTTP sampler as a child element to this IfController. The request will be executed according to the decision point.

Now you have a test plan as follows. If If Brand Controller returns True, a new request will be executed. If it’s set to False, it won’t make any more requests.

performance test

By having an If-Else condition you will enrich your test plans.

Please feel free to ask questions if you have any.

Happy load testing…

SignalFx is built on a massively scalable streaming architecture that applies advanced predictive analytics for real-time problem detection. With its NoSample™ distributed tracing capabilities, SignalFx reliably monitors all transactions across microservices, accurately identifying all anomalies. And through data-science-powered directed troubleshooting SignalFx guides the operator to find the root cause of issues in seconds.

jmeter ,jmeter functions ,load testing ,performance testing ,decision making ,performance ,automated testing ,decision points

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}