Using CSV Data Set Config – Jmeter example

This post shows you how to use a the CSV Data Set Config feature in Jmeter i.e how to use a csv file in your Http Request.(P.S You can use it in a lot of other cases but this is where it is most used. My example here uses it for Http Request but you can use the same logic)

1) Open Jmeter and create a thread group and a Http Request sampler.

2) Right click on the Http Request just created and Add a Config Element -> CSV Data Set Config.


3) Select the CSV Data Set config. Here there are three main things that you need to fill to make sure it works.
a) Filename: Include the full path to the CSV config file or if you only want to use the name of the file then make sure the csv config file is in the same folder as your jmx file.

b) Variable Names (comma-delimited): This is where you will name the variables corresponding to the coloumns in the CSV file you want to use in the HTTP request.

c) Delimiter: It is generally “,” for a CSV file. But if your file has a different limiter you should use that e.g. “:”

The rest of the fields:
Allow quoted data?:
Recycle on EOF?:
Stop thread on EOF?:
Sharing mode:
Are pretty self explanatory.
This is how my setup looks like.
Here the csv file i.e. loginConfig looks like


4) Now your CSV config data set is done, lets see how to use it in the our HTTP Request.The example I have shown here is not a working one but we are just interested in the variables. The variable names from the CSV config data set can be used here using the ${{variable_name}} syntax.
Here is how it looks like.


5) I have added a Tree listener to see the actual result of my request. Here is how my response looks like.





Jmeter Post Processor XPath Extractor example

Post processors are used for generally asserting or extracting data from the response/data received from an HTTP request.

XPath extractor is one of the many options provided by the Jmeter to work on a response or data received.

In this test I make a HTTP Api call and get XML data in return and then use XPath extractor to extract a value.

The extracted value can be used as a variable or cab be used to assert for something.

1) Create a Test plan and add a Test group and a HTTP Request sampler. If you do not know how to use a HTTP request sampler then go to my previous post

Here I have used a example server name. You should use an address that will give back XML data to parse.

Screen Shot 2014-04-02 at 7.30.45 PM

2) Now add a XPath Extractor POST processor for the HTTP request sampler you just created. It should look something like this.

Screen Shot 2014-04-02 at 7.36.57 PM

3) Now consider that when you run the test you will receive an XML.

For eg:



Considering this XML data is received in the response and you want to extract the name.

In the XPath extractor there are three fields.

Reference name: Username (variable name you will use this to access this value later in the tests. You can access it using ${Username)

Xpath Query: //user/name (This is the query used to extract the name from the XML data above)

Default Value: NoNameFound(This the the default value the the variable ${Username} will have if it does not find the name tag in the XML data)

It would look something like this

Screen Shot 2014-04-02 at 7.46.49 PM

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

Jmeter Example Http Request

1) Open Jmeter and right click on the Test plan and add a new thread group.

Screen Shot 2014-02-18 at 3.37.03 PM

2) Right click on Thread group .Add,Sampler Http Request

Screen Shot 2014-02-18 at 3.39.59 PM

3) The server name or Ip is the address of the server you want the request to go to. Here for example I use
(Observe the Method is GET by default. You can chose from range of options depending on what you want to do)

Screen Shot 2014-02-18 at 3.42.44 PM

4) Now yo need to add a listener that would listen for a response from the google server after you have made the request.
Right click Thread Group.Listener.View Results as tree

Screen Shot 2014-02-18 at 3.44.20 PM

5) Run the test plan.
You will see in the Listener that the request Succeed and see all the response header and data

Screen Shot 2014-02-18 at 3.46.51 PM (2)