Parameterization in JMeter

What is Parameterization and why it is required?

Parameterization is the technique using which we can execute a test plan multiple times with a different sets of data. This helps in creating a load test script that closely simulated real-world scenarios where different users use different test data.
Suppose, we have to do load test of a search engine like google. The first step will be to record the search scenario. Now to do an effective load test, we can’t just playback the script for say 100 users. We should simulate 100 users that search for 100 different things. For this we can use parameterization, wherein we can have a CSV file that contains 100 different search keywords. Now instead of the static search item that we had recorded in our script, we can include the search items from the CSV file dynamically.

Parameterization example using JMeter

  1. First of all, you need to do recording of a scenario for which parameterization is required e.g. load testing of a search functionality. Then we need to identify the request or call that is associated with the search action. A simple way to find the particular request is to find the search term that we have used during recording. Like if we had recorded with search term – ‘abc’ then we should find the field that has ‘abc’ as its value.

2. Now we have to parameterize this field’s value. For this, we will use the ‘CSV Data Set Config’. Click on Thread group-> Add->Config Element->CSV Data Set Config.

3. Create a CSV file containing elements that can be used as the search parameter value.

4. Now come to JMeter and place ‘CSV Data Set Config’ controller anywhere before the request/call that has the search action- parameter (see below image for reference). Next, we need to configure the ‘CSV Data Set Config’ control. In the file name text box – enter the name of the CSV file along with the whole path. If the CSV file is in the same directory where the JMeter script is located then the path can be omitted. In the variable name textbox – enter any valid variable name.

5.Now go to the parameter that has static search item value. In the parameter value of that parameter write “${name of the variable created in step 4}”

That’s all we have in this section, please share it with your friends and colleagues. Check out the complete JMeter tutorial below.

JMeter Tutorial

Now on running the load test, for more than 1 user or for more than 1 iterations, at each execution a new value will be fetched from the CSV file (this can be verified from the “View Result Tree” listener). This was all about parameterization.

От QA genius

Adblock
detector