How to Add a Varying Number of Parameters in Apache JMeter

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, JSR223 PreProcessor provided by JMeterarrow-up-right can be used.

First, we add an HTTP requestarrow-up-right as shown below, then we delete all the parameters and add JSR223 PreProcessorarrow-up-right.

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.

for(int i=1; i<=10; i++){sampler.AddArgument("ParameterName"+i, "Value"+i);}

When we run the testarrow-up-right, we add any number of parameters as shown in the figure.

Happy testing!

Featureschevron-rightGetting Started with Loadiumchevron-rightJMeter Testchevron-rightPricingchevron-right

If you don't see the answer to your question here, please reach out to usarrow-up-right to let us know! We're always improving our documentation.

Last updated

Was this helpful?