---
title: How to Add a Variable Number of Parameters in Apache JMeter
description: Loadium blog
image: https://cdn-images-1.medium.com/max/800/1*QJDmW8UJBXQyGNUyQtLjfA.png
---

[Skip to content](https://explore.loadium.com/loadium-blog/how-to-add-a-variable-number-of-parameters-in-apache-jmeter#main-content)

 Sep 8, 2025 10:56:40 AM

# How to Add a Variable Number of Parameters in Apache JMeter

![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/how-to-add-a-variable-number-of-parameters-in-apache-jmeter) [linkedin-in icon](http://www.linkedin.com/shareArticle?mini=true&url=https://explore.loadium.com/loadium-blog/how-to-add-a-variable-number-of-parameters-in-apache-jmeter) [Twitter icon](https://twitter.com/intent/tweet?url=https://explore.loadium.com/loadium-blog/how-to-add-a-variable-number-of-parameters-in-apache-jmeter) [pinterest-p icon](http://pinterest.com/pin/create/link/?url=https://explore.loadium.com/loadium-blog/how-to-add-a-variable-number-of-parameters-in-apache-jmeter) [envelope icon](mailto:?body=https://explore.loadium.com/loadium-blog/how-to-add-a-variable-number-of-parameters-in-apache-jmeter)

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

Some requests have more than one parameter, and the number of parameters may change. You can also add dynamic parameters according to your scenario. To resolve this issue, we need to use JSR223 PreProcessor provided by Apache [JMeter](https://loadium.com/blog/functional-testing-with-loadium-apache-jmeter/).

First, we add an [HTTP request](https://loadium.com/blog/4-things-you-should-know-about-http-requests/) as shown below, then **we delete all the parameters** and add JSR223 [PreProcessor](https://loadium.com/blog/how-to-add-a-variable-number-of-parameters-in-apache-jmeter/).

![](https://cdn-images-1.medium.com/max/800/1*Zfvzd-9oMo9uyHN8Wmp8nQ.png)

In this example, we choose the groovy language.

Then we add a for loop to determine how many parameters we will add, and add the parameter insert code to use it inside the for a loop.

![](https://cdn-images-1.medium.com/max/800/1*psTKfj05-t2kDpX4H-5y8w.png)

When we run the [test](https://loadium.com/blog/jmeter-distributed-testing-step-by-step/), we add any number of parameters as shown in the figure.

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

*Find this article helpful? Check out *[*Loadium*](https://loadium.com/)* for more!*

 

[JMeter](https://explore.loadium.com/blog/tag/jmeter) , [Best Practices](https://explore.loadium.com/blog/tag/best-practices) , [Examples](https://explore.loadium.com/blog/tag/examples)

## Related posts

[![](https://cdn-images-1.medium.com/max/800/1*ZQADkjNjsk1wZh433LtqEQ.jpeg)](https://explore.loadium.com/loadium-blog/dynatrace-integration-with-jmeter)

[JMeter](https://explore.loadium.com/loadium-blog/tag/jmeter), [Test Integrations](https://explore.loadium.com/loadium-blog/tag/test-integrations)

## [Dynatrace Integration With JMeter](https://explore.loadium.com/loadium-blog/dynatrace-integration-with-jmeter)

![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:18:34 AM

In this article we will learn how to integrate JMeter with Dynatrace. What is Dynatrace Dynatrace...

[Read more](https://explore.loadium.com/loadium-blog/dynatrace-integration-with-jmeter)

[![](https://cdn-images-1.medium.com/max/800/1*q2x61_4zQGHDU4-PTnHfag.jpeg)](https://explore.loadium.com/loadium-blog/real-time-monitoring-with-jmeter-influxdb-integration)

[JMeter](https://explore.loadium.com/loadium-blog/tag/jmeter), [Monitoring](https://explore.loadium.com/loadium-blog/tag/monitoring)

## [Real Time Monitoring with JMeter InfluxDB Integration](https://explore.loadium.com/loadium-blog/real-time-monitoring-with-jmeter-influxdb-integration)

![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:13:11 AM

There are lots of reasons why JMeter is one of the most popular performance testing tools in the...

[Read more](https://explore.loadium.com/loadium-blog/real-time-monitoring-with-jmeter-influxdb-integration)

[![](https://cdn-images-1.medium.com/max/800/1*9R94RWdfrp3r3Elrlt4ibA.jpeg)](https://explore.loadium.com/loadium-blog/how-to-send-jmeter-post-requests)

[JMeter](https://explore.loadium.com/loadium-blog/tag/jmeter)

## [How To Send JMeter POST Requests](https://explore.loadium.com/loadium-blog/how-to-send-jmeter-post-requests)

![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:43:15 AM

How To Send JMeter POST Requests In many cases, even an ordinary load test contains lots of...

[Read more](https://explore.loadium.com/loadium-blog/how-to-send-jmeter-post-requests)

---

```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-17T11:01:59.813Z",
  "datePublished" : "2025-09-08T07:56:40.000Z",
  "headline" : "How to Add a Variable Number of Parameters in Apache JMeter",
  "image" : [ "https://cdn-images-1.medium.com/max/800/1*QJDmW8UJBXQyGNUyQtLjfA.png" ],
  "mainEntityOfPage" : {
    "@id" : "https://explore.loadium.com/loadium-blog/how-to-add-a-variable-number-of-parameters-in-apache-jmeter",
    "@type" : "WebPage"
  },
  "publisher" : {
    "@type" : "Organization",
    "logo" : {
      "@type" : "ImageObject",
      "url" : "https://explore.loadium.com/hubfs/Logo-1.png"
    },
    "name" : "Loadium"
  }
}
```