loadrunner脚本001

Posted 帅胡

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了loadrunner脚本001相关的知识,希望对你有一定的参考价值。

 1 Action()
 2 {
 3     int result = 9999;
 4 
 5     
 6     lr_start_transaction("login");
 7 
 8 
 9     web_add_cookie("JSESSIONID=061460B7DFF2F7C2C4275FE06EE08184; DOMAIN=abcd.com");
10 
11     web_add_header("Accept","text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8");
12 
13     web_set_max_html_param_len("65535");
14 
15     web_reg_save_param_ex(
16         "ParamName=return_url",
17         "LB=Location: ",
18         "RB=\r\n",
19         SEARCH_FILTERS,
20         "Scope=Headers",
21         LAST);
22 
23     web_submit_data("login", 
24         "Action=https://xxxxx.xom", 
25         "Method=POST", 
26         "RecContentType=text/plain", 
27         "Referer=https://xxxx.abc", 
28         "Mode=HTML", 
29         ITEMDATA, 
30         "Name=j_username", "Value=admin", ENDITEM, 
31         "Name=j_password", "Value=123456", ENDITEM, 
32         "Name=x", "Value=162", ENDITEM, 
33         "Name=y", "Value=22", ENDITEM, 
34         LAST);
35 
36     result = strcmp(lr_eval_string("{return_url}"), "https://alpha.jxedc.com:8383/touch.html");
37 
38     //lr_output_message("login successfu! login_count is: %d", result);
39 
40     //lr_output_message("login successfu! cookie value is: %s", lr_eval_string("{return_url}"));
41 
42     if(result == 0)
43     {
44         lr_end_transaction("login", LR_PASS);
45     }
46     else
47     {  
48         lr_end_transaction("login", LR_FAIL);
49     }
50 
51     return 0;
52 }

 

以上是关于loadrunner脚本001的主要内容,如果未能解决你的问题,请参考以下文章

LoadRunner脚本编写

loadrunner录制成功但脚本内容为空,无任何代码//脚本中包含乱码

LoadRunner脚本编写

LoadRunner脚本编写(转)

loadrunner脚本编写经验

LoadRunner脚本编写