51Testing软件测试论坛
标题:
关于Loadrunner8.1对服务器接口测试的问题,包是JSON的.
[打印本页]
作者:
银色獠牙
时间:
2010-11-17 10:15
标题:
关于Loadrunner8.1对服务器接口测试的问题,包是JSON的.
我想对一个服务器的接口进行测试.用的是http协议.数据包是JSON,麻烦各位帮我看一下,我这里写发送的包是一个上传账单信息的包,但是在数据库中根本就没有新提交的数据.
下面是Run的结果:
Virtual User Script started
Starting action vuser_init.
Web Turbo Replay of LoadRunner 8.1.0 for WINXP; WebReplay81 build 5495 [MsgId: MMSG-27143]
Run-Time Settings file: "D:\Program Files\Mercury\LoadRunner\scripts\Test1\\default.cfg" [MsgId: MMSG-27141]
Ending action vuser_init.
Running Vuser...
Starting iteration 1.
Starting action Action.
Action.c(3): web_custom_request("BILL_UPLOAD") was successful, 126 body bytes, 168 header bytes, 11 chunking overhead bytes [MsgId: MMSG-26385]
Ending action Action.
Ending iteration 1.
Ending Vuser...
Starting action vuser_end.
Ending action vuser_end.
Vuser Terminated.
代码:
Action()
{
web_custom_request("BILL_UPLOAD",
"Method=POST",
"URL=http://125.69.69.135:8089/CtiServer/command!onRequest.do",
"RecContentType=application/json",
"EncType=application/json",
"Mode=HTML",
RAW_BODY_START,
"{\"ACTION_NAME\":\"BILL_UPLOAD\",\"DEVICE_SN\":\"B568808A1F9175D00100\",\"ACTION_INFO\":{\"BILL\":{\"BILL_ID\":\"4102\",\"TRANS_NAME\":\"银行卡转帐\",\"TERMINAL_NAME\":\"testname\",\"AMOUNT\":\"888880063\",\"CREATE_DATE\":\"20100505124913\",\"BOLISH_DATE\":\"20100628134913\",\"PAY_DATE\":\"20100505124913\",\"ADDITION_1\":\"ADDITION_1\",\"ADDITION_2\":\"ADDITION_2\",\"ADDITION_3\":\"ADDITION_3\",\"ADDITION_4\":\"ADDITION_4\"}}}",
363,
RAW_BODY_END,
LAST);
return 0;
}
作者:
skyzhu
时间:
2010-11-17 10:33
web_custom_request("BILL_UPLOAD",
"Method=POST",
"URL=http://125.69.69.135:8089/CtiServer/command!onRequest.do",
"RecContentType=application/json",
"EncType=application/json",
"Body={\"ACTION_NAME\":\"BILL_UPLOAD\",\"DEVICE_SN\":\"B568808A1F9175D00100\", \"ACTION_INFO\":{\"BILL\":{\"BILL_ID\":\"4102\",\"TRANS_NAME\":\"银行卡转帐 \",\"TERMINAL_NAME\":\"testname\",\"AMOUNT\":\"888880063\",\"CREATE_DATE\":\"20100505124913\",\"BOLISH_DATE\":\"20100628134913\",\"PAY_DATE\":\"20100505124913\",\"ADDITION_1\":\"ADDITION_1\",\"ADDITION_2\":\"ADDITION_2\",\"ADDITION_3\":\"ADDITION_3\",\"ADDITION_4\":\"ADDITION_4\"}}}",
LAST);
这里的代码试出来结果是:
{"DEVICE_SN":"B568808A1F9175D00100","ACTION_INFO":{"RESPONSE_CODE":-2,"RESPONSE_INFO":"商户不存在!"},"ACTION_NAME":"BILL_UPLOAD"}
作者:
银色獠牙
时间:
2010-11-17 11:12
那请问,如果执行成功的LR上是不会显示返回的值的吗?
欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/)
Powered by Discuz! X3.2