File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Ant, Maven and Other Build Tools and the fly likes ANT - JUNIT Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "ANT - JUNIT" Watch "ANT - JUNIT" New topic


Max Hernandez

Joined: Apr 27, 2011
Posts: 7
HI everyone

im a begginer with ant and junit, this is what is going on I have a AllTest.class locate in C:\hudson\jobs\gsalt\workspace\GSALT\WebContent\WEB-INF\classes under a package name so the complete path is C:\hudson\jobs\gsalt\workspace\GSALT\WebContent\WEB-INF\classes\test\com\xxxx\gsalt\business\rules, I have my build.xml located in C:\hudson\jobs\gsalt\workspace\GSALT\WebContent\WEB-INF\classes (this is just for simple tests) when i run ant i got the following error

C:\hudson\jobs\gsalt>cd C:\hudson\jobs\gsalt\workspace\GSALT\WebContent\WEB-INF\classes

Buildfile: C:\hudson\jobs\gsalt\workspace\GSALT\WebContent\WEB-INF\classes\build.xml

[junit] Testsuite:
[junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
[junit] Null Test: Caused an ERROR
[junit] java.lang.ClassNotFoundException:
[junit] at$ Source)
[junit] at Method)
[junit] at Source)
[junit] at java.lang.ClassLoader.loadClass(Unknown Source)
[junit] at java.lang.ClassLoader.loadClass(Unknown Source)
[junit] at java.lang.ClassLoader.loadClass(Unknown Source)
[junit] at java.lang.Class.forName0(Native Method)
[junit] at java.lang.Class.forName(Unknown Source)
[junit] Test FAILED


Total time: 0 seconds


this is my build.xml

<project default="all">
<property name="tst-dir" location="/hudson/jobs/gsalt/workspace/GSALT/WebContent/WEB-INF/classes" />
<property name="" value="" />

<path id="classpath.base">
<path id="classpath.test">
<pathelement location="/hudson/tools/AntTest/lib/junit-4.8.2.jar" />
<pathelement location="${tst-dir}" />
<path refid="classpath.base" />

<target name="test">
<classpath refid="classpath.test" />
<formatter type="brief" usefile="false" />
<test name="${}" />

<target name="all" depends="test" />

does any one know why ant can not find the class?

thanks in advance
James Sabre
Ranch Hand

Joined: Sep 07, 2004
Posts: 781

Are you sure your AllTests class has package ?

Retired horse trader.
 Note: double-underline links may be advertisements automatically added by this site and are probably not endorsed by me.
Max Hernandez

Joined: Apr 27, 2011
Posts: 7
thanks for the fast replay yes I'm sure this is my



import org.junit.BeforeClass;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;

import com.xxxx.ApplicationInitializer;

//Add in here the classes that will b tested example:,

public class AllTests {
public static final String myConfigPath = "C://hudson//jobs//gsalt//workspace//GSALT//WebContent//WEB-INF//config/";
public static void setUpBeforeClass() throws Exception {

ApplicationInitializer a = new ApplicationInitializer(myConfigPath,"Business Rules Test","configBRs.xml");



all the other classes are also located under C:\hudson\jobs\gsalt\workspace\GSALT\WebContent\WEB-INF\classes

any ideas?
James Sabre
Ranch Hand

Joined: Sep 07, 2004
Posts: 781

Max Hernandez wrote:
any ideas?

The only other thing I can see without being on you computer is that I don't see anything in your build.xml to compile the AllTests class.
Max Hernandez

Joined: Apr 27, 2011
Posts: 7
i have the class already compile in there...but i really apprecite it your help
I agree. Here's the link:
subject: ANT - JUNIT
It's not a secret anymore!