Hi,
I have the following ANT task:
<target name="run-tests" depends="compile" description="run your test suite" >
<junit printsummary="yes" haltonfailure="yes" showoutput="yes" >
<classpath>
<pathelement location="${build}/"/>
<pathelement path="${java.class.path}"/>
<fileset dir="lib">
<include name="**/*.jar"/>
</fileset>
</classpath>
<batchtest fork="yes" todir="${reports}/raw/">
<formatter type="xml"/>
<fileset dir="${src}">
<include name="**/*Test*.java"/>
</fileset>
</batchtest>
</junit>
</target>
The 'compile' task generates classes in the 'build' folder. That folder is included in the classpath for junit task:
<pathelement location="${build}/"/>
But the task can't find any of the compiled classes and the test run fails.
If I remove the package notation from the tests (put then in the default package) the task finds then and everything works. I guess I have a classpath issue...
Tried to add the classes with a 'fileset' task but it didn't work. Tried to run the task in the same JVM (fork="false") to no avail.
If I change the fileset in the 'batchtest' task to:
<fileset dir="${build}">
<include name="**/*Test*.class"/>
</fileset>
Then it works (changed it to point to the build dir), but all the examples I see online have filesets pointing to the .java files:
http://ant.apache.org/manual/OptionalTasks/junit.html
Appreciate any help.