The significance of parameterization is no longer mentioned, and the individual considers that there are two situations in which parameterization is used:
1. In order to get a series of data for different users to use, such as concurrent registration is not possible to register the same account many times, need a large number of different account data to run, where the parameterization;
2. When the parameter is not a constant, the value changes in different circumstances, such as the IP address, it can be parameterized, when the IP changed after I changed the parameters can be, there is no need to change the address of the script every time, easy to maintain code.
There are different ways of parameterization, basically they are very similar. Here we introduce two kinds, one is the direct boundary parameter, and the other is to manipulate the database and import the data from the database.
The following mainly describes the parameters of the multi-column parameter one by one, such as the need to parameterize four parameters, the four parameters are one by one corresponding: User name, password, confirm password, mailbox, parameterized steps are as follows:
1. Select the object you want to parameterize, right-click on "Replace with a new parameter"
2. Click "Browser" to create a new params directory under the script directory to hold all parameterized data for this script, select the directory and click "CREATE TABLE"
3. Click "Edit with Notpad" to open Notepad, enter parameters in Notepad (line break split), close Notepad, turn off parameterized properties, click "OK", so the username is parameterized.
4. Check the password, repeat step 1 above, go to the Parameter Properties page, select the Newparam file you just created, click "Add Colum", click "OK"
5. Click "Edit with Notpad" to open Notepad, enter the password parameter after the comma, save close Notepad, close the parameter properties, click "OK"
Confirm the password, the mailbox is the same as step five, we will look at the parameterized strategy after the creation.
Select Next Row "Choose Next Line"
1. Order (sequential): According to the parameterized data order, one by one to fetch.
2. Random: Parameterize The data, each time randomly extract data from it.
3. Unique: Assign 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, if 50 users take the first data, called an iteration; 50 users take the second piece of 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 9 strategies grouped together, as follows:
Select Next Row "Select Next Line" |
Update Value on "Value on Update" |
Replay Result Results |
Order (Sequential) |
Each iteration (each iteration) |
Result: 15 data are written 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 15 data in the parameterized file, and the iteration is set to 16 times, the data in the first row of the parameterized file has two in the execution result. |
Order (Sequential) |
Each occurrence (each occurrence) |
Result: 15 data are written 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 15 data in the parameterized file, and the iteration is set to 16 times, the data in the first row of the parameterized file has two in the execution result. |
Order (Sequential) |
Take once (once) |
Result: 15 Identical data is written in the table. Function Description: Each iteration takes the data from the first row in the parameterized file. |
Stochastic (Random) |
Each iteration (each iteration) |
Result: 15 data is written in 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: 15 data is written in 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: 15 identical data written in 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. |
|
each iteration (each iteration) Automatically allocate block size |
results: Write 15 data to the datasheet function Description: First iteration takes the first data in the parameterized file, the second iteration takes the second piece of data, and so on. Note: If you set the number of iterations to 16 times. Result: An exception is thrown when the 16th iteration is performed, and the Exception log can be seen in the LoadRunner replay log (replaylog). |
|
each occurrence (each occurrence) Step 1 |
result: 15 data are written 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 iteration count to 16 times, and there are only 15 data in the parameterized file, there is not enough data. You can set the "When out of values" property to determine how to handle the data when it is not enough abort vuser: Interrupt Virtual user countinue in a cylic manage: Loop through the values in the parameterized file, that is, when the values in the parameterized file are finished, the values are taken from the first line of the parameterized file. countinue with last value: Continue with last data |
Only (unique) |
Take once (once) |
Result: 15 identical data written in table Function Description: Each time you take the first data in the parameter file to assign a value |
To sum up, our registration here needs each time the data are different, then we choose the 7th strategy, Unique+each iteration, the first iteration takes the first data in the parameterized file, the second iteration takes the second data, and so on. When the number of iterations is greater than the parameterized data, the error is set as follows:
Next introduced from the database to import parameters, because SQL Server Baidu has a lot of introduction, here no longer repeat, mainly talk about the mysql,mysql of the database driver need to install their own, here to a path, we have the next officer online line:
https://dev.mysql.com/downloads/connector/odbc/
Download good after the default settings are installed to complete, here we take the login example, we directly from the database query to the user name as a parameter.
1. Refer to the first step above, go to the Parameter Properties page, click on the
2. Continue to click as shown in turn
3. Select the MySQL driver that you just installed, click Next, click Finish
4. The database information is filled out as follows, after the successful test, click "OK", "OK", know back to step five of the interface
5.sql input Query statement, click "Finish", the parameterization is successful
The above is my humble understanding of the parameterization, if there is a wrong place to look, thanks!
LoadRunner parameterization & parameterization strategy & parametric MySQL