loadrunner怎么测试接口
答案:1 悬赏:30 手机版
解决时间 2021-11-29 05:47
- 提问者网友:那叫心脏的地方装的都是你
- 2021-11-28 08:55
loadrunner怎么测试接口
最佳答案
- 五星知识达人网友:未来江山和你
- 2021-11-28 09:16
测试接口可以直接写,使用web_custom_request函数就行了,给你个例子,前提是http协议的接口,其他协议的接口又有不同的写法:
Action()
{
lr_start_transaction("QryNoInfoByNo_资源查号码信息");
web_reg_save_param("Return_Code","LB=RETURN_CODE":"","RB=",",LAST);
web_custom_request("sGSQ_QueryScore",
//"URL=http://10.152.30.101:51300/esbWS/rest/MainService_QT",
"URL=http://152.55.249.46:51000/esbWS/rest/MainService",
"Method=POST",
"TargetFrame=",
"Resource=1",
"RecContentType=text/html",
"Referer=",
"Mode=HTML",
"EncType=application/json",
"Body={ "ROOT": { "REQUEST_METHOD": "QryNoInfoByNo", "BAT_ID": "", "SEND_TIME": "", "REQUEST_INFO": { "PHONE_NO": "{Phone_no}", "OP_CODE": "1000", "RES_STATUS": "0", "LOGIN_NO": "M3ABB0076", "CHECK_FLAG": "1" } } }",
LAST);
// lr_message("RETURN_CODE = %s
", lr_eval_string("{Return_Code}"));
if(strcmp("0000", lr_eval_string ("{Return_Code}")) == 0)
{
lr_end_transaction("QryNoInfoByNo_资源查号码信息", LR_AUTO);
}
else
{
lr_end_transaction("QryNoInfoByNo_资源查号码信息", LR_FAIL);
lr_error_message("RETURN_CODE = %s
", lr_eval_string("{Return_Code}"));
}
return 0;
}
Action()
{
lr_start_transaction("QryNoInfoByNo_资源查号码信息");
web_reg_save_param("Return_Code","LB=RETURN_CODE":"","RB=",",LAST);
web_custom_request("sGSQ_QueryScore",
//"URL=http://10.152.30.101:51300/esbWS/rest/MainService_QT",
"URL=http://152.55.249.46:51000/esbWS/rest/MainService",
"Method=POST",
"TargetFrame=",
"Resource=1",
"RecContentType=text/html",
"Referer=",
"Mode=HTML",
"EncType=application/json",
"Body={ "ROOT": { "REQUEST_METHOD": "QryNoInfoByNo", "BAT_ID": "", "SEND_TIME": "", "REQUEST_INFO": { "PHONE_NO": "{Phone_no}", "OP_CODE": "1000", "RES_STATUS": "0", "LOGIN_NO": "M3ABB0076", "CHECK_FLAG": "1" } } }",
LAST);
// lr_message("RETURN_CODE = %s
", lr_eval_string("{Return_Code}"));
if(strcmp("0000", lr_eval_string ("{Return_Code}")) == 0)
{
lr_end_transaction("QryNoInfoByNo_资源查号码信息", LR_AUTO);
}
else
{
lr_end_transaction("QryNoInfoByNo_资源查号码信息", LR_FAIL);
lr_error_message("RETURN_CODE = %s
", lr_eval_string("{Return_Code}"));
}
return 0;
}
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