---
title: Using IF — ELSE Structure in a Load Test
description: Loadium blog
image: https://cdn-images-1.medium.com/max/800/1*-3de0D2kklJUwxesrmrMcw.jpeg
---

[Skip to content](https://explore.loadium.com/loadium-blog/best-practices-for-api-security-testing-1-0-0-0-0-0-0-0-0-0-1-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-1756-c6122e66#main-content)

 Sep 5, 2025 4:38:40 PM

# Using IF — ELSE Structure in a Load Test

![Picture of Erdem KIRMIZI](https://explore.loadium.com/hs-fs/hubfs/bio.jpg?width=50&name=bio.jpg) [Erdem KIRMIZI](https://explore.loadium.com/loadium-blog/authors/erdem-kirmizi)

Share: [facebook-f icon](http://www.facebook.com/share.php?u=https://explore.loadium.com/loadium-blog/best-practices-for-api-security-testing-1-0-0-0-0-0-0-0-0-0-1-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-1756-c6122e66) [linkedin-in icon](http://www.linkedin.com/shareArticle?mini=true&url=https://explore.loadium.com/loadium-blog/best-practices-for-api-security-testing-1-0-0-0-0-0-0-0-0-0-1-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-1756-c6122e66) [Twitter icon](https://twitter.com/intent/tweet?url=https://explore.loadium.com/loadium-blog/best-practices-for-api-security-testing-1-0-0-0-0-0-0-0-0-0-1-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-1756-c6122e66) [pinterest-p icon](http://pinterest.com/pin/create/link/?url=https://explore.loadium.com/loadium-blog/best-practices-for-api-security-testing-1-0-0-0-0-0-0-0-0-0-1-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-1756-c6122e66) [envelope icon](mailto:?body=https://explore.loadium.com/loadium-blog/best-practices-for-api-security-testing-1-0-0-0-0-0-0-0-0-0-1-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-1756-c6122e66)

![](https://cdn-images-1.medium.com/max/2560/1*5cvD6g-vvXdxh1ZtNAY65A.png)

### Performance test scenarios are not like the automated test scenarios!

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 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.

![](https://cdn-images-1.medium.com/max/800/0*bN1KxswsQsTvSwLn.png)

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.

![](https://cdn-images-1.medium.com/max/800/0*NGL25wc6JnRHoIo2.png)

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. In case **If Brand Controller** returns **True**, a new request will be executed. If it’s set to False, it won’t make any more requests.

![](https://cdn-images-1.medium.com/max/800/0*ve-aGnv6ESOV60ke.png)

performance test

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

Please feel free to [ask](https://loadium.com/contact-us/) questions if you have any.

Happy load testing…

*Originally published at *[*loadium.com*](https://loadium.com/blog/using-else-structure-load-test/)* on February 13, 2018.*

## Related posts

[![](https://cdn-images-1.medium.com/max/800/1*bkE3rlsfNKe5C9aeic2SWw.png)](https://explore.loadium.com/loadium-blog/what-is-contract-testing-how-is-it-used)

## [What is Contract Testing? How is it Used?](https://explore.loadium.com/loadium-blog/what-is-contract-testing-how-is-it-used)

![Picture of Erdem KIRMIZI](https://explore.loadium.com/hs-fs/hubfs/bio.jpg?width=50&name=bio.jpg) [Erdem KIRMIZI](https://explore.loadium.com/loadium-blog/authors/erdem-kirmizi) 

 Sep 8, 2025 11:11:03 AM

What is it? Contract testing is a type of software testing used to ensure that services (usually...

[Read more](https://explore.loadium.com/loadium-blog/what-is-contract-testing-how-is-it-used)

[![](https://cdn-images-1.medium.com/max/800/1*e96npieKXI8i1dNmbuve2w.jpeg)](https://explore.loadium.com/loadium-blog/identifying-bottlenecks-in-load-testing)

[Load Testing](https://explore.loadium.com/loadium-blog/tag/load-testing)

## [Identifying Bottlenecks in Load Testing](https://explore.loadium.com/loadium-blog/identifying-bottlenecks-in-load-testing)

![Picture of Erdem KIRMIZI](https://explore.loadium.com/hs-fs/hubfs/bio.jpg?width=50&name=bio.jpg) [Erdem KIRMIZI](https://explore.loadium.com/loadium-blog/authors/erdem-kirmizi) 

 Sep 8, 2025 11:17:23 AM

Load testing is fundamentally different from automation testing. In automation testing, a test...

[Read more](https://explore.loadium.com/loadium-blog/identifying-bottlenecks-in-load-testing)

[![](https://cdn-images-1.medium.com/max/800/1*gq6FewQYC5tdCWLNWO6L2w.jpeg)](https://explore.loadium.com/loadium-blog/what-is-stress-testing-in-software-testing)

[Stress Testing](https://explore.loadium.com/loadium-blog/tag/stress-testing)

## [What is Stress Testing in Software Testing?](https://explore.loadium.com/loadium-blog/what-is-stress-testing-in-software-testing)

![Picture of Erdem KIRMIZI](https://explore.loadium.com/hs-fs/hubfs/bio.jpg?width=50&name=bio.jpg) [Erdem KIRMIZI](https://explore.loadium.com/loadium-blog/authors/erdem-kirmizi) 

 Sep 8, 2025 10:20:00 AM

In software testing, stress testing is a crucial practice aimed at evaluating a system’s stability...

[Read more](https://explore.loadium.com/loadium-blog/what-is-stress-testing-in-software-testing)

---

```json
{
  "@context" : "https://schema.org",
  "@type" : "BlogPosting",
  "author" : {
    "@type" : "Person",
    "name" : "Erdem KIRMIZI",
    "url" : "https://explore.loadium.com/loadium-blog/author/erdem-kirmizi"
  },
  "dateModified" : "2025-09-05T13:38:40.541Z",
  "datePublished" : "2025-09-05T13:38:40.000Z",
  "headline" : "Using IF — ELSE Structure in a Load Test",
  "image" : [ "https://cdn-images-1.medium.com/max/800/1*-3de0D2kklJUwxesrmrMcw.jpeg" ],
  "mainEntityOfPage" : {
    "@id" : "https://explore.loadium.com/loadium-blog/best-practices-for-api-security-testing-1-0-0-0-0-0-0-0-0-0-1-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-1756-c6122e66",
    "@type" : "WebPage"
  },
  "publisher" : {
    "@type" : "Organization",
    "logo" : {
      "@type" : "ImageObject",
      "url" : "https://explore.loadium.com/hubfs/Logo-1.png"
    },
    "name" : "Loadium"
  }
}
```