欢迎来到天天文库
浏览记录
ID:13000018
大小:302.50 KB
页数:8页
时间:2018-07-20
《如何用loadrunner 测试 webservice》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、现在基于WebService的应用开始越来越多,因此使用LoadRunner测试WebService的可能性越来越大。WebService可以在很多协议上跑,但是使用最多的还是使用SOAP协议,SOAP协议在LoadRunner中是支持的,而SOAP是建立在HTTP协议之上的,所以也可以使用HTTP协议测试WebService应用。由于坊间广为流行的,深受人民群众喜爱的LoadRunner破解License是两个类型的,一个是100Vu的全协议的,一个是10000Vu的HTTP协议的,所以如果测试非HTTP协议的应用,就会受到100Vu的限制。如果把非HTTP协议的测试
2、转化成HTTP协议的测试,从而可以使用10000个并发,这是具有重要现实意义的一个事情。在测试SOAP协议应用的时候,如果并发Vu超过100,就应该用10000个Vu的License。下面两个脚本是分别用SOAP协议和HTTP协议。两者的区别就是两个函数:soap_request和web_custom_request的区别。需要注意的是:这两个脚本由于比较简单,都不是录制下来的,而是直接编写的。函数中的xml文件的内容是通过应用服务器(我们使用的是WebLogic)后台查询得到的。即先从浏览器执行一个SOAP调用,然后在后台找到该调用发出的xml文件的内容,然后再拷贝到
3、LoadRunner的脚本中得到的。==============================SOAP协议====================================Action(){ web_add_header("SOAPAction", """"); web_add_header("User-Agent", "XMLSpy"); web_add_header("Content-Type","text/xml"); lr_start_transaction("同步调用同步"); soap_r
4、equest("StepName=ServiceRequest", "URL=http://172.16.1.222:7001/servicebusWeb/cn/com/jsepc/soa/platform/bus/gateway/" "GatewayWebServiceV10.jws", "SOAPEnvelope=5、//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">rtr" "6、w.jsepc.com.cn/soa/service/v1_0"" "xmlns:v1="http://www.jsepc.com.cn/soa/webservice/interface/v1_0">" "tt" "" "SOA_ServiceCodeTest.TimeService.Bus1" "7、1:Head>SOA_Operationservice" "" "" "" "EPC1234567890123456789012345678901234567890123456789012345678901234567890123456789
5、//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">rtr" "6、w.jsepc.com.cn/soa/service/v1_0"" "xmlns:v1="http://www.jsepc.com.cn/soa/webservice/interface/v1_0">" "tt" "" "SOA_ServiceCodeTest.TimeService.Bus1" "7、1:Head>SOA_Operationservice" "" "" "" "EPC1234567890123456789012345678901234567890123456789012345678901234567890123456789
6、w.jsepc.com.cn/soa/service/v1_0"" "xmlns:v1="http://www.jsepc.com.cn/soa/webservice/interface/v1_0">" "tt" "" "SOA_ServiceCodeTest.TimeService.Bus1" "7、1:Head>SOA_Operationservice" "" "" "" "EPC1234567890123456789012345678901234567890123456789012345678901234567890123456789
7、1:Head>SOA_Operationservice" "
此文档下载收益归作者所有