51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

查看: 2657|回复: 1
打印 上一主题 下一主题

[原创] 自己整理的LR脚本编写规范

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2010-4-6 15:15:36 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
大家看看有啥要增加的,大家有的建议也请补充
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                                                                        
      
        Name=rejCode, "Value=1", ENDITEM,                                        Name=rejCode, "Value=2", ENDITEM,                                                
        Name=rejDesc, "Value=", ENDITEM,                                        Name=rejDesc, "Value=", ENDITEM,                                                

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》
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏1
回复

使用道具 举报

  • TA的每日心情
    奋斗
    2018-2-28 18:04
  • 签到天数: 40 天

    连续签到: 1 天

    [LV.5]测试团长

    2#
    发表于 2010-4-15 15:57:52 | 只看该作者
    好文,值得一读。谢谢。
    回复 支持 反对

    使用道具 举报

    本版积分规则

    关闭

    站长推荐上一条 /1 下一条

    小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

    GMT+8, 2024-5-9 10:07 , Processed in 0.073694 second(s), 27 queries .

    Powered by Discuz! X3.2

    © 2001-2024 Comsenz Inc.

    快速回复 返回顶部 返回列表