1
votes

I want to test concurrency, and reliably replicate an issue that JMeter brought to my attention.

What I want to do is set a unique identifier (currently the time in milliseconds with a counter appended) and increment the counter between loops but not between threads. The idea being that the number of threads I have set up is the number of identical identifiers before incrementing and using another.

If I had 3 threads with a loop count of 2 I want:

1. Unique ID: <current-time-in-millis>000000
2. Unique ID: <current-time-in-millis>000000
3. Unique ID: <current-time-in-millis>000000
4. Unique ID: <current-time-in-millis>000001
5. Unique ID: <current-time-in-millis>000001
6. Unique ID: <current-time-in-millis>000001

I've tried using Throughput Controllers to increment a counter, as well as several other things that seemed they should work but had no luck. This seems like something JMeter should be able to do. Is there any way to get the value of the loop count?

2

2 Answers

2
votes

Is Counter the solution?

or use __intSum

init variable (eg in "User Defined Variables"):

Name:       | Value
------------+---------
LoopCounter | 0

use increment where ever you need:

${__intSum(${LoopCounter},1,LoopCounter)}

using:

${LoopCounter}
1
votes

Have you tried playing with the "track counter independently for each user" option on the pre-processor Counter element?

My understanding is that this should give you a separate counter for each thread group.