Counters and random variable generators in Jmeter

Counter-Used to generate a numeric data and use it in our tests.We can give the counter a start value ,increments and ref variable i.e how to store this value.

Add a new thread group.Add 4 java reqs.Add a counter.Give values like start,increment,max and number format.

We can give any number format like 0,00,0000 or even User0000.

Give it a reference name.

In each java req give name like Java Request 2 ${count} thread group ${__threadNum}

So ${count} will give number of count as we have give count as reference variable in counter.

If there are more than one iterations threadNum will give the number of iteration.

If we want the value of counter to remain the same for the same user we can set track user independency for each user.So the counter number will not change if we go from user one to user two if we have more than 1 users in our thread group.

If we also don’t want the user to increment with each loop we can choose to reset it to the default value at end of each loop. So if we click Reset Counter on each thread iteration the counter will not change if we have more than one iterations and we go from one iterations to other per user.

Random variable generator-Same way we have this config element. Difference between counter and this config element is that it only generates random variables each time.