SoapUI 测试运行器 XML 结果的空 Ant <junitreport> 报告
Empty Ant <junitreport> report for SoapUI testrunner XML results
我是 运行 一个使用 Ant 获取 JUnit 报告的 SoapUI 项目。
这是我的 build.xml:
<project basedir="." default="testreport" name="APIAutomation">
<target name="SoapUI">
<exec dir="." executable="C:\Program Files (x86)\SmartBear\SoapUI-5.0.0\bin\testrunner.bat">
<arg line="-r -j -a -f 'C:\Users\F3020722\Desktop\Notification\New folder' -sFirstLoginTest 'C:\Users\F3020722\Desktop\Notification\New folder\APIRegression.xml'"></arg>
</exec>
</target>
<target name="testreport" depends="SoapUI">
<junitreport todir="C:\Users\F3020722\Desktop\Notification\New folder\API">
<fileset dir="C:\Users\F3020722\Desktop\Notification\New folder\API">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames"
todir="C:\Users\F3020722\Desktop\Notification\New folder\reports\html">
</report>
</junitreport>
</target>
</project>
我正在正确收到 XML 报告。然而,JUnit 报告是空的。 all
包含 0,successrate
是 Nan
。
谁能检查 build.xml 是否正确?
- 看起来构建脚本似乎没问题
- 避免在目录名称中使用空格
- 即使在 windows
上也像 unix 风格一样使用正斜杠
- 在构建脚本中使用 属性 文件或属性,这样其他成员就不会编辑构建脚本,因为路径可能会在机器之间改变。
- 现在,在下面的脚本中添加属性,您也可以外部化到 属性 文件。
build.xml
<project basedir="." default="testreport" name="APIAutomation">
<property name="test.suite" value="FirstLoginTest"/>
<property name="soapui.project" value="C:/Users/F3020722/Desktop/Notification/New folder/APIRegression.xml"/>
<property name="soapui.home" value="C:/Program Files (x86)/SmartBear/SoapUI-5.0.0"/>
<property name="results.dir" value="C:/Users/F3020722/Desktop/Notification/API/Results"/>
<property name="reports.dir" value="${results.dir}/Reports"/>
<property name="html.dir" value="${reports.dir}/html"/>
<target name="execute.project">
<exec dir="${soapui.home}/bin" executable="testrunner.bat">
<arg line="-raj -f ${results.dir} -s ${test.suite} ${soapui.project}" />
</exec>
</target>
<target name="testreport" depends="execute.project">
<mkdir dir="${reports.dir}"/>
<junitreport todir="${reports.dir}">
<fileset dir="${results.dir}">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="${html.dir}" />
</junitreport>
</target>
</project>
您还可以找到用于 soapui 的 docker 图像和 运行 测试并生成 junit 样式的 html 报告。参考soapui repository@hub.docker.com
注意:构建脚本使用的docker图像与上面完全相同,除了机器路径。
我是 运行 一个使用 Ant 获取 JUnit 报告的 SoapUI 项目。
这是我的 build.xml:
<project basedir="." default="testreport" name="APIAutomation">
<target name="SoapUI">
<exec dir="." executable="C:\Program Files (x86)\SmartBear\SoapUI-5.0.0\bin\testrunner.bat">
<arg line="-r -j -a -f 'C:\Users\F3020722\Desktop\Notification\New folder' -sFirstLoginTest 'C:\Users\F3020722\Desktop\Notification\New folder\APIRegression.xml'"></arg>
</exec>
</target>
<target name="testreport" depends="SoapUI">
<junitreport todir="C:\Users\F3020722\Desktop\Notification\New folder\API">
<fileset dir="C:\Users\F3020722\Desktop\Notification\New folder\API">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames"
todir="C:\Users\F3020722\Desktop\Notification\New folder\reports\html">
</report>
</junitreport>
</target>
</project>
我正在正确收到 XML 报告。然而,JUnit 报告是空的。 all
包含 0,successrate
是 Nan
。
谁能检查 build.xml 是否正确?
- 看起来构建脚本似乎没问题
- 避免在目录名称中使用空格
- 即使在 windows 上也像 unix 风格一样使用正斜杠
- 在构建脚本中使用 属性 文件或属性,这样其他成员就不会编辑构建脚本,因为路径可能会在机器之间改变。
- 现在,在下面的脚本中添加属性,您也可以外部化到 属性 文件。
build.xml
<project basedir="." default="testreport" name="APIAutomation">
<property name="test.suite" value="FirstLoginTest"/>
<property name="soapui.project" value="C:/Users/F3020722/Desktop/Notification/New folder/APIRegression.xml"/>
<property name="soapui.home" value="C:/Program Files (x86)/SmartBear/SoapUI-5.0.0"/>
<property name="results.dir" value="C:/Users/F3020722/Desktop/Notification/API/Results"/>
<property name="reports.dir" value="${results.dir}/Reports"/>
<property name="html.dir" value="${reports.dir}/html"/>
<target name="execute.project">
<exec dir="${soapui.home}/bin" executable="testrunner.bat">
<arg line="-raj -f ${results.dir} -s ${test.suite} ${soapui.project}" />
</exec>
</target>
<target name="testreport" depends="execute.project">
<mkdir dir="${reports.dir}"/>
<junitreport todir="${reports.dir}">
<fileset dir="${results.dir}">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="${html.dir}" />
</junitreport>
</target>
</project>
您还可以找到用于 soapui 的 docker 图像和 运行 测试并生成 junit 样式的 html 报告。参考soapui repository@hub.docker.com
注意:构建脚本使用的docker图像与上面完全相同,除了机器路径。