对于这类接口怎么测试
http协议 post方法 接口,怎么测试,,lR怎么写脚本,能给个例子不?你这是什么工具 web_reg_save_param ("test_result", "LB=\"test_result\":\"", "RB=\",", "Search=Body", LAST);
web_custom_request (reqName,
"URL=http://192.168.16.109:8088/v1/auth?method=get",
"Method=POST",
LAST);
eg:web_reg_save_param ("test_result", "LB=\"test_result\":\"", "RB=\",", "Search=Body", LAST);
中的test_result为这个post请求的返回值,如果有返回值并需要比较就截取;如果没有可以忽略
HP Loadrunner/Documentations/Fuction Refrence 里面有相关函数的用法 lr_start_transaction("mylogin");
web_reg_save_param("mlogin",
"LB=resultcode",
"RB=resultinfo",
"SaveOffset=4",
"SaveLen=3",
"NotFound=ERROR",
"Search=All",
LAST);
web_custom_request("Mylogin",
"URL=http://192.168.1.123:8086/user/userlogin",
"Method=POST",
"TargetFrame=",
"Resource=0",
"Referer=",
"Mode=HTTP",
"EncType=application/json",
"Body={\"userName\" : \"7571@qq.com\","
"\"passWord\" : \"111111\","
"\"width\" : \"50\","
"\"height\" : \"50\"}",
LAST);
if(strcmp(lr_eval_string("{mlogin}"),"200")==0)
{
lr_end_transaction("mylogin",LR_PASS);
return 0;
}
else
{
lr_end_transaction("mylogin", LR_FAIL);
return -1;
}
return 0; 回复 1# jonish
lr_start_transaction("mylogin");
web_reg_save_param("mlogin",
"LB=resultcode",
"RB=resultinfo",
"SaveOffset=4",
"SaveLen=3",
"NotFound=ERROR",
"Search=All",
LAST);
web_custom_request("Mylogin",
"URL=http://192.168.1.123:8086/user/userlogin",
"Method=POST",
"TargetFrame=",
"Resource=0",
"Referer=",
"Mode=HTTP",
"EncType=application/json",
"Body={\"userName\" : \"7571@qq.com\","
"\"passWord\" : \"111111\","
"\"width\" : \"50\","
"\"height\" : \"50\"}",
LAST);
if(strcmp(lr_eval_string("{mlogin}"),"200")==0)
{
lr_end_transaction("mylogin",LR_PASS);
return 0;
}
else
{
lr_end_transaction("mylogin", LR_FAIL);
return -1;
}
return 0;
页:
[1]