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 }

 

posted on 2017-06-13 11:32  帅胡  阅读(274)  评论(0编辑  收藏  举报

导航