Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

ANT - JUNIT

 
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
 
Ranch Hand
Posts: 781
Netbeans IDE Ubuntu Java
  • 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
Netbeans IDE Ubuntu Java
  • 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
 
Seriously Rick? Seriously? You might as well just read this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic