|
本帖最后由 yuejing127 于 2012-5-18 11:10 编辑
想用loadrunner进行接口测试,提交数据后想得到服务器的返回信息并且输出。我录制的脚步如下(自己手动添加的web_reg_save_param函数来获取服务器返回的页面信息):
Action()
{
web_url("vehicleInsurance",
"URL=http://ydkh.ab95569.com/test/vehicleInsurance/",
"TargetFrame=",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t1.inf",
"Mode=HTML",
EXTRARES,
"URL=/favicon.ico", ENDITEM,
LAST);
web_url("favicon.ico",
"URL=http://www.live.com/favicon.ico",
"TargetFrame=",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t2.inf",
"Mode=HTML",
LAST);
lr_rendezvous("jingsuan");
lr_start_transaction("Calculate_Time");
lr_think_time(60);
web_reg_save_param("response",
"LB/IC=",
"RB/IC=",
"Search=Body",
LAST);
lr_output_message(lr_eval_string("{response}"));
web_reg_find("Text=\"errorCode\":\"200\",\"errorMessage\":\"",
"Search=Body",
LAST);
web_submit_data("requestController.do",
"Action=http://ydkh.ab95569.com/test/vehicleInsurance/requestController.do?method=calculatev6",
"Method=POST",
"TargetFrame=",
"RecContentType=text/plain",
"Referer=http://ydkh.ab95569.com/test/vehicleInsurance/",
"Snapshot=t3.inf",
"Mode=HTML",
ITEMDATA,
"Name=token", "Value={token}", ENDITEM,
"Name=tempAppId", "Value=", ENDITEM,
"Name=appObj", "Value={\r\n"
"\t\"packageType\":\"A\",\r\n"
"\t\"inspection\":\"1\",\r\n"
"\t\"beginTime\":\"2012-05-30\",\r\n"
"\t\"depCode\":\"02000104\",\r\n"
"\t\"depAttr\":\"014015\",\r\n"
"\t\"grantDepCode\":\"ZQ02000100\",\r\n"
"\t\"userInfo\":{\r\n"
"\t\t\"101\":[\r\n"
"\t\t\t{\r\n"
"\t\t\t\t\"name\":\"鍗僵鐞\xB3\",\r\n"
"\t\t\t\t\"licenseType\":\"01\",\r\n"
"\t\t\t\t\"license\":\"420602198308201019\",\r\n"
"\t\t\t\t\"mobile\":\"13910657412\",\r\n"
"\t\t\t\t\"address\":\"娴欐睙鐪佹澀宸炲競鎷卞鍖\xBA\",\r\n"
"\t\t\t\t\"zipcode\":\"111111\",\r\n"
"\t\t\t\t\"refId\":0\r\n"
"\t\t\t}\r\n"
"\t\t],\r\n"
"\t\t\"102\":[\r\n"
"\t\t\t{\r\n"
"\t\t\t\t\"relationship\":\"601005\",\r\n"
"\t\t\t\t\"name\":\"娉㈡稕\",\r\n"
"\t\t\t\t\"licenseType\":\"01\",\r\n"
"\t\t\t\t\"license\":\"111111111111111\",\r\n"
"\t\t\t\t\"mobile\":\"13910657412\",\r\n"
"\t\t\t\t\"address\":\"娴欐睙鐪佹澀宸炲競鎷卞鍖\xBA\",\r\n"
"\t\t\t\t\"zipcode\":\"111111\"\r\n"
"\t\t\t}\r\n"
"\t\t],\r\n"
"\t\t\"201\":[\r\n"
"\t\t\t{\r\n"
"\t\t\t\t\"name\":\"瑕冨獩濯\x9B\",\r\n"
"\t\t\t\t\"licenseType\":\"01\",\r\n"
"\t\t\t\t\"license\":\"111111111111111\",\r\n"
"\t\t\t\t\"address\":\"鍖椾含甯傛湞闃冲尯鍥借锤鍙屽瓙搴\xA7\",\r\n"
"\t\t\t\t\"zipcode\":\"100052\"\r\n"
"\t\t\t}\r\n"
"\t\t]\r\n"
"\t},\r\n"
"\t\"vehicleInfo\":{\r\n"
"\t\t\"lcnNo\":\"\",\r\n"
"\t\t\"engNo\":\"{engNo}\",\r\n"
"\t\t\"regTime\":\"2011-10\",\r\n"
"\t\t\"carFrameNo\":\"{CarFrameNo}\",\r\n"
"\t\t\"useYearCode\":\"373001\",\r\n"
"\t\t\"usageCode\":\"374001\",\r\n"
"\t\t\"seatNum\":5,\r\n"
"\t\t\"exhaust\":2.4,\r\n"
"\t\t\"price\":249500,\r\n"
"\t\t\"productPlace\":\"2\",\r\n"
"\t\t\"vehicleType\":\"365001\",\r\n"
"\t\t\"isNew\":\"1\",\r\n"
"\t\t\"vehicleId\":\"JYD1040SHT\",\r\n"
"\t\t\"vehicleName\":\"鍒厠SGM7242ATA杞胯溅\",\r\n"
"\t\t\"brandId\":\"BKA\",\r\n"
"\t\t\"brandName\":\"鍒厠\",\r\n"
"\t\t\"familyId\":\"MK0677\",\r\n"
"\t\t\"familyName\":\"鍚涜秺\",\r\n"
"\t\t\"color\":\"鐧\xBD\",\r\n"
"\t\t\"claimTimes\":\"01\",\r\n"
"\t\t\"travelProvinceCode\":\"110000\",\r\n"
"\t\t\"travelProvince\":\"鍖椾含甯\x82\",\r\n"
"\t\t\"travelCityCode\":\"110100\",\r\n"
"\t\t\"travelCity\":\"鍖椾含甯\x82\",\r\n"
"\t\t\"fuelType\":\"A\",\r\n"
"\t\t\"glassType\":\"303011001\",\r\n"
"\t\t\"derivationPaperType\":\"01\",\r\n"
"\t\t\"derivationPaperCode\":\"135\",\r\n"
"\t\t\"derivationPaperTime\":\"2011-05-01\"\r\n"
"\t},\r\n"
"\t\"insuranceList\":[\r\n"
"\t\t{\r\n"
"\t\t\t\"insuranceType\":\"0326\",\r\n"
"\t\t\t\"items\":[\r\n"
"\t\t\t\t{\r\n"
"\t\t\t\t\t\"policyCode\":\"030001\",\r\n"
"\t\t\t\t\t\"premium\":10000.00,\r\n"
"\t\t\t\t\t\"iop\":\"1\",\r\n"
"\t\t\t\t\t\"flag\":\"1\"\r\n"
"\t\t\t\t},\r\n"
"\t\t\t\t{\r\n"
"\t\t\t\t\t\"policyCode\":\"030004\",\r\n"
"\t\t\t\t\t\"premium\":0,\r\n"
"\t\t\t\t\t\"iop\":\"0\",\r\n"
"\t\t\t\t\t\"flag\":\"1\"\r\n"
"\t\t\t\t},\r\n"
"\t\t\t\t{\r\n"
"\t\t\t\t\t\"policyCode\":\"030006\",\r\n"
"\t\t\t\t\t\"premium\":249500,\r\n"
"\t\t\t\t\t\"iop\":\"1\",\r\n"
"\t\t\t\t\t\"flag\":\"1\"\r\n"
"\t\t\t\t},\r\n"
"\t\t\t\t{\r\n"
"\t\t\t\t\t\"policyCode\":\"030009\",\r\n"
"\t\t\t\t\t\"premium\":10000.00,\r\n"
"\t\t\t\t\t\"iop\":\"1\",\r\n"
"\t\t\t\t\t\"flag\":\"1\"\r\n"
"\t\t\t\t},\r\n"
"\t\t\t\t{\r\n"
"\t\t\t\t\t\"policyCode\":\"030018\",\r\n"
"\t\t\t\t\t\"premium\":50000,\r\n"
"\t\t\t\t\t\"iop\":\"1\",\r\n"
"\t\t\t\t\t\"premiumLevel\":\"306006004\",\r\n"
"\t\t\t\t\t\"flag\":\"1\"\r\n"
"\t\t\t\t},\r\n"
"\t\t\t\t{\r\n"
"\t\t\t\t\t\"policyCode\":\"030061\",\r\n"
"\t\t\t\t\t\"premium\":249500.00,\r\n"
"\t\t\t\t\t\"iop\":\"1\",\r\n"
"\t\t\t\t\t\"flag\":\"1\"\r\n"
"\t\t\t\t}\r\n"
"\t\t\t]\r\n"
"\t\t}\r\n"
"\t]\r\n"
"}\r\n"
"\t\t", ENDITEM,
LAST);
lr_end_transaction("Calculate_Time", LR_AUTO);
return 0;
} |
|