Thursday, 31 July 2014

Parameterization in Jmeter



Parameterization: CSV Data Set Config

Parameterization is process by which user input some values to test script at execution time using external files such as csv, xls, txt, xml etc. 

The data entered from user (client side) must be stored in a text file and linked with JMeter, this is called as Parameterization.

Eg:  Suppose we need to check login functionality with 100 set of user so in this case we parameterize users from external file. At execution time user picked dynamically.

Steps for Parameterization

1.       Record a simple Wiki search in Jmeter. Put the search keyword as “Jmeter”. The result will be something like this.




2.       We will parameterize the search keyword “Jmeter”.
3.       For that, Add a CSV Data set Config and a Listener element to the thread group.

Add->Config Element->CSV Data Set Config

Add->Listener->View Results Tree



4.       Now create a text file with data set.




5.       Define the path of the file in CSV data config and give the variable name.

Filename: searchitem.txt



(Give the path name if you have put it inside a subfolder e.g. foldername\search.csv)



Variable Names: searchitem



(This variable name is referenced in the search sample.)



Delimiter: ,


6.       Now go to search sample and change the value of variable Jmeter to ${searchitem}.In Jmeter we reference a variable using ${} .For each iteration the value of text will be replaced as fetched by variable.
 




7.       Now run the script and view the results in View Result Tree, Check if the script is picking up the variable name from the file.




8.       Now change the loop count in the thread group as 3. So that script will run 3 times.




9.       Check the results in View result tree, the script runs 3 times, each time picking new data from the file.

  






 



 


 




3 comments:

  1. Hi Archana,

    I can I control Jmeter to pick up the records in serial order(1st, 2nd,3rd etc) from parameter file. I observed that they are picked up randomly for execution... Srinivas

    ReplyDelete
  2. Hi Archana,
    Do you have any idea about using java code in the jmeter?

    ReplyDelete




  3. Wow! This could be one particular of the most beneficial blogs We have ever arrive across on this subject. Actually Excellent. I am also a specialist in this topic so I can understand your hard work.



    Best Free Android Games of 2019


    ReplyDelete