Performance testing 101 - Parameterization of values in load testing
In load testing, we record a script and run the same script for different sets of concurrent users. When we record a script for the first time, the values as entered while recording get captured as default values. The issue here is the recorded script has only one set of values which are the default values and they remain the same during the entire schedule for the test. As such user-defined values cannot be entered and the test is not the actual simulation of the production environment. Parameterization technique helps overcome this situation in load testing. With parameterization, we create a file which has user-defined values, import the file into the script, and replace the default values at the respective places in the script.
Let's take an example to illustrate the same:
Consider a simple application with a login page which displays the account summary of the user. We assume we have to load test this application for 300 users. Each of these 300 users has different usernames and passwords.
Following steps are followed:
• Record the script
While recording the script for the load testing we used WebLoad 5 and the user entered the following credentials : Username - user1 and password - user1
Here is the part of the script which captures these user entered values as default values -
wlHttp.ContentType = "application/x-www-form-urlencoded"
wlHttp.FormData["j_username"] = 'user1'
wlHttp.FormData["j_password"] = 'user1'
wlHttp.FormData["Submit"] = "Login"
wlHttp.Post(wlHttp.Url)
• Create a text file called 'login_300users.txt' with the user-defined input values in a comma-separated pattern. Like -
user1,user1
user2,user2
user3,user3
..........
user300,user300
• Include the following code at the beginning of the script to add the file with user-defined values.
function InitAgenda() {
IncludeFile("AsmLib.js",WLExecuteScript)
CopyFile("login_300users.txt")
}
• Initialize an array to represent the elements which are comma separated.
DataArr_Login=GetLine("login_300users.txt")
• Replace the values with the variables.
wlHttp.ContentType = "application/x-www-form-urlencoded"
wlHttp.FormData["j_username"] = DataArr_Login[1]
wlHttp.FormData["j_password"] = DataArr_Login[2]
wlHttp.FormData["Submit"] = "Login"
wlHttp.Post(wlHttp.Url)
Thus, the script is modified for load testing and the values are parameterized as per the user-defined values.
Comments
How do we accomplish this for a win form based application ?
We need to design custom VS 2010 based Tool that will look into a table and login remotely [ RDP ] into terminal server on which APPLICATION [ win form based ] is .
Once NT user is logged in to a terminal server , it will click APPLICATION's exe and login with APPLICATION Login .
Posted by: Vikram | November 10, 2010 9:25 PM
Good Example for Paramterisation
Posted by: Shabir Ahmad | October 19, 2013 6:15 PM