SoapUI命令行执行测试用例

SoapUI支持用命令行方式运行测试用例并生成测试报告,因此使用SoapUI可以很好地进行接口测试自动化测试以及持续集成。

我们在使用jenkins对SoapUI进行自动化执行时就可以用到。

官方说明文档:http://www.soapui.org/Test-Automation/functional-tests.html

首先查看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文件
 
上面的内容看不明白也没关系,我们直接简单明了一点就行:
 
在本地建立bat文件调用soapUI的bin目录下的testrunner.bat工具去执行测试用例。
 
bat文件的内容:
@Echo Off

CD

D:

CD D:sopauiSoapUI-Pro-5.1.2-m-SNAPSHOTin

testrunner.bat -r -j C:Usersyangyang.miaoDocumentsREST-Project-1-soapui-project.xml -f D:sopaui estindex

D:sopauiSoapUI-Pro-5.1.2-m-SNAPSHOTin:SoapUI安装目录。
C:Usersyangyang.miaoDocumentsREST-Project-1-soapui-project.xml:测试用例存放的地址(绝对地址)。
D:sopaui estindex:测试报告输出路径。

【注意】有时候运行并不会成功,这是因为少一个soapui的全局配置文件,默认soapui-settings.xml位置为C:Usersyangyang.miao

一般在安装的时候都会自动生成

那我们就自己试一下吧!!!

原文地址:https://www.cnblogs.com/myydwq/p/12469777.html