使用LoadRunner测试Webservice服务

发表于:2010-8-10 14:32

字体: | 上一篇 | 下一篇 | 我要投稿

 作者:未知    来源:51Testing软件测试网采编

  用LoadRunner对webServce服务测试。但是LoadRunner网上的license也很变态,测试web的并发用户数是10000个,支持webservice协议的license并发用户数为100个。100个用户并发根本就看不出WebService的性能。

  100和10000是很大的区别的,要是我们使用web协议的license去测试webservice服务不就解决了大问题了吗?

  这个念头在我脑海里一闪。于是我到网上一搜,终于发现一条解决办法,那就使用Loadrunner的web_custom_request函数发请求就可以了。这样就把我的问题从使用LoadRunner的webservice协议转换为了http协议的方式。下面就将我使用的方法记录如下,希望能对有我同样需求的朋友能从中受益:

  使用样例:

web_remove_auto_header("Accept-Encoding", LAST);
//web_add_header("User-Agent", "NuSOAP/0.6.7 (1.75)");
web_add_header("Content-Type", "text/xml; charset=utf-8");
web_add_header("SOAPAction", "\"http://ispp.com.cn/ispp_spi/ASYSPIAPI\"" );
web_add_header("Host", "10.17.37.229:8081");
web_custom_request("ASYSPIAPI",
"URL=http://10.17.37.229:8081/ispp/services/SPIServicesPort",
"Method=POST", "TargetFrame=", "Resource=0", "Referer=",
"Body=<?xml version='1.0' encoding='UTF-8'?>"
                "<soapenv:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">"
            "<soapenv:Header>"
            "<MessageID soapenv:actor=\"http://schemas.xmlsoap.org/soap/actor/next\" xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" soapenv:mustUnderstand=\"0\">c6fe475b-c834-41eb-b8ad-34508f901503</MessageID>"
                "<Address soapenv:actor=\"http://schemas.xmlsoap.org/soap/actor/next\" xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" soapenv:mustUnderstand=\"0\">http://10.17.37.229:8081/ispp/services/SPIServicesPort</Address>"
                "<Username soapenv:actor=\"http://schemas.xmlsoap.org/soap/actor/next\" xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" soapenv:mustUnderstand=\"0\">SimulatorTest</Username>"
                "<Password soapenv:actor=\"http://schemas.xmlsoap.org/soap/actor/next\" xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" soapenv:mustUnderstand=\"0\">81DC9BDB52D04DC20036DBD8313ED055</Password>"
            "<RelateTo soapenv:actor=\"http://schemas.xmlsoap.org/soap/actor/next\" xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" soapenv:mustUnderstand=\"0\">233433f6-306f-478e-8b71-e70ae7dc701b</RelateTo>"
            "</soapenv:Header>"
                "<soapenv:Body>"
                "<WorkOrderMsgASY xmlns=\"http://ispp.com.cn/ispp_spi/\">"
                "<root><msg_head><time>2007-4-26 2:35:46</time><from>CRM</from><to>iSPP</to><msg_type>message_request</msg_type><serial>bca8755c-2554-40ac-89eb-e52e37ece811</serial></msg_head>"
                "<interface_msg><public><work_order_id>0803311023</work_order_id><work_type>0</work_type><rela_info_collection/><area_code>020</area_code></public>"
                "<prod_info>"
                "<prod_code>product_3GPhone</prod_code>"
                "<prod_name>3G</prod_name>"
                "<so_type_code>operation_delete</so_type_code>"
                "<so_type_name/><old_prod_code/><old_prod_name/><prod_characters/><sub_products/><sub_attr_relates/><prod_attr_relates/></prod_info><res_infos><imsi>460115100000040</imsi>"
        "<old_imsi/><msisdn>8615805100040</msisdn><old_msisdn/><res_info/></res_infos><cust_infos><cust_name>hwe</cust_name><cust_type/><cust_grade/><cust_info><code/><value/><old_value/></cust_info></cust_infos><sla_info>"
                "<time_value/><time_unit/><excute_time/><sla_grade>1</sla_grade></sla_info></interface_msg></root></WorkOrderMsgASY></soapenv:Body></soapenv:Envelope>",      
LAST);

  使用方法:创建一个web协议的新脚本,将上面的函数copy到action中,设置好相关的参数,就可以用了

《2023软件测试行业现状调查报告》独家发布~

关注51Testing

联系我们

快捷面板 站点地图 联系我们 广告服务 关于我们 站长统计 发展历程

法律顾问:上海兰迪律师事务所 项棋律师
版权所有 上海博为峰软件技术股份有限公司 Copyright©51testing.com 2003-2024
投诉及意见反馈:webmaster@51testing.com; 业务联系:service@51testing.com 021-64471599-8017

沪ICP备05003035号

沪公网安备 31010102002173号