aspose file tools*
The moose likes Ant, Maven and Other Build Tools and the fly likes Ant with JUnit and Emma: Req Urgent Help 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 with JUnit and Emma: Req Urgent Help" Watch "Ant with JUnit and Emma: Req Urgent Help" New topic
Author

Ant with JUnit and Emma: Req Urgent Help

Sujai Kaarthik
Ranch Hand

Joined: Dec 29, 2008
Posts: 162
Hi friends,
I have an assignment in which I need to club JUnit and Emma with Ant. I have created a small library management application using Struts framework. I have also written JUnit testcases for the same. My guide does not allow me to test and analyze code coverage within Eclipse. He wants me to start from the basic.

I don't know where to place the JUnit test codes and the required JAR files in Ant's installation directory. I placed all the JAR files (junit.jar, emma.jar, emma_ant.jar, ant-junit.jar) in the root (C:\Ant) directory. My build file is located in C:\Ant\docs\manual. The Ant's installation was successful. And I also need some help in creating tasks in build file.


PS: I have to complete this assignment by today.


The greater danger for most of us is not that our aim is too high and we miss it, but that it is too low and we reach it
Sujai Kaarthik
Ranch Hand

Joined: Dec 29, 2008
Posts: 162
is this in a wrong forum?
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

Hi Sujai,

If you're in a real rush, you need to place those libraries in the $ANT_HOME/lib directory. But I'd recommend hosting them elsewhere and referencing them inside your build.xml file as you need them.


Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
Sujai Kaarthik
Ranch Hand

Joined: Dec 29, 2008
Posts: 162
Thanks for the reply Martijn

I don't know whether I have added Emma and Junit successfully or not!
I put junit.jar, emma.jar, emma_ant.jar, ant-junit.jar in the root (C:\Ant) directory. Are these the only required JAR's to run JUnit and Emma? or I need something else. I have my build.xml file at the location C:\Ant\docs\manual. I copied that too to the root directory. Have I installed Emma and Junit correctly?
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

Hi Sujai,

In short no ,

1.) Ant already has JUnit (see your c:/ant/lib directory)
2.) Emma is a library you add on a _per project_ basis, so it should be added to your project's source tree
3.) Your build.xml should be a _per_ project_ as well, it does not need to be in the c:\Ant directory structure at all

A guide to help you is here

Sujai Kaarthik
Ranch Hand

Joined: Dec 29, 2008
Posts: 162
Thanks a ton Martijn..

I'll try my fortune
Bharat Sinha
Greenhorn

Joined: Jul 13, 2009
Posts: 5
Hi, This may be a bit late but i do have a nice link which clearly describes the Ant JUnit integration with Emma...

http://wiki.metawerx.net/wiki/UsingEMMAWithANTForJUnitTestCoverageReporting
 
Don't get me started about those stupid light bulbs.
 
subject: Ant with JUnit and Emma: Req Urgent Help