soapUI系列之—-06 testrunner实现自动化测试

TestRunner为soapUI自带------testrunner.bat/testrunner.sh

实现步骤:

1. 使用soapUI,针对接口文件创建测试用例。

2. 将测试用例保存至本地, 用例将以XML文件格式保存。

3. 运行testrunner工具

3.1 在Windows下运行

在本地建立bat文件调用soapUI的bin目录下的testrunner.bat工具去执行测试用例。


bat文件内容如下:

@Echo Off

cd\

c:

cd C:\ProgramFiles\SmartBear\ReadyAPI-1.2.2\bin

testrunner.bat -r -jC:\Work\InterFaceProjects\ChinaTVprogramWebService-soapui-project.xml -fC:\Work\reports -FPDF

C:\Program Files\SmartBear\ReadyAPI-1.2.2\bin:soapUI安装目录。
C:\Work\InterFaceProjects\ChinaTVprogramWebService-soapui-project.xml:测试用例。
C:\Work\reports:测试报告输出路径。

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

【解决办法】将soapui-settings.xml复制到c盘根目录下;倘若还有错误则使用-t参数指定 -t C:\soapui-settings.xml

 

3.2.在Linux下运行soapui项目

 linux下运行的参数和window下是相同的,在运行的时候带上完整的testrunner.sh所在的目录且需要制定soapui-settings.xml位置,示例:

 /data/applications/soapui/SmartBear/SoapUI-5.1.3/bin/testrunner.sh -s PlanTestSuite -r -j ${WORKSPACE}/REST-AutomationProject2.0.xml -t ${WORKSPACE}/soapui-settings.xml

因此这就要求在从windows向linux服务器上传soapui项目时要把soapui-settings.xml文件带上

 

4. bat文件详解

soapUI提供了一个命令行工具testrunner.bat来运行一个项目中的TestSuit,可以在<soap_ui_home>/bin下找到它
它的使用非常简单,只需要设置下面的几个常用参数即可:
-s 指定要运行的 TestSuite
-f 指定运行结果的输出目录
-j 生成 junit 风格的 report
-r 运行完成以后打印一个简单的 summary

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


posted @ 2017-11-28 17:55  雨 燕  阅读(651)  评论(0编辑  收藏  举报