3
votes

I have test plan in jmeter with few SOAP samplers where I append to request body counter value and I'm looking for way how to increment counter before each sampler request.

With setup below jmeter is peforming requests in this order:

First Request - with counter 1
Second Request - with counter 1
First Request - with counter 2
Second Request - with counter 2

I would like to achive this behaviour:

First Request - with counter 1
Second Request - with counter 2
Third Request - with counter 3
...
N Request - with counter n

enter image description here

Number of users: Number of threads: 1 Ramp-Up Period: 1 Loop Count: 2

Counter Starting value: 1 Increment: 1 Maximum value: 2

How can I do it ? I'm guessing I should introduce Loop Controller somehow ?

2

2 Answers

3
votes

You can do it this way:

  • In Test Plan, define variable "counter" set to 0 Counter variable

  • Then add a User Parameters which is a PreProcessor (so executed BEFORE SAMPLER) component using __intSum function

User Parameters

It will be executed each time thanks to scoping rules.

1
votes

For auto increment, initialize a variable let say "id" with 0 in the user defined variable then use ${__intSum(${id},1,id)} for auto increment as shown below:-

enter image description here enter image description here