Friday, 24 January 2014

Parameterization using CSV data set Config in Jmeter

Now we will learn how to parameterize the values using CSV data set Config.

For parameterization also we will use a public site as an example i.e. www.redbus.in.
Follow the following steps : 
1] Add Thread Group Recording Controller and HTTP Request.

            In HTTP Request > Server Name or IP : Enter http://www.redbus.in
2] Add a HTTP Proxy Server for the Workbench
3] Start the Proxy Server and open Mozilla Firefox and go to http://www.redbus.in.

4] After recording a few transactions, close the browser and stop the Proxy server in Jmeter. U get the below recordings.
5] Here we have seen the tickets from Mumbai to Goa on 07-Dec-2011
6] Now we will parameterize the destination Mumbai to Goa, Bangalore, Chennai and Delhi.
Now add a CSV Data set Config and a Listener element to the thread group.

7] Add->Config Element->CSV Data Set Config

8] Add->Listener->View Results Tree
9] Now open a notepad (inside bin) and enter your keywords.

10] Save the file as tocity.csv. The extension csv makes it a comma separated Value (CSV) file.
11] Now select the CSV Data set Config element and fill in the fields as follows
          Filename: tocity.csv
(Give the path name if you have put it inside a subfolder e.g. foldername\tocity.csv)
           Variable Names: A
(This variable name is referenced in the search sample.)
Delimiter: ,

12] Now go to the Booking/select bus.aspx and change the value of variable toCityName to${A}.In Jmeter we reference a variable using ${} .For each iteration the value of toCityName will be replaced as fetched by variable A.
 
We need to do the necessary changes of the value of these variables wherever they are present in recorded script.
13] Now go to thread group and make the number of threads (users) to 4.

14] Save the script and Run the script (ctrl + R).

15] See the Results, Check the Destination Places.




This is how parameterization is done. Hope it helps you in practicals.

1 comment:

  1. Thanks for sharing this useful info with us, this post will be useful for beginners those who wish to learn Jmeter. keep on sharing.Jmeter Training Course |
    Jmeter Training Institute in Chennai |
    Jmeter Training |
    Best Jmeter Training Institute in chennai

    ReplyDelete