loadrunner通过web的post请求方法测接口
loginapi()
{
web_url("rest",
"URL=http://192.168.117.154/router/rest",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t1.inf",
"Mode=HTML",
LAST);
web_url("favicon.ico",
"URL=http://192.168.117.154/favicon.ico",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t2.inf",
"Mode=HTML",
LAST);
lr_rendezvous("loginapi");
lr_start_transaction("loginapi");
lr_set_debug_message(LR_MSG_CLASS_EXTENDED_LOG | LR_MSG_CLASS_RESULT_DATA, LR_SWITCH_ON );
web_reg_find("Text=操作成功",
LAST);
web_submit_data("testpost",
"Action=http://192.168.117.154/router/rest",
"Method=POST",
"RecContentType=text/html",
"Mode=HTML",
ITEMDATA,
"Name=method","Value=test.user.UserService.userInfoByTicket",ENDITEM,
"Name=v","Value=1.0",ENDITEM,
"Name=app_key","Value=120",ENDITEM,
"Name=ticket","Value=1111111111111111111111111111111",ENDITEM,
"Name=sign","Value=22222222222222222222222222222222",ENDITEM,
LAST);
lr_set_debug_message(LR_MSG_CLASS_EXTENDED_LOG | LR_MSG_CLASS_RESULT_DATA, LR_SWITCH_OFF);
lr_end_transaction("loginapi", LR_AUTO);
return 0;
}
---------------------
转载,仅作分享,侵删
作者:fin_123
原文:https://blog.csdn.net/zouhui1003it/article/details/54849303
|
|