银色獠牙 发表于 2010-11-17 10:15:46

关于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       
Run-Time Settings file: "D:\Program Files\Mercury\LoadRunner\scripts\Test1\\default.cfg"       
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       
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:31

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:34

那请问,如果执行成功的LR上是不会显示返回的值的吗?
页: [1]
查看完整版本: 关于Loadrunner8.1对服务器接口测试的问题,包是JSON的.