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.
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.
How would this work if we do not know user’s passwords. e.g. when there is a single sign-on is in play?
You should prepare the required number of user names and passwords for your site before testing, so that each virtual user would have its own credentials.
Pingback: How to analyze a load test report? Part 2: Test design problems.
Hi Ivan, it is me again, thank you for this amazing tutorials!
i don’t know why the second user cannot login!
During Stress testing – ramp up load : am increasing one user for every one minute ( upto 10 users).
The first user saves one record in an application. The same record is keep on saved multiple times for all the 10 users it seems.
If the same record is keep on saved several times , it seems the records have been duplicated. I am seeing 32 records. How is it possible? how 32 records are saved with the same data.
In your test each user could execute several sessions and create several records in your system.
If you have more doubts on this, please send your test source files (.wps and .wpp) to support@loadtestingtool.com.
What should i do to avoid this?
If you have any further questions on how to handle this in your specific case, please send your profile (.wpp file) and its verification log to support@loadtestingtool.com.