I was just beginning to enter the testing industry, but the more fortunate I have done the development before, so the code is more familiar with the LoadRunner has not been a systematic study, but also through their own groping slowly accumulate knowledge.
Today I encountered a project to do a stress test, some of the parameters are not fixed, need to be inconsistent with each parameter, such as parameter sequence number, 20 digits.
So how do you set this parameter in LoadRunner?
1. First select this parameter in the script
Right click on "Replace parameter" to pop up the following page
Parameter names can be filled out, preferably with the parameter name consistent, parameter type select random number, and then click the Property Settings button, pop up as follows:
This is the key page that sets the random number.
First of all, the data type is a random number type, generate a random number of the range, such as 1-100, the key to see the number of num type,%08lu this identity is the number of digits, you choose to find the Smple column also changed.
This is the number of bits that determine the number of random numbers generated.
Come back to see our needs, how to set a random number to meet our needs:
1. Set a 20-bit random number
The corresponding code is: seq = lr.eval_string ("<seq><seq1><seq2>");
SEQ Sets the 8-bit random number, SEQ1 sets the 8-bit random number SEQ2 sets the 4-bit random number, which sets the 20-bit random number.
Additional requirements for the previous few are fixed values, you can set the SEQ = "000000" + lr.eval_string ("<seq><seq1>"); 000000 is a fixed value, so everyone should understand it.
Finally look at the following:
Each occurrencr: Gets a random number whenever a set random number is encountered, such as 2 parameters in an iteration with 1 random numbers, each time we get a random number, 2 parameters are different.
Each iteration: You need to set a random number for each iteration, such as 2 parameters in a single iteration with 1 random numbers, each time you get a random number. 2 parameters are evaluated as
Once: Generate a random number at a time
Is my opinion, if there is the wrong place, please point out, I am good to correct, thank you!!!
LoadRunner generating random parameters radom correlation