Jmeter How to make counter related to thread number even in the next loop?

848 Views Asked by At

I face an issue currently in Jmeter which Thread number is not related to the counter. for examples we have a thread group configured as 3 threads which will run in 2 loops. We also use a counter from 11 to 13 in the this thread group.

When we run the following happens after the 1st loop:

<table>
<tr><td>Thread_Group_Number</td><td>Counter_Value</td><td>Status</td></tr>
<tr><td>1</td><td>11</td><td>Still running</td></tr>
<tr><td>2</td><td>12</td><td>Finished</td></tr>
<tr><td>3</td><td>13</td><td>Finished</td></tr>
</table>

Actual status when the 2nd loop starts:

<table>
<tr><td>Thread_Group_Number</td><td>Counter_Value</td><td>Status</td></tr>
<tr><td>2</td><td>11</td><td>Running</td></tr>
<tr><td>3</td><td>12</td><td>Running</td></tr>
</table>

Desired status when the 2nd loop starts:

<table>
<tr><td>Thread_Group_Number</td><td>Counter_Value</td><td>Status</td></tr>
<tr><td>2</td><td>12</td><td>Running</td></tr>
<tr><td>3</td><td>13</td><td>Running</td></tr>
</table>

Actual behavior: Thread group is configured as follows: Number of threads: 3 Loop Count: 2 Counter min: 11, max: 13, and increment by 1.

Screenshot for the actual behavior

I want in Thread 2 Loop 2 Counter value to be 12, Thread 1 Loop 2 Counter value to be 11, and Thread 3 Loop 2 Counter value to be 13. in other terms I want the value of counter in the following loops to be the same as the their values in the first loop at the same thread number.

How can I achieve that?

1

There are 1 best solutions below

1
On

If you add Counter test element and configure it like:

enter image description here

You should get the behavior close to the one you expect

enter image description here

More information: How to Use a Counter in a JMeter Test