1

We are using ant to run all of our JUnitTests. Our batchtest looks like:

<batchtest todir="${test.reports}">
    <!-- First fork -->
    <fileset dir="${build.out.dir}/plugins/plugin1/test" includes="**/*Test.java" />
    <fileset dir="${build.out.dir}/plugins/plugin2/test" includes="**/*Test.java" />
    <fileset dir="${build.out.dir}/plugins/plugin3/test" includes="**/*Test.java" />
    <fileset dir="${build.out.dir}/plugins/plugin4/test" includes="**/*Test.java" />
    <fileset dir="${build.out.dir}/plugins/plugin5/test" includes="**/*Test.java" />
    <fileset dir="${build.out.dir}/plugins/plugin6/test" includes="**/*Test.java" />
    <fileset dir="${build.out.dir}/plugins/util/test" includes="**/*Test.java" />
</batchtest>

The problem with this is if somebody is adding a new plugin and forgetting to add the fileset here, the tests are not going to run. So I tried to wrote something like this:

<batchtest todir="${test.reports}">
    <!-- First fork -->
    <fileset dir="${build.out.dir}/plugins" includes="**/test/**/*Test.java" />
</batchtest>

but all tests are failing when running this. and I am getting

java.lang.ClassNotFoundException: build.test.com.something.something.something.something.something.something.somethngTest
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:186)

any idea?

Govan
  • 2,079
  • 4
  • 31
  • 53
  • It says 'java.lang.ClassNotFoundException'. Did you confirm such a class exist (including the correct package name?) – Jayan Oct 19 '12 at 04:05
  • If you want to consider foreach, see this answer : http://stackoverflow.com/questions/1467991/ant-how-to-execute-a-command-for-each-file-in-directory – Jayan Oct 19 '12 at 04:06

0 Answers0