Tuesday, December 6, 2011

Parameterization using CSV data set Config

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.

15 comments:

  1. Great, really helpful thanks for the Post :)

    ReplyDelete
    Replies
    1. Hearty welcome :)
      Thanks for your feedback/response.

      Delete
    2. it's really very helpful,thanks

      Delete
  2. How to Load test Login functionality with JMeter having Viewstate & Eventvalidation.

    ReplyDelete
  3. Mahesh, thanks for article.

    There is also jmeter video tutorials which cover article. I think it will be interesting.

    ReplyDelete
  4. Nice article. Easy to understand.
    Beginner can quickly grab Jmeter features :)

    ReplyDelete
  5. how to set of unique values for each thread in jmeter.

    ReplyDelete
  6. how to pick up unique data for each iteration from parameterisation file in jmeter

    ReplyDelete
  7. Hello,
    This is a great post. So clear and easy to follow. Thanks for the tangible and attainable help. All your hard work is much appreciated. I just wanted to share information about JMeter Online Training .

    ReplyDelete
  8. This is very useful for a beginner. I simply mark this article for future reference. Keep sharing that kind of message. Thank you for sharing. Good reading. Thank you for the data. It helps us.

    DedicatedHosting4u.com

    ReplyDelete