Jmeter接口測試webservice
阿新 • • 發佈:2017-07-13
技術分享 cnblogs apu body 行數據 png sdl ron ini
可以用jmeter兩種sampler進行webservice的測試
webservice公共接口的發送報文格式的獲取:(以SoapUI為例)
1、新建一個SOAP Project,在initial WSDL輸入原始的WSDL地址:http://ws.webxml.com.cn/webservices/ChinaTVprogramWebService.asmx?wsdl
2、選擇需要測試的接口
3、找到測試的地址和發送的報文的格式
一、SOAP/XML-RPC Request(在jmeter3.2以後版本中已經取消了這個取樣器)
1、新建線程組、SOAP/XML-PRC Request sampler 、響應斷言、察看結果樹
1 <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://WebXml.com.cn/"> 2 <soapenv:Header/> 3 <soapenv:Body> 4 <web:getTVstationString> 5 <web:theAreaID>12</web:theAreaID> 6 </web:getTVstationString>7 </soapenv:Body> 8 </soapenv:Envelope>
soapaction的地址:為第1行數據和第4行接口的相疊加的內容
1 web="http://WebXml.com.cn/"
4 <web:getTVstationString>
形成地址:http://WebXml.com.cn/getTVstationString
對於公共的webservice接口,可以使用soapUI進行抓取,或者是其他工具去抓取發送報文的格式
2、在響應斷言中進行斷言,是否響應內容是需要的內容,如下
3、察看結果樹
二、SOAP/XML-RPC Request(在jmeter3.2以後版本中已經取消了這個取樣器)
Jmeter接口測試webservice