2021-05-12 14:32:11
SoapUI命令列方式執行
SoapUI支援用命令列方式執行測試用例並生成測試報告,因此使用SoapUI可以很好地進行介面測試自動化測試以及持續整合。
首先檢視testrunner.sh指令碼支援哪些選項
直接執行testrunner.sh將給出幫助手冊:
soapUI Pro 4.5.2 TestCase Runner
usage: testrunner [options] <soapui-project-file>
-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 指定要執行的用例集名稱
因此命令列執行SoapUI用例可以如下:
sh testrunner.sh -Dfile.encoding=UTF-8 -I -s $testsuit -r -j -f $REPORTS_PATH $TESTSUIT_PATH/soapui_example.xml
執行完成後將生成JUnit格式的xml報告檔案,可在Jenkins中生成測試報告及介面響應效能趨勢圖等
出錯時生成的.txt格式的包含詳細請求引數及響應資料的紀錄檔報告檔案可以郵件附件形式傳送,進行及時反饋及出錯時問題定位
在Linux/Unix上安裝開源測試工具SoapUI http://www.linuxidc.com/Linux/2016-03/128857.htm
相關文章