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
SoapUI 的詳細介紹:請點這裡
SoapUI 的下載地址:請點這裡
本文永久更新鏈接地址:
http://xxxxxx/Linuxjc/1148633.html TechArticle