我正在使用带有 Ant 的 JUnitReport 来生成我的测试用例报告。构建文件成功运行,但显示空值。就像在样式表中一样,我看到框架输出具有
- 测试 0
- 失败 0
- 成功率 NaN
- 时间 0.00
这是我的 build.xml 文件
<project name="JunitTest" default="test" basedir=".">
<property name="testdir" location="./bin" />
<property name="srcdir" location="." />
<property name="full-compile" value="true" />
<property name="test.reports" value="./reports" />
<path id="classpath.base"/>
<path id="classpath.test">
<path id="JUnit 4.libraryclasspath">
<pathelement location="./lib/junit-4.1.jar"/>
<pathelement location=".lib/hamcrest-core-1.3.jar"/>
</path>
<pathelement location="${testdir}" />
<pathelement location="${srcdir}" />
<path refid="classpath.base" />
</path>
<target name="clean" >
<echo> CLEAN </echo>
<delete verbose="${full-compile}">
<fileset dir="${testdir}" includes="**/*.class" />
</delete>
</target>
<target name="compile" depends="clean">
<echo> COMPILING </echo>
<javac srcdir="${srcdir}" destdir="${testdir}" verbose="${full-compile}" >
<classpath refid="classpath.test"/>
<classpath refid="JUnit 4.libraryclasspath" />
</javac>
</target>
<target name="test" depends="compile" >
<junit printsummary="true" showoutput="true">
<classpath refid="classpath.test" />
<classpath refid="JUnit 4.libraryclasspath" />
<formatter type="plain" />
<formatter type="plain" />
<test name="com.megacorp.projx.JUnit.AllTests" />
</junit>
<junitreport todir="${test.reports}" >
<fileset dir="${test.reports}">
<include name="TEST-*.xml" />
</fileset>
<report todir="${test.reports}" format="frames" />
</junitreport>
<record name="${test.reports}/test-output.txt" action="start"/>
</target>