LoadRunner 接口测试

时间:2022-09-19 22:35:49
Action1()
{
int i; lr_rendezvous("rend"); lr_start_transaction("get"); for(i=;i<;i++)
{
web_url("get",
"URL=http://{urlparam}",
"Resource=1",
"RecContentType=application/json",
"Referer=",
"Snapshot=t1.inf",
LAST);
}
lr_end_transaction("get", LR_AUTO); lr_start_transaction("post"); web_submit_data("post",
"Action=http://api.zjol.com.cn/api/user_feedback",
"Method=POST",
"RecContentType=text/html",
"Mode=HTML",
ITEMDATA,
"Name=session_id", "Value=4f59d9d14d405ae7367544af", ENDITEM,
"Name=title", "Value=test_title", ENDITEM,
"Name=content", "Value=test data", ENDITEM,
LAST); web_submit_data("jpost",
"Action=http://api.zjol.com.cn/api/client_log/batch",
"Method=POST",
"RecContentType=application/json",
"Mode=HTML",
ITEMDATA,
"Name=session_id", "Value=4f59d9d14d405ae7367544af", ENDITEM,
"Name=is_test", "Value=false", ENDITEM,
"Name=logs", "Value=[{\"local_time\":1395051006337,\"log_level\":1,\"op_place\":0,\"op_type\":4001},{\"local_time\":1395051094555,\"log_level\":1,\"op_place\":0,\"op_type\":4002},{\"local_time\":1395051115432,\"log_level\":1,\"op_place\":0,\"op_type\":4001},{\"local_time\":1395051132291,\"log_level\":1,\"op_place\":0,\"op_target\":\"52e5f902cf81d754a434fb52\",\"op_type\":2004},{\"local_time\":1395051147817,\"log_level\":1,\"op_place\":0,\"op_type\":5000}]", ENDITEM,
LAST); lr_end_transaction("post", LR_AUTO); return ;
}

都用了web_submit_data函数,包括存在JSON数据,都能实现。  用web_custom_request函数就没成功过。

参考文章:http://blog.****.net/on_my_way20xx/article/details/8486839