关于loadrunner录制发送http请求的几种脚本格式
web_submit_data("queryForeign.do",
"Action=http://10.3.1.91:9001/cms/queryForeign.do",
"Method=POST",
"RecContentType=text/plain",
"Referer=http://10.3.1.21:9001/pweb/welcome.do",
"Mode=HTML",
ITEMDATA,
"Name=FromUserName", "Value=234", ENDITEM,
"Name=ToUserName", "Value=sssss", ENDITEM,
LAST);
注意:RecContentType一定要是“text/plain”;
2. 基于json格式,可参照下列格式:
web_custom_request("eweb-common.Prepose.do",
"URL=http://10.0.161.156:8080/prepose/eweb-common.Prepose.do",
"Method=POST",
"Resource=0",
"RecContentType=application/json",
"Referer=http://10.0.161.9:8088/#/userLogin/login",
"Snapshot=t6.inf",
"Mode=HTML",
"EncType=application/json",
"Body={\"Head\":{\"_MChannelId\":\"PFRT\",\"_TransactionId\":\"eweb-common.EppRegistRsf\",\"_locale\":\"zh_CN\"},\"Body\":{\"platFormCd\":\"YFB_PC\",\"idType\":\"01\",\"idNum\":\"320921199008134633\",\"phone\":\"15852915190\",\"mediAcctLevel\":\"2\",\"authState\":\"1\",\"sourceUserId\":\"123\",\"verifyMtd\":\"OTHER\",\"userName\":\"chen\",\"activeState\":\"ACT\",\"cardType\":\"VCAD\",\"drainChnTpCd\":\"JINFU\"}}",
LAST);
注意:body里面的json,在loadrunner中需要加转意字符。
注意:RecContentType, 一定要是“application/json”。