1
我使用JUnitReport使用Ant生成我的測試用例報告空值。 構建文件成功運行,但顯示空值。就像在樣式表,我看到有JUnit的報告顯示
- 測試0
- 故障0
- 成功率楠幀輸出
- 時間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>
您的JUnit不使用test.reports屬性。 TEST- * xml在哪裏去? – Jayan
我正在使用test.report屬性。我在我的項目目錄下創建了文件夾命名報告,其中junit創建所有html文件,但具有所有值0.還在文件夾報告TESTS-TestSuites.xml下創建了文件爲空。 –