Igor Kromin |   Consultant. Coder. Blogger. Tinkerer. Gamer.

NOTE: This article is 3 years or older so its information may no longer be relevant. Read on at your own discretion! Comments for this article have automatically been locked, refer to the FAQ for more details.
This is a simple example on how to create and use a counter inside JMeter. The counter can be set up so that it increments independently for each user i.e. thread, or it can be a global counter. The process to define either type of counter is almost identical.

To create a counter, start with a Thread Group, right click it and select Add > Config Element > Counter.
jmeterctr_1.png


This will present the counter configuration pane. The Name is just what will appear on the left in the Test Plan, the important value to set is the Reference Name, this is the variable name that the counter will be referred to in the rest of the project.

Other variables should be configured as desired with a start, increment and maximum parameters. If Track counter independently for each user is ticked, the counter will be a per-thread counter instead of a global counter.
jmeterctr_2.png


To use the counter, for example in a SOAP/XMP-RPC Request simply refer to it by its name, like so:
 Counter referral
...
${my_ctr}
...




-i

Skip down to comments...
Hope you found this post useful...

...so please read on! I love writing articles that provide beneficial information, tips and examples to my readers. All information on my blog is provided free of charge and I encourage you to share it as you wish. There is a small favour I ask in return however - engage in comments below, provide feedback, and if you see mistakes let me know.

If you want to show additional support and help me pay for web hosting and domain name registration, donations, no matter how small, are always welcome!

Use of any information contained in this blog post/article is subject to this disclaimer.
 
comments powered by Disqus
Other posts you may like...