标题: 自己整理的LR脚本编写规范 [打印本页] 作者: hongtang 时间: 2010-4-6 15:15 标题: 自己整理的LR脚本编写规范 大家看看有啥要增加的,大家有的建议也请补充
Performance Test Script Desgin Specification
Script Development Requirement
1-The following steps outlined the procedure to be followed before staring recording
1. Verify the test environment,make sure all the feature is available
2. Prepare the test data for script recording
3. Execute the test case before recording
4. Keep all of the test steps have been record in once
2- Format of script name
For script generated by Virtual User Generator, defined the name as follows:
<System name>_<BP Name>_<Short Description>
● The values of variable <System name> as following:
1 xxx
2 xxxx
3 ssss
● The values of variable <BP name> is test case's name (such as BP1,BP2)
● The values of variable <Short Description> is a brief description of script's feature. Two or three words is better
eg dataentry quote issue policy ARAP
3- Create a set of variables to parameterize all of the key values.
1 all of the correlation object value of business should be parameterized
eg PolicyNo
Policyid
**id
QuoteNo
…..
2 Record two same test case twice by same input data, parameterize all of the object that have same object with different value
eg
First Recording
The objects rejCode & syskey_page_token shoud be parameterized
3 Format of parameter name, same as the object name. If have same object name, can increase a suffix (_01, _02) to differentiate
eg Name=PolicyId, "Value=11108704", ENDITEM, Name=actorId, "Value={PolicyId}", ENDITEM,
Name=InsuredId, "Value=11108704", ENDITEM, Name=actorId, "Value={InsuredId_01}", ENDITEM,
Name=InsuredId, "Value=11108705", ENDITEM, Name=actorId, "Value={InsuredId_02}", ENDITEM,
4- Script Comments
Scripts should be commented well for readability and maintainability. It is a critical for a load test run, it is advised to comment the scripts in order to improve the quality.
5- Format of transaction name.
Transaction names should not be too long. It may cause unexpected behavior, during the performance test.
Transaction name format is <BP name>_<step no>_<step abbr name>
● The values of variable <BP name> is test case's name (such as BP1,BP2)
● The values of variable <step no> is test step id
● The values of variable <step abbr name> is a brief description of step opertion, One or two words is better
6- Create the content check point
This is critical to have these content checks at every step of the script to make sure server is responding correctly even under high load conditions.
e.g. It will display the string “Successfully” in page after operator issue policy. So you should add checkpoint in the script to check whether the web_submit_data is correct.
LR offered a function: web_reg_find("Text= <Check Test>", LAST);
It will auto-generate web_reg_find when you recording script, If the following settings is enabled
Tools -> Recording Options -> Advanced -> Select <Generate web_reg_find functions for page titles>, Then select <Generate web_reg_find functions for sub-frames>.
7- Execute script and Verify test results.
After finish the scripts, we should do some testing to make sure the scripts is available
Running Setting in Loadrunner
1 No pace time
2 No think time
Verify Step
1 Execute the each script running for 10 mins in controller by single Vuser, no error info
2 Execute the each script running for 10 mins in controller by 5 concurrent Vuser, no error info
转贴注意版权《hongtang》作者: archonwang 时间: 2010-4-15 15:57
好文,值得一读。谢谢。