Using parameters in Loadrunner VuGen script
Parameterizing is a powerful thing in LoadRunner!
Now, I'm going to demonstrate some tips and uses of them.
Well, imagine the following situation...
Let's we have created VuGen script, which emulates the one user:
The problem: script runs correctly in VuGen for one user, but it fails for several concurrent users. This happens since we recorded the VuGen script for the specific user:
I marked "username" and "password" parameters and values with red lines.
Application under test (AUT) does not allow several sessions of the same user.
So, if second concurrent VuGen user logs in to application, he gets an error:
The solution: to parameterize the VuGen script.
Implementation:
- Right click on a value we want to parameterize (in our case this is a username - "load1") and select "Replace with a parameter" menuitem:
- Name the new parameter as "UserName" and click OK btn:
Please, pay attention to "Parameter type" combobox. It contains interesting possible types, such as: "Date/Time", Iteration Number, Random number, even XML, and others.
I will not describe them in the present post... I hope, I will have a chance to describe parameter types later. In any case, it depends on the opinion of the blog readers :) - Wow! the value "load1" will be changed with a UserName parameter:
We have just added the new parameter! It's wonderful, isn't it, dear friend? :)
But where can we specify the real values for our parameter? How to configure it?
Let's continue... - "Parameter properties" will be shown:
- Ooh! Everything is completed I hope. Now, we have to create a scenario, add parameterized LoadRunner VuGen script and execute it :)
Here you are:
All transactions passed. In other words, all concurrent user logged with their unique login/password combination. Each user had his own session.
The summary: Parameterizing allows simplify load/performance testing:
- Instead of writing a separate LoadRunner VuGen script for each virtual user, we added parameters for specific information (username & password) and used the one script for all users.
- Parameterizing allows decrease maintenance cost. If application under test is changed, one test should be updated for 100 (e.g.) users, but 100 tests for each user
- Supporting of tests is a real pleasure :) To add new user, a test has to update dat-files only.
2 comments:
How do you use single dat file for more than one parameter ?
Post a Comment