Jmeter Example (Counter)

1) Add a new Thread group and then add a counter.
Thread Group -> Ad -> Config Element -> Counter

Screen Shot 2014-02-18 at 4.13.44 PM

2) Click on the counter. You will see a number of options showing up.
Start -> Where you want your Jmeter variable to start with
Increment -> By how much do you want to increment everytime
Maximum -> Where do you want to stop
Reference Name -> Name of the variable you would use to access the value of the count. In this example we would access in an Http Request

Screen Shot 2014-02-18 at 4.18.44 PM

Here our count will start from 1 and end at 5. (1,2,3,4,5 since increment in 1)

3) Add a Http Request and a Listener(View Results Tree) and use the Jmeter variable we have declared in the counter i.e. count. In jmeter the syntax ${variable} is used to reference a variable.

Screen Shot 2014-02-18 at 4.23.59 PM

Check the Path in the Http Request where I have used the count.

4) Select thread group. You will see an option for Number of threads. Since in our counter we have a count from 1 to 5 i.e. 5 Http req with count as 1,2,3,4,5.
Input Number of threads : 5

Screen Shot 2014-02-18 at 4.29.28 PM

5) Run the test Plan.
You will see that there will be 5 Http Req and in the Http Req you will see the count increasing from 1 to 5. (The req would fail as it is an invalid Url. But the count should work)

Screen Shot 2014-02-18 at 4.31.47 PM

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s