my dog learned polymorphism*
The moose likes Testing and the fly likes Junit-Ant Building 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 » Testing
Bookmark "Junit-Ant Building" Watch "Junit-Ant Building" New topic
Author

Junit-Ant Building

Ramesh Sunkara
Ranch Hand

Joined: Mar 01, 2010
Posts: 78
Hi













My problem is.
While running the ant build, the "run-tests" target in my build file is taking **Test*.java files as input. Instead of that *.java files I want to give the jar which was generated as input. But am not successful.

Does anyone knows how to give it?
Anton Shaykin
Ranch Hand

Joined: Dec 13, 2009
Posts: 57

Instead of that *.java files I want to give the jar which was generated as input. But am not successful. Does anyone knows how to give it?

Well, unfortunately it's impossible. You may take a look at the API documentation for BatchTest attribute of ant <junit> here As you see, in the comments for addFileSet method it's said "Add a new fileset instance to this batchtest. Whatever the fileset is, only filename that are .java or .class will be considered as 'candidates'." Furthermore, if you look at the source code for BatchTest class, you will find that it takes ResourceCollection as attribute (which could possibly be any file, even jar), but then it filters all resources by .java and .class extension. It kind of sucks, but if you need to use jar in your case, you can always create your own custom ant task and override standard functionality of <junit> task.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Junit-Ant Building
 
Similar Threads
java.lang.classnotfoundexception in junit report
can't generate JUnit report
Not able run junit test cases from ANT
Axis 2 tutorial - client class compliation error
Testing using ANT