TestMechanic
TestMechanic

Reputation: 173

Jmeter - how to add prefix to a counter. Similar to a random variable

Currently in the random variable I can put a prefix or suffix in the output format of the variable. However this nice feature is not available for a simple counter controller. Concatenating string+${counter} every time when i use the variable is not a good option form me since i do this a lot.

Is there any way to achieve prefix+counter in a way random variable do this?

Thanks.

Upvotes: 5

Views: 11367

Answers (2)

Huy Hóm Hỉnh
Huy Hóm Hỉnh

Reputation: 617

On 'Number format' field of Counter, write your pattern with 0...0 represents for value count up.

Example:

'Number format' pattern: prefix_000_suffix

Real value: prefix_001_suffix, prefix_002_suffix, prefix_003_suffix,...

Hope this helps!

Upvotes: 0

UBIK LOAD PACK
UBIK LOAD PACK

Reputation: 34536

Are you talking about Counter Config Element ?

If so it is possible using Number Format attribute:

See:

   Format   Optional format, e.g. 000 will format as 001, 002 etc. 
   This is passed to DecimalFormat, so any valid formats can be used. 
   If there is a problem interpreting the format, then it is ignored. 
   [The default format is generated using Long.toString()] 

enter image description here

Upvotes: 5

Related Questions