Reputation: 75
I am using JUnitReport with Ant to generate my test cases report. The build file runs successfully but it is showing empty values. Like in the Style sheet , I am seeing the framed output having
Here is my build.xml file
<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>
Upvotes: 2
Views: 1839
Reputation: 18459
Please set todir attribute in your test
block
<test name="com.megacorp.projx.JUnit.AllTests" todir="${test.reports}" />
If you are just learning junit ant task, please check the batchtest
task. It can pickup tests based on filters.
Upvotes: 1