SoapUI testrunner XML结果的空Ant <junitreport>报告

时间:2017-03-30 12:02:10

标签: junit ant soapui ant-junit

我正在使用Ant运行一个SoapUI项目来获取JUnit报告。

这是我的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,successrateNan

任何人都可以检查build.xml是否正确?

1 个答案:

答案 0 :(得分:1)

  • 看起来构建脚本似乎没问题
  • 避免使用目录名称中的空格
  • 甚至在Windows上使用正斜杠等正斜杠
  • 在构建脚本中使用属性文件或属性,以便其他成员不会编辑构建脚本,因为路径可能会将机器更改为机器。
  • 目前,在以下脚本中添加了属性,您也可以外部化到属性文件。

<强>的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图像并运行测试&amp;生成junit样式的html报告。请参阅soapui repository @ hub.docker.com

注意:构建脚本使用的docker镜像与上面的机器路径完全相同。

相关问题