File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Ant, Maven and Other Build Tools and the fly likes Problem with Ant using JUnit Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Problem with Ant using JUnit" Watch "Problem with Ant using JUnit" New topic
Author

Problem with Ant using JUnit

Unnsse Khan
Ranch Hand

Joined: Nov 12, 2001
Posts: 511
Hello there,

I usually just run my JUnit 3.8.1 unit tests straight from Eclipse.

Figured that it would be a good practice to run my unit tests from Ant (that way other developers wouldn't have to depend on Eclipse)...

Here's what I did so far:



Now, when I tried to run this target, this is the error I got back:



What could I be possibly be doing wrong?

Sincerely,
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2491
    
    8

You did not tell us your Ant version, but if its 1.6.x,
you can drop your junit jar in ant/lib folder, or add it to Ant's classpath.

In Ant 1.7 you can add junit.jar to the task's classpath.

Regards, Jan


OCUP UML fundamental and ITIL foundation
youtube channel
Unnsse Khan
Ranch Hand

Joined: Nov 12, 2001
Posts: 511
Dear Jan,

The version of Ant I use is the 1.6.5, which comes bundled with Eclipse 3.2

When I checked out Preferences -> Ant -> Runtime, there was a ant-junit.jar file inside the library...

Obviously, this is not the same as junit.jar?

Thanks for the response!

Kindest regards,
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2491
    
    8

ant-junit is the integration library that holds the classes used to integrate junit in ant.

But you still need junit.jar. It's documented on the JUnit task's library dependencies.

Regards, Jan
 
Consider Paul's rocket mass heater.
 
subject: Problem with Ant using JUnit
 
Similar Threads
Why doesn't the JUnit test OUTPUT appear using the Ant build?
Want to run multiple Test Cases by Ant ?
ServletTestCase::request is not accessible my test class, which extends jspTestCase.
<junit> problem with Ant
Junit and ant