wood burning stoves 2.0*
The moose likes Ant, Maven and Other Build Tools and the fly likes How Ant and JUnit work together? 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 "How Ant and JUnit work together?" Watch "How Ant and JUnit work together?" New topic

How Ant and JUnit work together?

Ram Dhan Yadav K
Ranch Hand

Joined: Aug 13, 2001
Posts: 321
I have read that you can use JUnit along with Ant? This thing actually confused me!
And is a generic build tool which caters to compile time and JUnit is a testing tool which caters to runtime. I think i have interpreted the uses correctly.
Now how can one use jUnit along with Ant. Does ant have runtime capabilities also like executing the scripts, java programs, executables etc?

Ram Dhan Yadav (SCJP, SCWCD, SCJA-I, IBM EC(483))
"We are what we repeatedly do. Excellence, then, is not an act, but a habit."
Doug Wang
Ranch Hand

Joined: Oct 05, 2001
Posts: 445
Hi Ram,
Do check out the JUnit article page and the Ant resources page. You need not do any extra search.
Being a newcomer, the"Incremental development with Ant and JUnit" article may cater to you. The author gives a HelloWorld example.
Concerning your confusion, you may cusomize ant tasks at will due to the big power of ant(I'd like to say the power of XML).
Hope that helpful.
[ March 14, 2002: Message edited by: Doug Wang ]

Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep
Ram Dhan Yadav K
Ranch Hand

Joined: Aug 13, 2001
Posts: 321
Hi Doug,
Thats cool resource from IBM. Ant really rocks!
timothy zimmerman
Ranch Hand

Joined: Jun 26, 2001
Posts: 149
Although Ant is a build tool, you can script it to execute java code (and other). So, at build time, once you have compield your new code you can then compile and run you unit tests so that by the end of the build process you have performed your unti tests as well.
It is sorta covered in the JavaRanch Style Guide.
subject: How Ant and JUnit work together?
Similar Threads
What is ANT (as in apache tomcat) ?????
Report Based on JUnit Test Case
Junit reports for Hudson
integrate jUnit with the Ant
Running a JUnit test case using Ant in Eclipse