How to do Parameterization in JMeter using CSV?

Parameterization in JMeter using CSV

If you are a QA engineer, it’s almost impossible you haven’t got your hands dirty on Apache JMeter. The open source software is used to do load and performance testing and analyze the overall performance of dynamic web applications.

In this blog, I would like to discuss one of the features of JMeter which allows you to do parameterization using the CSV file where if you have to execute one test plan for more than one user at the same time, you can do so using the CSV data set config.

What is Parameterization ?

In simple words, Parameterization in JMeter is the process where test plans are executed with multiple sets of user Input Data.

Why it is required?

This method is used to generalize an action for many users. When a test plan needs to run/execute for more than one user at the same time, parameterization concept is used.

For example – If we need to test Login Page with Different username and passwords then we surely cannot hardcode the values, hence we need to parameterize the value. We need to get username and password values from external database like CSV Data Set Config.

Let us take a look at this simple example to execute parameterization concept in JMeter:

Configuring different elements of CSV Data Set Config

Csv Data Set Config is used to read all values from a CSV File, store them in variables and use them as Test Data during Execution.

    • FileName :- If your file (.csv)is located at /bin then you can just use a FileName(.csv) and if it’s somewhere else, use the full path of file.
    • Variable Names :- This will contain all variable names(comma separated) which is equivalent to a “column name” in a csv file in the same order. If this field is kept empty, then JMeter will by default take the 1st row from csv file.
    • Delimiter :- It is used to separate each record in csv file. Comma is the default delimiter, but if your file uses tabs, then we need to define that here only.
    • Allow quoted data? :- Values can be put under “” (double quotes) which allows values to contain a delimiter, if enabled.
    • Recycle on EOF? :- If you plan to iterate over the csv file more than once you must set it true as it instructs jmeter to move back to the top of the CSV file.
    • Stop thread on EOF? :- Set it true if you want to stop after reading the whole csv file.
    • Sharing mode :-
      1. All threads: File is shared between all the threads.
      2. Current thread group: Each file is opened once for each thread group in which the element appears.
      3. Current thread: Each file is opened separately for each thread.

Now add necessary elements :-

  1. Thread Group
  2. Sampler- HTTP Request
  3. CSV Data Set Configuring
  4. Summary Report

JMeter window will look like this-


1) Click on Thread group-> Add->Config Element -> CSV Data Set Config.


2) Open the bin folder from JMeter installation path. Create a text file and enter values into it. Now save the text file with proper name and “.csv” extension and keep it in the Bin Folder.



3) Now, open CSV Data Set Config and enter exact Filename and Parameters.


4) Select the HTTP request where we are supposed to pass the CSV parameters in value part of “Send Parameters With the Request” in form of “${username} and ${password}” as shown below.


5) Now all you need to do is run the script and verify the result for that Add > Listener > View result tree.


So, this is how parameterization is done.

I hope now you have better understanding of parameterization in JMeter. In case you find any difficulty in any step, you can always drop it in comments and I will try to answer.

You might also like