Loadrunner关联取参及设置检查点

Posted 雪山非猪

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Loadrunner关联取参及设置检查点相关的知识,希望对你有一定的参考价值。

Loadrunner关联取参及设置检查点:

获取post的响应值当作参数存储,要在此post请求之上添加

 1 web_reg_save_param("sign",
 2         "LB=md5码是:[",
 3         "RB=]",
 4         "Search=All",
 5         LAST);
 6 
 7 
 8     web_submit_data("tomd5", 
 9         "Action=http://v49.pclady.com.cn:8090/servlet/tomd5", 
10         "Method=POST", 
11         "RecContentType=text/html", 
12         "Referer=http://192.168.23.25:8080/tomd5/index.jsp", 
13         "Snapshot=t124.inf", 
14         "Mode=HTTP", 
15         ITEMDATA, 
16         "Name=courseId", "Value=1802", ENDITEM, 
17         "Name=prizeID", "Value=432", ENDITEM, 
18         "Name=r", "Value={time}", ENDITEM, 
19         "Name=userId", "Value={userId}", ENDITEM, 
20         "Name=tijiao", "Value=提交", ENDITEM, 
21         LAST);

25   //lr_output_message("# sign: %s",lr_eval_string("{sign}"));

44     lr_rendezvous("all");
45      lr_start_transaction("prizeDraw"); 
46    web_submit_data("prizeDraw.do",
47        "Action=http://v2.pclady.com.cn:83/app/prize/prizeDraw.do?",
48        "Method=POST",
49        "RecContentType=text/html",
50        "Referer=",
51        "Snapshot=t75.inf",
52        "Mode=HTTP",
53       "EncType=application/x-www-form-urlencoded; charset=GBK",
54        ITEMDATA,
55        "Name=courseId", "Value=1802", ENDITEM,
56        "Name=prizeID", "Value=432", ENDITEM,
57        "Name=r", "Value={time}", ENDITEM,
58        "Name=userId", "Value={userId}", ENDITEM,
59        "Name=sign", "Value={sign}", ENDITEM,
60        LAST);

检查点设置:在请求下面

web_submit_data("login.jsp", 
        "Action=https://v46.pclady.com.cn/passport3/passport/login.jsp", 
        "Method=POST", 
        "RecContentType=text/html", 
        "Referer=http://v46.pclady.com.cn/passport3/", 
        "Snapshot=t6.inf", 
        "Mode=HTTP", 
        ITEMDATA, 
        "Name=username", "Value={username}", ENDITEM, 
        "Name=password", "Value=123456test", ENDITEM, 
        "Name=return", "Value=http://v46.pclady.com.cn/passport3/ok.jsp", ENDITEM, 
        "Name=_test", "Value=a parameter follow to track", ENDITEM, 
        LAST);


web_reg_find("Text=Welcome", 
        "SaveCount=Welcome_Count", 
        LAST );
    web_url("c", 
        "URL=http://v46.pcbaby.com.cn/passport3/c?s=D6C87F772BB52A41D99A16703BD15AE355482C7B0A5BA857A536458EE44B4FD9&u={username}&auto=1&r=http://v46.pchouse.com.cn/passport3/c?s=&r=http://v46.pconline.com.cn/passport3/c?s=&r=http://v46.pcauto.com.cn/passport3/c?s=&r=http%3A%2F%2Fv46.pclady.com.cn%2Fpassport3%2Fok.jsp", 
        "Resource=0", 
        "RecContentType=text/html", 
        "Referer=", 
        "Snapshot=t7.inf", 
        "Mode=HTTP", 
        LAST);

    

if (atoi(lr_eval_string("{Welcome_Count}")) > 0){ 

        lr_output_message("Log on successful."); 

        } 

     else{ 

        lr_error_message("Log on failed"); 

        return(0); 

     } 

 

以上是关于Loadrunner关联取参及设置检查点的主要内容,如果未能解决你的问题,请参考以下文章

LoadRunner创建脚本和场景流程

loadrunner提高篇-插入检查点与关联函数

Loadrunner手动编写包含检查点关联等元素的脚本实例

接口测试丨loadrunner接口测试

LoadRunner 如何设置关联

loadrunner11的移动端性能测试之脚本优化