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

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