I’m using pure JUnit 4 test and I have them compiled inside some jars that belongs to the classpath.
I’d like to run all the tests in my classpath.
Is there a way?
My tasks looks like:
<target name="test" description="All the tests">
<junit fork="yes">
<classpath>
<path refid="test.classpath" />
<fileset dir="war/WEB-INF/lib/">
<include name="*.jar"/>
</fileset>
<fileset dir="war/WEB-INF"/>
<fileset dir="war"/>
</classpath>
<formatter type="plain" usefile="false" />
</junit>
</target>
The example below assumes the JUnit tests are named with the suffix “Test” such as “MyClassTest.java” and that the JUnit 4 jar file is in a library directory pointed to by the property
lib.dir. For each jar file containing compiled tests, a ZipFileSet may be used to select the test classes within a nested<batchtest>element. The path to the JUnit 4 jar is included in the classpath to ensure that the correct version is used.