Soapui接口測試是一個開源測試工具,旨在幫助高級計算機用戶針對他們的WebService項目執行各種大規模的數據密集型服務測試。用戶可通過Soapui來檢查、調用和實現Web Service的功能/負載/符合性測試。在測試同一webservice接口時,SoaqUI表現出更好的性能。它可作為一個單獨的測試軟件使用,也可利用插件集成到Eclipse、maven2.X、Netbeans和intellij中使用。有用到這款接口測試工具的朋友快通過下面地址來獲取吧!
Soapui破解教程
1、安裝的方法很簡單,雙擊“SoapUI-x64-5.1.3.exe”開始正式的安裝(不過注意該程序僅支持64位操作),之后的安裝方法很簡單直接默認點擊下一步即可
1、解壓后復制Protection-4.6.jar到soapui安裝的lib目錄下面,替換原來的文件
2、直接打開bin\soapui-pro.bat批處理文件,然后再導入scz.key文件
Soapui命令行
直接執行testrunner.sh將給出幫助手冊:
soapUI Pro 4.5.2 TestCase Runner
usage: testrunner [options]
-F Report format. Used with -R. Valid options PDF, XLS, HTML, RTF,
CSV, TXT, and XML (comma-separated)
-v Sets password for soapui-settings.xml file
-t Sets the soapui-settings.xml file to use
-A Turns on exporting of all results using folders instead of long
filenames
-D Sets system property with name=value
-E Sets the environment
-G Sets global property with name=value
-I Do not stop if error occurs, ignore them
-M Creates a Test Run Log Report in XML format
-P Sets or overrides project property with name=value
-R Report to Generate
-S Saves the project after running the tests
-a Turns on exporting of all results
-c Sets the testcase
-d Sets the domain
-e Sets the endpoint
-f Sets the output folder to export results to
-g Sets the output to include Coverage HTML reports
-h Sets the host
-i Enables Swing UI for scripts
-j Sets the output to include JUnit XML reports
-m Sets the maximum number of TestStep errors to save for each
testcase
-o Opens generated report(s) in a browser
-p Sets the password
-r Prints a small summary report
-s Sets the testsuite
-u Sets the username
-w Sets the WSS password type, either "Text" or "Digest"
-x Sets project password for decryption if project is encrypted
命令行格式:testrunner [選項] soapui工程的xml文件
主要命令選項說明:
-D 設置system property,即可以設置SoapUI——Help——System properties菜單下的屬性值
例如命令行指定-Dfile.encoding=UTF-8
-I 設置為用例執行中出現錯誤時不停止,繼續執行
-a 默認SoapUI只會在用例執行時有錯時(如斷言有錯),才會生成.txt的包含請求、響應的詳細日志信息,便于查看當時請求出 錯的詳細情況,若加上-a選項,則不論出錯與否都將生成該報告文件。
-f 設置報告輸出的路徑,不指定則默認為輸出到當前目錄下
-j 生成JUnit格式的XML報告文件
-r 打印簡略的總結報告
-s 指定要執行的用例集名稱
輸入參數為字符串如何輸入?
參考以下:
354561031959904
]]>
Soapui發送json
左邊選json
Soapui填充數據?
例如如下數據,calendar_id是需要根據返回值動態獲取的,此時需要通過獲得數組中的calendar_id
{"calendar":
[
{"calendar_id":"1705","showtime":"1288927800","endshowtime":"1288931400","allDay":false},
{"calendar_id":"1706","showtime":"1288933200","endshowtime":"1288936800","allDay":false},
{"calendar_id":"1709","showtime":"1288935600","endshowtime":"1288938900","allDay":false}
]
}
在SoapUI中可以通過groovy腳本實現提取json數組數據,提取到數據后就可以遍歷訪問列表中的每條新聞正文了
1.新建一個REST請求步驟,獲取接口返回的數據
2.新建一個DataSource步驟,選擇Groovy方式
3.添加一個名為cal_id的Properties
4.groovy編輯框中輸入實現代碼
[java] view plain copy
import groovy.json.JsonSlurper
def xresponse = testRunner.testCase.testSteps["getCalendarListByCoid"].testRequest.response.contentAsString
def slurper = new JsonSlurper()
def re = slurper.parseText(xresponse)
def num=re.calendar.size()
def i = testRunner.testCase.testSteps["DataSource"].currentRow
if(i{
result["cal_id"]=String.valueOf(re.calendar_id.id[i])
}
5.新建一個Property Transfer步驟,將DataSource的cal_id傳遞給當前testCase的變量
6.新建 一個REST請求步驟,將得到的cal_id去請求另一個接口
7.新建一個DataSource Loop步驟,使DataSource與Property Transfer步驟循環,這樣就可以遍歷數組中的每個數據了
[reply]tz0705010216[/reply]
你好
以博文中的json為例,新增的groovy步驟則如下:
def xresponse = testRunner.testCase.testSteps["getCalendarListByCoid"].testRequest.response.contentAsString
def slurper = new JsonSlurper()
def re = slurper.parseText(xresponse)
def id = re.calendar.calendar_id[i] //i為json數組中的第i個子json對象
若為在腳本斷言處添加groovy斷言,則如下:
def xresponse = messageExchange.modelItem.testCase.testSteps["getCalendarListByCoid"].testRequest.response.contentAsString
def slurper = new JsonSlurper()
def result = slurper.parseText(xresponse)
def id = re.calendar.calendar_id[i] //i為json數組中的第i個子json對象
Soapui功能
1、MockServices通過SoapUI提供獨特的能力,能夠模仿Web Services,并創建/運行對他們的功能和負載測試,即使在系統部署前,這些也能夠開展
2、可以減少構建完整產品環境的副本所需的花費,以及提供您的客戶訪問能力,而不必為他們等待被完成
3、在SoapUI,用戶不用花費很多努力就可以創建符合標準Mocks - 只需選擇一個想要的WSDL,SoapUI能夠自動生成MockService和它的方法
4、可自定義任何用戶喜歡的響應方式
5、高級腳本功能來模擬任何想要的行為 - 固定響應,隨機錯誤,動態結果等
6、SoapUI提供了所有所需的工具來測試和完善的測試
7、總覽標簽給你一個項目的所有內容和全面的看法,只需一次點擊,您可以添加任何數量的斷言為驗證傳入的消息TestStep
8、可使用功能強大的HTTP監視器記錄,分析甚至修改客戶機-服務器通信
9、可輕松創建和運行數據驅動測試
Soapui優勢
1、SoapUI設計為技術以及非技術性客戶增添了簡化和完備的測試感受
2、這類便于所使用的用戶界面簡化對根據SOAP和REST的WebService的測試
3、創建一個負載測試,您僅需鼠標右鍵點一下一個作用測試,并且以負載測試運作
4、或使用拖拽創建一切簡易或繁雜測試情景
5、針對經驗豐富的客戶,SoapUIPro提供屬性傳送指導,會自動傳送選中視頻的屬性,促使繁雜的測試測試用例或信息流廣告的創建更加輕松
6、針對最大的一個控制與協調能力,SoapUIPro還提供了既用的現成高端腳本制作,能夠適用基本上一丁點的測試
7、不論你是一個測試工作人員,開發者,業務分析師或主管,SoapUI為每一個角色提供了不一樣的功效
以上便是KKX小編給大家分享介紹的Soapui接口測試工具。