LoadRunner parameter value definition-from one metre of sunlight

Source: Internet
Author: User



Familiar with the LoadRunner, I believe will often use parametric functions, but for the use of the parameterization of how much to know, it is worth pondering. Including myself also, every time when doing stress testing, basically have to some dynamic parameters for large data volume reading, the use of parametric function is also to better meet the practical application. So the use of it does not mean that understanding, but also can not be used to represent flexible use. Recently in an interface pressure test let me encounter a bit of trouble, originally prepared 100,000 levels of data, but in the execution of the pressure scene, the development of pressure to monitor the database table records found that the actual insertion of data sometimes only less than 1000, even when there is only one, At first I thought it was the interface that made some complex judgment rules, which required developers to remove the rules in the program, including the constraints in the database tables, or to relax, so that some data could be avoided because of rules and constraints. After a toss-up, found that the data is still not in accordance with the expected results in the storage, and the current table constraints only one rule, that is, the uniqueness of the data must be inserted every time is unique, that is, the new value, but this for the LoadRunner parameterization is fully achievable, After some tossing and finding that this parametric function is still so simple, it seems that each setting can understand, but if not in-depth practice to prove that the results are really very different.



The key to changing the parameterized method of value is the select Next row and update value on both options.



The Select next row includes the following options:


    • Sequential: Sequential mode
    • Random: Stochastic mode
    • Unique: The only way


Update value on includes the following options:


    • Each iteration: Update values for each iteration
    • Each occurrence: Update each value
    • Once: Update only once


Below we will parse the effect of each combination setting by the following script, the script is as follows:



Action ()
{
int i = 0;
for (i=0; i<5; i++) {
Lr_eval_string ("{paramtemp}");
}
Lr_eval_string ("{paramtemp}");
return 0;
}



Note: The function of the above script is to iterate through the 5 parameters first, and then read the value of the parameter once the loop is finished. The parameter data prepared for parameter paramtemp has temp1~8 a total of 8 data, for testing use.



1, Sequential+each iteration (sequential mode + each iteration update value), set run-logic in the action loop iteration 5 times, and run the above script, the results are as follows:



ACTION.C (5): Notify:parameter substitution:parameter "paramtemp" = "Temp1"
ACTION.C (5): Notify:parameter substitution:parameter "paramtemp" = "Temp1"
ACTION.C (5): Notify:parameter substitution:parameter "paramtemp" = "Temp1"
ACTION.C (5): Notify:parameter substitution:parameter "paramtemp" = "Temp1"
ACTION.C (5): Notify:parameter substitution:parameter "paramtemp" = "Temp1"
ACTION.C (7): Notify:parameter substitution:parameter "paramtemp" = "Temp1"



ACTION.C (5): Notify:parameter substitution:parameter "paramtemp" = "Temp2"
ACTION.C (5): Notify:parameter substitution:parameter "paramtemp" = "Temp2"
ACTION.C (5): Notify:parameter substitution:parameter "paramtemp" = "Temp2"
ACTION.C (5): Notify:parameter substitution:parameter "paramtemp" = "Temp2"
ACTION.C (5): Notify:parameter substitution:parameter "paramtemp" = "Temp2"
ACTION.C (7): Notify:parameter substitution:parameter "paramtemp" = "Temp2"



。。。。。。



Through the replay log as above, we can find that the total loop action5 the data in 5 parameterization, but each time the action script executes, the internal values of the script are the same. The sequential is set to guarantee sequential reads, and each iteration is based on the run-logic setting, meaning that the new value is read after each loop. If a set number of cycles exceeds the number of rows in the data, then the result after playback is that it is more than eighth, starting from the Nineth and starting from Temp1, and completing the read process of the loop iteration.



2, Sequential+each occurrence (sequential mode + each value update), set Run-logic action loop Iteration 5 times, and run the above script, the results are as follows:



Action.c (5): Notify:parameter substitution:parameter "paramtemp" =  "Temp1"
Action.c (5): Notify:paramete R substitution:parameter "Paramtemp" =  "Temp2"
Action.c (5): Notify:parameter substitution:parameter "Paramte MP "= " Temp3 "
Action.c (5): Notify:parameter substitution:parameter" paramtemp "= " Temp4 "
Action.c ( 5): Notify:parameter substitution:parameter "paramtemp" =  "Temp5"
Action.c (7): Notify:parameter Substitution : Parameter "paramtemp" =  "TEMP6"



