To create a load test we record a typical user session with help of a browser and a load testing tool. We want to use that session as a template to emulate hundreds or even thousands users working with our web site simultaneously. Our load testing tool will replay the recorded session for each user that it emulates.
However we also want each virtual user to use a different user name/password pair. That is why after recording a profile with our session we need to parameterize it. In other words, parameterization specifies how to make a real new session from the template that we originally recorded.
Let’s see how this can be done. As an example I will use WAPT and the following web site: http://www.loadtestingtool.com/forum.
I recorded a very simple session in which a user simply logs in to the web forum. It consists of 4 page requests:
Even though last 3 requests use same URI, they have different sets of parameters. You can also notice that the third request uses POST method as specified in its properties, whereas other requests use GET. I select the POST request in the left view.
Now we can see that the user name and password entered when recording the profile were passed as parameters of this request. They were recorded as static values. To parameterize our profile we need to modify the specification of these parameters.
I select the “UserName” parameter in the list and click the “Edit” button. What I see now is the “Edit Parameter” dialog.
In WAPT each parameter is specified as a concatenation of several functions. This is the most general approach that allows us to create complex values. However usually we need to use only one function, so I select the only line in the list and click the “Edit” button again.
Now I need to choose a function that will return a different user name for each virtual user. Initially the “Static text” function is selected, however as it is obvious from its name, it returns same text for each user. So, we should change it. I click the combo to see the list of available options.
We will discuss all these functions some time later. By the way, a formal description of each one is available here.
I want to choose a function that will take a list of user names and will return elements from it one by one for each new virtual user. This function is called “Ordered list”.
I enter the names in the edit field in that dialog, one per line. If I used a long list, I could also specify a file to read the names from.
After finishing with the user name parameterization I repeat the same procedure with the password. As a result both parameters are specified now as follows.
That’s all! Now if we execute our test with 3 virtual users, each will repeat same session, but will use a different name/password pair. What if we add 4th user? Since we specified only 3 values for the “Ordered list” function, when it reads to the end of the list, it will have to start from the beginning and the 4th user will login as “user1/pass1” again. If this is not acceptable for your test, you should simply add more values.