Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ANT - JUNIT

 
Max Hernandez
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 test.com.xxxx.gsalt.business.rules 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

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

test:
[junit] Testsuite: test.com.xxxx.gsalt.business.rules.AllTest
[junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
[junit]
[junit] Null Test: Caused an ERROR
[junit] test.com.xxxx.gsalt.business.rules.AllTest
[junit] java.lang.ClassNotFoundException: test.com.xxxx.gsalt.business.rules.AllTest
[junit] at java.net.URLClassLoader$1.run(Unknown Source)
[junit] at java.security.AccessController.doPrivileged(Native Method)
[junit] at java.net.URLClassLoader.findClass(Unknown 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]
[junit]
[junit] Test test.com.xxxx.gsalt.business.rules.AllTest FAILED

all:

BUILD SUCCESSFUL
Total time: 0 seconds

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


this is my build.xml

<project default="all">
<property name="tst-dir" location="/hudson/jobs/gsalt/workspace/GSALT/WebContent/WEB-INF/classes" />
<property name="test.class.name" value="test.com.xxxx.gsalt.business.rules.AllTest" />

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

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

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


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


thanks in advance
 
James Sabre
Ranch Hand
Posts: 781
Java Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you sure your AllTests class has package test.com.xxxx.gsalt.business.rules ?
 
Max Hernandez
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for the fast replay yes I'm sure this is my AllTest.java

----------------------------------------------------------------

package test.com.xxxx.gsalt.business.rules;

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


import com.xxxx.ApplicationInitializer;

@RunWith(Suite.class)
@Suite.SuiteClasses({
//Add in here the classes that will b tested example:
test.bis.webframe.business.rules.operation.TestSaveEventLog.class,
test.bis.webframe.gsalt.files.TestGenerateAPFactSheet.class,
test.bis.webframe.gsalt.files.TestGenerateCAWorkSheet.class,
test.com.xxxx.business.rules.dates.TestGetCurrentDate.class,
test.com.xxxx.business.rules.events.TestSaveBusinessObject.class,
test.com.xxxx.business.rules.events.TestDeleteRecords.class,
test.com.xxxx.business.rules.operations.TestSendEmailJNDI.class,
test.com.xxxx.business.rules.operations.TestSendEmailTemplate.class,
test.com.xxxx.business.rules.operations.TestUpdateRecords.class,
test.com.xxxx.gsalt.business.rules.operation.TestRetrieveBlueGroupPersons.class
})

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

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

}

}

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


any ideas?
 
James Sabre
Ranch Hand
Posts: 781
Java Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have the class already compile in there...but i really apprecite it your help
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic