Insights from Our Experts

Blog image

Parameterization using JMeter

Author Image

Shinoj Surendran,QA Lead

Instead of putting the hard coded value as input parameters for a functional, API testing etc, you might have thought about how can we use a file, table, database objects for better test coverage. Here is the answer “parameterization”. 

A test containing several sets of hard coded values will be rather difficult to manage. 
In parameterization testing, the input values for the test are fetched from data files. These data files can be excel,csv files.

As you know that, JMeter is a performance and load testing tool, it supports parameterization.

Let’s look at how parameterization is done using JMeter. Here I would like to depicts it in a simple way using REST API.

API means Application Programming Interface.There are different types of APIs such as REST, SOAP, RPC etc. For parameterization, I choose a REST API "ExchangeRate-API". This API will return the exchange rate of currencies.


Step 1: Add test plan

As you know that, for testing, we create a test plan, which describes what to test and how.

Step 2: Create a parameterization table in .csv format

From the ExchangeRate-API,  We need the following parameters in order to test 
the exchange rates from one currency to another.

  • ‘YOUR_KEY’  - is the key parameter (unique key )for each registered user.
  • ‘from’ - is the parameter for currency code which is to be converted from.
  • ‘to’ - is the parameter for currency code which is to be converted to.
  •  Save the file ("exchanegerates.csv") anywhere in your system.

Step 3: Add a thread group and set properties 

Select Test Plan >  Add > Threads(Users) > Thread Group

Set the thread properties as follows

  • Number of Threads: means Number of rows (threads) in the csv files
  • Ramp-up period:  how long to take to "ramp-up" to the full number of threads chosen
  • Loop count: specifies the number of times to execute in the Performance Test. We put the number of threads as 5. This is because of our csv file contains 5 rows of parameters.


Step 4: Configuring CSV Data Set

Let’s look at the configuration fields.

  • File name: Put the absolute path of the csv file, if the csv file not saved in the JMeter bin folder
  • File encoding: The encoding to be used to read the file
  • Variable Names: List of variable names (comma-delimited). If this field is empty, the first line of the file is read and interpreted as the list of column names.
  • Delimiter: Delimiter to be used to split the records in the file. 
  • Allow quoted data?:  Should the CSV file allow values to be quoted?. By default, it will be False.
  • Recycle on EOF: Should the file be re-read from the beginning on reaching EOF?. By default, it will be True.
  • Stop thread on EOF: Should the thread be stopped on EOF, if Recycle is false?. By default, it will be False.
  • Sharing mode: All threads ( the file is shared between all the threads.)


Step 5: Add an HTTP Request sampler and set web server, path, parameters etc.

Select Thread Group > Add > Sampler > HTTP Request


The following are the steps to set the IP, Path, Parameters, etc. for HTTP Request.


  • Set Webserver details

Server Name or IP: (From the ‘ExchangeRate-API')

  • Set HTTP Request details

Implementation : HttpClient4
Protocol [http]: https   
Method : GET
Path : pair/YOUR_KEY/from/to
(From the ‘ExchangeRate-API’)

Variables are referenced in Jmeter as follows:-

So we need to change the path as  pair/${YOUR_KEY}/${from}/${to}  according to our csv file column titles.

  • Set Parameters

Set the parameters as per our csv file. Name column consists of all the column titles
and value column consists of respective variable names in ${}format.


Step 6: Add Listeners (View results in table, view results in tree)

 Select Thread Group > Add > Listener > View Results in Table. Same as for ‘View Results in Tree’.


Step 7: Run and validate the test

Save  (Ctrl+S) and Run the test (Ctrl+R). Observe the Listeners

The View Result in Table listener displays all information about each sample in the form of a table. The table shows time-related data for each sample, the payload data, the thread number and the sample execution result. 

The View Results Tree listener will show samples that the JMeter samplers generate. For each  HTTP Request sampler, the View Results Tree listener provides the request parameters, response parameters, and the response data will be displayed under the corresponding tabs such as sampler result, request, and response data.
The Sampler result tab contains the response code, headers, cookies and information about time etc.


The Request tab contains information about headers that the JMeter script added, the URL, the HTTP method and cookie information.


The Response data tab contains the response body of the sample.