1. Open Loadrunner11, select the webserver protocol, such as:
2. Click Insert-new Step, such as:
3. Select Custom Request, such as:
Note: Web_custom_request: Applies to get and post requests common,
Web_submit_data: can only be used for post requests,
Web_submit_form: can only be used for GET requests
4. Write the interface script as follows:
Action ()
{int httpretcode;
Web_submit_data ("Web_submit_data",
"Action=http://192.168.1.111:8081/api/getroominfo?",//interface address
"Method=post",
"Targetframe=",
"Reccontenttype=application/x-www-form-urlencoded",
"Referer=http://{url}/login_wj;jsessionid={jsessionid}",
ItemData,
"Name=shopinfo", "Value= College Road _3", Enditem,
"Name=requesttime", "value=2015-07-13", Enditem,//Insert parameter value
"Name=roomid", "value=4", Enditem,
last);
Httpretcode=web_get_int_property (Http_info_return_code);
if (httpretcode==200)
{lr_output_message ("Success! ");
}
Else
{Lr_output_message ("Failed! ");
}
return 0;
}
5. Select Vuser-run time Settings, such as:
6. Select log, such as:
7. Execute the script to view the log results:
8. If the "_1" value does not exist in the database, click Execute to view the results, such as:
LoadRunner interface Test Basic Operation method