java编写Loadrunner脚本

web.set_max_html_param_len("1000000");
lr.start_transaction("red_envelop");
web.reg_find("Text=\"status\":\"1\"",
new String[]{
"SaveCount=before_count",
web.LAST //"LAST"
});

web.submit_data("agentlogin.do",
"Action=http://172.16.10.21:8080/hoss-society/app4/login/agentlogin.do",
new String[]{

"Method=POST",
"TargetFrame=",
"RecContentType=text/html",
"Referer=http://172.16.10.21:8080/hoss-society/app4/login/agentlogin.do",
"Snapshot=t8.inf",
"Mode=HTML"
},
new String[]{
"Name=nonce", "Value=123456", web.ENDITEM,
"Name=timestamp", "Value=1430890357514", web.ENDITEM,
"Name=user_pass", "Value=123456", web.ENDITEM,
"Name=user_name", "Value=18911111119", web.ENDITEM,
"Name=appKey", "Value=qqb", web.ENDITEM,
"Name=digest", "Value=dq4ndffodLdmdHcnuuWrty4rde3n1i2rJDdneu=odLgn", web.ENDITEM,
web.LAST});

lr.output_message("The count value is " + lr.eval_string("<before_count>"));

if(Integer.parseInt(lr.eval_string("<before_count>"))==0)
{
//lr.output_message("The phone value is " + lr.eval_string("{phone}"));
lr.end_transaction("red_envelop", lr.FAIL);
}
else
{
lr.end_transaction("red_envelop", lr.PASS);
}
//System.out.println("hello world");
//HelloWorld.main((String[])null);
return 0;

posted on 2015-05-19 17:33  帅胡  阅读(356)  评论(0编辑  收藏  举报

导航