ACTION.C (5): Notify:parameter substitution:parameter "paramtemp" = "TEMP7"
ACTION.C (5): Notify:parameter substitution:parameter "paramtemp" = "TEMP8"
ACTION.C (5): Notify:parameter substitution:parameter "paramtemp" = "Temp1"
ACTION.C (5): Notify:parameter substitution:parameter "paramtemp" = "Temp2"
ACTION.C (5): Notify:parameter substitution:parameter "paramtemp" = "Temp3"
ACTION.C (7): Notify:parameter substitution:parameter "paramtemp" = "Temp4"



。。。。。。



Analysis of two iterations of the replay log as we can see, each iteration of the value is changing, and all are reading a new row of data, when the data read, and then re-sequential read. Here we can clearly recognize that the results after each occurrence and each iteration are read in a completely different way, each occurrence is updated every time it is evaluated.



3, Sequential+once (sequential mode + read only once), set run-logic in the action loop iteration 5 times, and run the above script, the results are as follows:



Action.c (5): Notify:parameter substitution:parameter "paramtemp" =  "Temp1"
Action.c (5): Notify:paramete R substitution:parameter "Paramtemp" =  "Temp1"
Action.c (5): Notify:parameter substitution:parameter "Paramte MP "= " Temp1 "
Action.c (5): Notify:parameter substitution:parameter" paramtemp "= " Temp1 "
Action.c ( 5): Notify:parameter substitution:parameter "paramtemp" =  "Temp1"
Action.c (7): Notify:parameter Substitution : Parameter "paramtemp" =  "Temp1"



ACTION.C (5): Notify:parameter substitution:parameter "paramtemp" = "Temp1"
ACTION.C (5): Notify:parameter substitution:parameter "paramtemp" = "Temp1"
ACTION.C (5): Notify:parameter substitution:parameter "paramtemp" = "Temp1"
ACTION.C (5): Notify:parameter substitution:parameter "paramtemp" = "Temp1"
ACTION.C (5): Notify:parameter substitution:parameter "paramtemp" = "Temp1"
ACTION.C (7): Notify:parameter substitution:parameter "paramtemp" = "Temp1"



。。。。。。



As can be seen from the replay log, the reading here is in line with once's literal understanding, it only read the parameters once, because it is sequential read, so it only read a first row of data. About once reading is usually the place where we make mistakes, we think that choosing once may be that each parameter is read only once, resulting in the possibility of inserting only one piece of data into the library.



The next thing we need to know is that the other two options in select Next row are random and unique, as follows:



Random: Indicates a randomly read mode


    • Random+each iteration, the only difference between sequential reads is that this is a random read, and the value is the value of each iteration
    • Random+each occurrence, random value update mode
    • Random+once, randomly fetches a row of data, and then repeats the iteration to read this row of data


Unique: The main emphasis is on the uniqueness of the value, if there is no such value at the end, LR provides other solutions:






The drop-down list here is available in three ways, as follows:


    • About VUser, when the number of values exceeds the number of arguments, the run of the script is ignored
    • Continue in a cyclic manner, when the value is exceeded, enable a circular scan to scan those data that has not yet been used
    • Continue with last value, reading the final row of data repeatedly


Therefore, the uniqueness of unique value method is worth, and often used more, especially for some database tables have unique constraints of the field, you must cooperate with this setting to smooth execution.



In fact, in the parameter setting way, the reading order of the data row is basically straightforward, but in the combination of the value of the way it is easy to cause some confusion, especially each iteration and each occurrence two ways, The former is based on run-logic iteration loop value, and each occurrence is based on the new value each time, of course, in general, the two actually have commonality, if there is only one parameter in a script, and only once the parameters are read, the result of setting these two methods is the same, The script can be reduced as follows, after playback can be found that the results are the same, but in advance is a combination of order and random two ways, if mated uniqueness, the result is another matter. The reduced script is as follows:



Action ()
{
Lr_eval_string ("{paramtemp}");
return 0;
}



The first step in performance testing is to create a test script that conforms to the actual application, while debugging and optimization of the script is the most important in the script creation process, how to use the parameterized function rationally, it is very important for the final scene operation and monitoring, if it is not understood, it will waste a lot of time to analyze, mislead the developer, Also misled by their own test results analysis.






Persons Library Connection



LoadRunner parameter value definition-from one metre of sunlight


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.