Saturday, February 20, 2016

Jmeter - Counter Config Chemical Cistron Alongside Example

| Saturday, February 20, 2016
Apache JMeter has many dissimilar configuration elements too counter is ane of the configuration chemical cistron of JMeter. Counter config chemical cistron allows you lot to laid a counter too and therefore you lot tin plow over the sack purpose it's reference anywhere inwards your thread grouping of your software charge evidence plan. Let's empathise how to add together too configure counter inwards your software charge evidence plan.

Add Counter In Test Plan
You tin plow over the sack add together counter under Thread Group, Controller or Request every bit per your requirement. Let's add together it nether Simple Controller. To add together counter nether uncomplicated controller of your software charge evidence plan,
  • Right click on Simple Controller.
  • Select Add -> Config Element -> Counter. every bit shown inwards bellow image.

It volition add together counter nether uncomplicated controller.

Parameters of Counter Config Element
Counter config chemical cistron has many dissimilar parameters every bit shown inwards bellow image. You tin plow over the sack laid them every bit per your requirement.

  • Start : It represents the starting set out of counter during showtime iteration.
  • Increment : It represents how much you lot wants to increment counter afterwards iteration. 
  • Maximum : Maximum how much counter tin plow over the sack increase. Once accomplish on maximum, It volition move reset.
  • Format : This is optional field. i.e. 0000 volition format every bit 0001, 0002 etc.
  • Reference Name : Reference mention of this counter to purpose it in other elements. If laid Count as reference mention too therefore you lot tin plow over the sack purpose it every bit ${Count} inwards other elements.
  • Track Counter Independently for each User : If banking enterprise tally this checkbox too therefore each thread become its ain counter during iterations. Means each thread gets independent count.
  • Reset counter on each Thread Group Iteration : If you lot wants to reset count of counter at the destination of iteration too therefore you lot tin plow over the sack laid it true.
Using Counter In Software Load Test
To run into how counter config chemical cistron truly works, Let's run into practical example.

Scenario : I convey prepared evidence excogitation amongst ane asking "News Page" every bit shown inwards bellow image. I wants to laid delay of 1 minute too it should increment past times 1 minute on every iteration. Max delay should increment till five seconds.

We volition purpose counter to increment delay fourth dimension count on each iteration too use Constant Timer to laid delay. Constant Timer purpose utilisation Reference Name of counter every bit Thread delay.
  • Thread Group Config

Thread grouping properties are every bit shown inwards in a higher house image. I convey laid Number of Threads = 1 too Loop Count = vi iterations.

Counter and Constant Timer config are every bit bellow.
  • Counter Config

You tin plow over the sack run into that i convey laid Start = 1000, Increment = G too Maximum = 5000. So counter volition start amongst G too it volition increment G on each iteration. We volition purpose Count reference mention inwards constant timer's thread delay textbox every bit shown inwards bellow image.
  • Constant Timer Config

During 1st iteration thread delay volition move G millisecond, During 2nd iteration thread delay volition move 2000 millisecond, too therefore on. So at the destination of each iteration, thread delay volition increment past times 1 minute till max five seconds.

When you lot run test, upshot volition looks similar bellow.


You tin plow over the sack run into that Start Time divergence betwixt 1st too 2nd sample asking is nearest 1 second(Exclude Sample fourth dimension of 1st asking inwards fourth dimension divergence calculation. i.e. Delay = 09:35:34.341 - 09:35:32.631 - 0.709 = 1 second.).

This is only event of counter config chemical cistron to exhibit you lot how it works. You tin plow over the sack purpose it amongst whatsoever other elements of your software charge evidence plan.

Related Posts