I’m trying to get Ant to run my JUnit tests now but I keep getting
Testsuite: net.anthonychaves.test.geoip.locator.LocatorHelpersTest
Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
Caused an ERROR
net.anthonychaves.test.geoip.locator.LocatorHelpersTest
java.lang.ClassNotFoundException: net.anthonychaves.test.geoip.locator.LocatorHelpersTest
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:164)
I’m not sure how that can happen because the JUnit section of build.xml file looks like this:
[junit printsummary="yes" fork="yes" dir="${basedir}/build/classes/"]
[classpath]
[pathelement path="/home/anthony/jboss-4.0.4.GA/client/jboss-j2ee.jar"/]
[pathelement path="/home/anthony/eclipse/plugins/org.junit_3.8.1/junit.jar"/]
[pathelement path="/m2/ark/code/mysql-connector-java-3.1.12/mysql-connector-java-3.1.12-bin.jar"/]
[fileset dir="${basedir}/build/classes/"]
[include name="**/*Test.class"/]
[/fileset]
[/classpath]
[formatter type="plain"/]
[batchtest todir="/home/anthony/junit/reports" ]
[fileset dir="${basedir}/test/"]
[include name="**/*Test.java"/]
[/fileset]
[/batchtest]
[/junit]
I’m not sure why it can’t find the class at this point and I don’t have enough time to debug it tonight. It’s finding the class name well enough to try to run the test, but it’s not finding the class to do it. I guess I’ll have something to think about on my train ride tomorrow. Any suggestions would be helpful!
November 15th, 2006 | Java | 4 comments