我的新浪微博:http://weibo.com/u/1602714773 CSDN博客:http://blog.csdn.net/hunterno4

SoapUI命令行方式运行

上一篇 / 下一篇  2014-08-07 21:32:13 / 个人分类: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格式的包含详细请求参数及响应数据的日志报告文件可以邮件附件形式发送,进行及时反馈及出错时问题定位

TAG: SoapUI testrunner soapui 命令行方式

 

评分:0

我来说两句

Open Toolbar