Http://www.cnblogs.com/fnng/archive/2012/06/22/2558900.html
It's been more than a year since the last time we used LoadRunner. At the beginning of the test in the project used, not in the back of the project, the focus on the things outside the tool, think that performance testing is not only used tools, and recently want to have a good sharp weapon after all, can help themselves to complete the performance testing work better. This is a cognitive process!
When the installation opened LoadRunner , found that although their thoughts are still in, but it is very unfamiliar, many settings can not find a specific location. The parametric parameterization is one of the most common techniques used in performance testing. It should be explained here that not only LoadRunner can set the parameterization, but also the JMeter I used previously had similar settings.
We know that the performance test tool simulates multiple users validating the performance of the system (which is not entirely true), and some systems allow multiple identical users to do exactly the same thing at the same time, some of which are not allowed. For example, a mailbox generally allows the same account to be logged in multiple places. And our QQ account is certainly not allowed. For example, when you register a system, the user name cannot be duplicated. But the password can. Therefore, parametric techniques are used in so many situations.
We are here to record a 139 mailbox Login via Loadurnner. Here is a small piece of code to intercept
...... web_submit_form ("Login.ashx","Snapshot=t3.inf", ItemData,"Name=username","Value=Chongshi"" name= Password" value=< Span style= "color: #ff0000;" >123456 "name=verifycode" Value= "name=auto" value= <off> "
Here's a look at how to parameterize the user name password with LoadRunner. The red content is the login username and password.
Parametric approach
Select the content you want to parameterize.
Method one, right- ---"Replace with a new parameter"
Method Two, the menu "insert"----"new Parameter ... "
Parameter Properties ( Parameters Property dialog box )---- Our parameterization settings are done through this dialog box.
Parameterized Way :
In fact, there are many ways of parameterization, here is a brief description of some of the more common people way. In fact, the way is slightly different, but the result is to add data.
1. Edit Data
Click Create table to appear in the table, Click Edit with Notepad again in the form, and then open a notepad where we can add data to Notepad
2. Adding dat data files
Click Browse at the back of the File input box. "button to find the local txt data file and add it.
Note that the data inside the file should not be scrambled, each row of data, or it will be read incorrectly.
3. Database Add Data
In many cases, I added the data is not 10 article 20, nor Besty, if also by the above two ways to add, I think it will be a very tangled matter. So we can import the data through the database. Do you have doubts about how the data in the database is made, the data generation of the database is very simple, can write a simple code generation, or through the database data generation tool to complete
Click on the Date Wizard to open the Connect to database.
Here is the first to tell you that this way, the following to introduce the specific operation. ^_^
4. Other types of settings
If we are not going to parameterize a file, such as a specific date time, you can choose from the Parameter type list
Here you can set the date time format, loop iteration mode, but other than the file type, the other uses not much. I don't know much about other types of usage.
The association between parameterization
Before we have parameterized the user name, or the password is parameterized, so that the script will be able to run normally, not to say. Because the user name and password are not one by one correspondence, the user name and password that are taken each time the script is run do not correspond to the problem.
Suppose that we have already parameterized the user name, the parameter name is "username", and the following setting the password parameterization is associated with the user name.
Click "properites..." The Edit User name Parameterization window opens. file list box, which just saved the user name information for "Username.dat".
Click "Add Column..." , Add a new column of information to place the password.
Click "edit with Notepad" To edit the parametric data file again, using the user name password to establish one by one correspondence.
Upon completion, we have successfully parameterized the username and password and have a corresponding relationship between the user name and password.
How data is distributed and updated
After the script is set to parameterized, the script runs every time the parameterized values are different, then what is the value of the case to take? There will be many ways
Select Next row"Choose Next Line":
Order (sequential): According to the parameterized data order, one by one to fetch.
Random: Thedata is parameterized, and each time it is randomly extracted from it.
Unique: assigns a unique piece of data to each virtual user
Update value on "Values at Update":
Each iteration (each iteration): The new value is taken each iteration, and if the user takes the first data, it is called an iteration; all of the users take the second data, and so on.
Each occurrence (each occurrence): Take a new value each time the parameter, emphasizing that the previous and the two times the value cannot be the same.
Take only once (once): parameterized data, one data can only be extracted once. (If the data is finished, the script will be running.)
There are three scenarios for the above two options, and if they are combined, there will be nine ways to take them.
Select Next Row "Select Next Line" |
Update Value on "Value on Update" |
Replay Result Results |
Order (sequential) |
Each iteration (each iteration)
Result: Writes the data to the data table, respectively
Function Description: Each iteration takes one row of values, starting with the first row. When all values have been taken, start from the first row
For example, if there are four data in the parameterized file , and the iteration is set to three times, then the data in the first row of the parameterized file has two in the execution result .
Order (sequential)
Each occurrence (each occurrence)
Result: Writes the data to the data table, respectively
Function Description: Each iteration takes one row of values, starting with the first row. When all values have been taken, start from the first row
For example, if there are four data in the parameterized file , and the iteration is set to three times, then the data in the first row of the parameterized file has two in the execution result .
Order (sequential)
Take once (once)
Result: The table writes exactly the same data.
Function Description: Each iteration takes the data from the first row in the parameterized file.
Stochastic (random)
Each iteration (each iteration)
Result: Data is written to the table, but duplicate data may appear
Function Description: Assign a row of data randomly selected from the parameterized file each time
Stochastic (random)
Each occurrence (each occurrence)
Result: Data is written to the table, but duplicate data may appear
Function Description: Assign a row of data randomly selected from the parameterized file each time
Stochastic (random)
Take once (once)
Result: the same data is written in the table
Function Description: Randomly fetch a row of data from the parameterized file at the first iteration, followed by the first iteration of the data for each iteration.
Only (unique)
Each iteration (each iteration)
Automatically allocate block size
Result: Writes the data to the data table, respectively
Function Description: The first iteration takes the first data in the parameterized file, the second iteration takes the second data, and so on.
Note: If you set the number of iterations to three times. Result: An exception is thrown when performing the first iteration, and the Exception Log can be seen in the LoadRunner replay log (Replaylog).
Only (unique)
Each occurrence (each occurrence)
Step size is 1
Result: Writes the data to the data table, respectively
Function Description: The first iteration takes the first data in the parameterized file, the second iteration takes the second data, and so on.
Note: If you set the number of iterations to three times, and there are only four data in the parameterized file , the data is not clear enough. You can now set the Whenout of values property to determine how to handle when the data is not enough
Abort vuser: interrupt Virtual User
Countinue in a cylic manage: loops through the values in the parameterized file, that is, when the values in the parameterized file are taken out, the values are taken from the first line of the parameterized file.
Countinuewith last value: Continue with final data
Only (unique)
Take once (once)
Result: the same data is written in the table
Function Description: Each time you take the first data in the parameter file to assign a value
Go LoadRunner parametric explanation