2017-08-08 19 views
0

我目前使用ANT和SOAP UI免费版来帮助在运行项目后生成HTML报告。这工作成功,现在我想能够运行多个项目,但我不知道如何转换我的构建文件一次运行多个项目。如何从SOAP UI运行多个项目并使用ANT输出HTML报告

其实我想知道什么是最佳实践,我希望能够通过单击一个按钮来运行多个项目,并且所有项目都以单个HTML报告的状态显示。有人可以通过代码示例显示流程,所以我知道如何实现这一点?现在使用命令提示符在本地运行。

另外我需要包括选择正确的环境,所以我想知道是否有一种方法让我进入一个环境。如果环境列表可以像编号列表一样出现并且用户选择该编号并且在测试报告中显示了使用哪个环境,那将会很好。

下面是build.xml文件,我运行一个项目并开发了一个报告。

<?xml version="1.0" encoding="UTF-8" standalone="no"?> 
<!-- WARNING: Exclipse auto generated file. 
      Any modifications will be overwritten. 
      To include a user specific buildfile here, simply create one in the same 
      directory with the processing instruction <?eclipse.ant.import?> 
      as the first entry and export the buildfile again. --> 

<project basedir="." default="xxx_Test_WebApi_Test_Report" 

name="xxx_Test_WebApi"> 


<target name="xxx_Test_WebApi_SoapUI"> 
<exec dir="." executable="C:\Program Files\SmartBear\SoapUI-5.3.0\bin\testrunner.bat"> 
<arg line="-r -j -f 'D:\xxx\Trunk\xxx.xxx.Test\SoapUI 

\xxx_Test_WebApi\XMLReport' 'D:\xxx\Trunk\xxx.xxx.Test\SoapUI 

\xxx_Test_WebApi\Test-API-soapui-project(v2).xml'"></arg> 
</exec> 
</target> 


<target name="xxx_Test_WebApi_Test_Report" 

depends="xxx_Test_WebApi_SoapUI"> 
<junitreport todir="D:\xxx\Trunk\xxx.xxx.Test\SoapUI 

\xxx_Test_WebApi\XMLReport"> 
    <fileset dir="D:\xxx\Trunk\xxx.xxx.Test\SoapUI 

\xxx_Test_WebApi\XMLReport"> 
     <include name="TEST-*.xml"/> 
     </fileset> 
    <report todir="D:\xxx\Trunk\xxx.xxx.Test/SoapUI 

\xxx_Test_WebApi\HTMLReport"> 

    </report> 
    </junitreport> 
</target> 

</project> 

回答

0

这很简单。

您需要相应地组织目标。

例如,用户有两个soapui项目。

  • 定义在构建脚本两个目标,这将只是执行项目
  • 定义另一个目标,说generate.report

现在你需要做的就是调用适当的目标。

例如:下面的命令将执行project1,project2然后生成报告。

ant project1 project2 generate.report 

我建议不要在目标之间放置任何依赖关系。