How can I increment a counter every N loops in JMeter?

Posted by Dave Hunt on Stack Overflow See other posts from Stack Overflow or by Dave Hunt
Published on 2010-07-13T14:35:07Z Indexed on 2012/09/28 9:38 UTC
Read the original article Hit count: 272

Filed under:
|
|
|

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?

© Stack Overflow or respective owner

Related posts about concurrency

Related posts about loops