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 Problem 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 Problem" Watch "ANT JUnit Problem" New topic

ANT JUnit Problem

Amirr Rafique
Ranch Hand

Joined: Nov 14, 2005
Posts: 324
Hi All
When I run me Test case in Ant it gives me following error. This test case works fine when I run it in Eclipse as JUnit test. Below are the error and the ant task code
[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 sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
[junit] at java.lang.ClassLoader.loadClass(Unknown Source)
[junit] at java.lang.ClassLoader.loadClassInternal(Unknown Source)
[junit] at java.lang.Class.forName0(Native Method)
[junit] at java.lang.Class.forName(Unknown Source)
[junit] at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(
[junit] at
[junit] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(
[junit] Test FAILED

Ant Task is

Any one please help me

"Know where to find the solution and how to use it - that's the secret of success."
Lasse Koskela

Joined: Jan 23, 2002
Posts: 11962
You haven't specified a classpath for the <junit/> task. See the documentation for examples.

Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
I agree. Here's the link:
subject: ANT JUnit Problem
It's not a secret anymore!