Parameterisation in JMeter

KOPKUN SAEYANG
Arcadia Software Development
3 min readDec 10, 2018

There are many ways to make parameterization, and in this section, I recommend you two ways. There are using CSV file, and using JMeter’s function.

  1. How to read data from CSV file.

Reading data from CSV file is the one that mostly uses in Parameterization. We use CSV file to store parameter and call it in JMeter.

When will you have to use CSV?

For example when you have to test Load of login with the different account and absolutely, you can’t load test with only one account. So you should have list of account. One way that I recommend you is you have to create a csv file to store account that you want to use.

This is the example of CSV, the first row is the parameter name, and the rows below are the parameter value. The next column is for another parameter, you can have many parameter as you want. Remember that parameter name will be used in JMeterto call each parameters value. And this excel file can be only CSV, it cannot be other types.

How to read CSV in JMeter.

Righ click on Test Pland →Add →Config Element →CSV Data Set Config

You will get CSV Data Set Config window like this. There are 3 parts that commonly use, Filename, Recycle on EOF , Stop Thread on EOF.

  1. Filename : Select you CSVfile location and name.
  2. Recycle on EOF : When end of file, do you want to use it again or just stop. If you want to use this file like your threads are 100 and your csv file has only 20 accounts, and you want to loop that 20 accounts till it hit 100 threads. In this case, you have to make sure that your program are friendly with duplicate data. Select true false to indicate it.
  3. Stop thread on EOF : If you want thread to stop when this file end then select True.

After you done adding CSV Data Set Config, this is the example how you use it. In HTTP Request on Body Data part you can use it here. You have to put “${csv columname}”. From the csv file above we have username column, then we will use ${username}”. Thus, all account will be assigned from username is csv file.

{
"loginId": "${username}",
"password": "1234",
}

2. How to use random function to create parameters.

For example when you want to load test some Create Function, and the data can duplicate, this is the easiest way for you to create a Body Data. This function provides a RandomString function which returns a random String of length (first argument) using characters (second argument). As an example below, I will get 10 string between a-z (example “tfghynmjki”, “cvbfgrthnm” )

${__RandomString(10,abcdefghijklmnopqrstuvwxyz,)}

There are so many functions in JMeter for using in Parameterisation, you can search for more example in JMeter website here.

https://jmeter.apache.org/usermanual/functions.html

--

--