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.
1

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

2

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
ishaan,test123
usertest,ishaan

3

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.

4

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

5

Result

6

Advertisements

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 google.com
(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)