jQuery in Action, 3rd edition
The moose likes Other Open Source Projects and the fly likes Ant/JUnit, BatchTest: ClassNotFound... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Ant/JUnit, BatchTest: ClassNotFound..." Watch "Ant/JUnit, BatchTest: ClassNotFound..." New topic

Ant/JUnit, BatchTest: ClassNotFound...

David Yutzy
tumbleweed and gunslinger
Ranch Hand

Joined: Jun 29, 2001
Posts: 192
Started using JUnit more in a more complex project and specifying each TestCase individually works great. However, cannot get the BatchTest to work.
The following output is generated:
Testsuite: AdminDBTest
Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
Caused an ERROR
java.lang.ClassNotFoundException: AdminDBTest
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:183)
at java.lang.ClassLoader.loadClass(ClassLoader.java:294)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:281)
at java.lang.ClassLoader.loadClass(ClassLoader.java:250)
at java.lang.ClassLoader.loadClass(ClassLoader.java:250)
Below is the JUnit section of build.xml for Ant:
<target name="junit" depends="compile">
<junit printsummary="yes" haltonfailure="no">
<pathelement location="./"/>
<pathelement path="${classpath}"/>
<formatter type="plain"/>

<batchtest fork="no" todir="../">
<fileset dir="${junit}">
<include name="**/*Test*.java"/>

The variables classpath and junit are set and work fine with all other code/ant processes. Not sure why it's failing...
Ant v1.5.1
JUnit v3.8.1
JDK 1.3.1_03
Matthew Phillips
Ranch Hand

Joined: Mar 09, 2001
Posts: 2676
I will move this to the Open Source forum.

Matthew Phillips
It is sorta covered in the JavaRanch Style Guide.
subject: Ant/JUnit, BatchTest: ClassNotFound...
jQuery in Action, 3rd edition