1.打开Loadrunner11,选择WebServer协议,如下图:

  2.点击Insert-New Step,如下图:

  3.选择Custom Request,如下图:

  注:web_custom_request:适用于Get和POST请求通用,
  web_submit_data:只能用于POST请求,
  web_submit_form:只能用于Get请求
  4.写接口脚本,如下:
Action()
{  int HttpRetCode;
web_submit_data("web_submit_data",
"Action=http://192.168.1.111:8081/api/GetRoomInfo?",   //接口地址
"Method=POST",
"TargetFrame=",
"RecContentType=application/x-www-form-urlencoded",
"Referer=http://{url}/login_wj;jsessionid={jsessionid}",
ITEMDATA,
"Name=ShopInfo",   "Value=学院路_3",ENDITEM,
"Name=RequestTime","Value=2015-07-13",ENDITEM,         //插入参数值
"Name=RoomID",     "Value=4",ENDITEM,
LAST);
HttpRetCode=web_get_int_property(HTTP_INFO_RETURN_CODE);
if(HttpRetCode==200)
{     lr_output_message("成功!");
}
else
{     lr_output_message("失败!");
}
return 0;
}
  5.选择Vuser-Run Time Settings,如下图: