51Testing软件测试论坛

标题: 系统间接口的性能测试 [打印本页]

作者: knighter    时间: 2012-1-6 16:15
标题: 系统间接口的性能测试
请教各位高人,两个系统之间数据传输,通过Http请求的方式发送xml文件。

请问用什么方式模拟实现,进行性能测试呢?

以前做的大多数是系统内的性能,或者是都是通过录制方式进行吧。现在遇到这样系统间的接口性能测试,有点摸不着路,请求指点,谢谢。

已经尝试过使用LR以及Jmeter,但应该是方法不当,都没实现……
作者: salent    时间: 2012-1-7 16:15
手写HTTP协议就搞定了,把XML文件内容带到web_custom_request函数
作者: msnshow    时间: 2012-1-7 23:10
其实你通过录制也是OK的
作者: zhanglei    时间: 2012-1-9 02:29
webservice的吧。
Action()
{
        //<!-- 记录用户接受程度:WsRecordResponse -->
                  web_add_header("SOAPAction","\"\"");
                  web_add_header("Content-Type", "text/xml");
          web_set_max_html_param_len("1024");
                  web_reg_save_param("result_code",
                                                   "LB=RETURN_CODE&gt;",
                                                   "RB=&lt;/RETURN_CODE",
                                                        //"ORD=ALL",
                                                   "Notfound=error", LAST);
                  //RETURN_CODE&gt;0&lt;/RETURN_CODE
                  lr_start_transaction("WsRecordResponse");
                  web_custom_request("WsRecordResponse", "Method=POST",
                                                         "URL=http://X.X.X.X:51000/esbWS/services/WsRecordResponse",
                                                         "Body=<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:SOAP-ENC=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">"
                                                         "<SOAP-ENV:Body>"
                                                         "<m:callService xmlns:m=\"http://ws.sitech.com\">"
                                                         "<m:pin><![CDATA[<?xml version=\"1.0\" encoding=\"GBK\" standalone=\"no\" ?>"
                                                         "<ROOT>"
                                                         "<COMMON_INFO>"
                                                         "<PROVINCE_GROUP type=\"string\">10011</PROVINCE_GROUP>"
                                                         "</COMMON_INFO>"
                                                         "<REQUEST_INFO>"
                                                         "<PHONE_NO type=\"string\">13934950093</PHONE_NO>"
                                                         "<LOGIN_NO type=\"string\">feea0I</LOGIN_NO>"
                                                         "<LOGIN_NAME type=\"string\">123</LOGIN_NAME>"
                                                         "<CHANNEL_TYPE type=\"string\">0</CHANNEL_TYPE>"
                                                         "<REGION_CODE type=\"string\">16</REGION_CODE>"
                                                         "<GROUP_ID type=\"string\">14051</GROUP_ID>"
                                                         "<ACT_ID type=\"string\">201112011000002454</ACT_ID>"
                                                         "<ID_NO type=\"string\">62211157770</ID_NO>"
                                                         "<CUST_GROUP_ID type=\"string\">201112011000002458</CUST_GROUP_ID>"
                                                         "<ACCEPT_FLAG type=\"string\">0</ACCEPT_FLAG>"
                                                         "</REQUEST_INFO>"
                                                         "</ROOT>]]></m:pin>"
                                                         "</m:callService>"
                                                         "</SOAP-ENV:Body>"
                                                         "</SOAP-ENV:Envelope>"
                                                         LAST);
    if(strcmp(lr_eval_string("{result_code}"), "0") == 0)
        {
                lr_end_transaction("WsRecordResponse", LR_PASS);
        }else{
                lr_end_transaction("WsRecordResponse", LR_FAIL);
                lr_error_message("WsRecordResponse失败,result_code: %s", lr_eval_string("{result_code}"));
        }
        return 0;
}
作者: ziheng198688    时间: 2012-1-9 10:00
楼上正解啊,实在不行可以试用LR的webservice录制方法,只要拿到webservice的URL或者WSDL文件导入,然后import所提交请求的SOAP XML文件就可以了,webservice需要额外的license,所以楼主可以拿到对应的脚本之后根据楼上的方法改写成一般的HTTP请求就可以了。
作者: oceanwell    时间: 2012-1-9 16:33
webservice录制,录制时引用个spy.xml工具,把xml内容一贴上去,摸拟请求即可,全自动,基本不用改什么。。




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2