wood burning stoves*
The moose likes Ant, Maven and Other Build Tools and the fly likes Ant: runnig unit tests from a JAR? 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 "Ant: runnig unit tests from a JAR? " Watch "Ant: runnig unit tests from a JAR? " New topic

Ant: runnig unit tests from a JAR?

Val Tkov

Joined: Dec 09, 2004
Posts: 1
Is it possible to run JUnit tests from a JAR file?

This task does not work:

<junit fork="yes" printsummary="on" haltonfailure="yes" failureproperty="tests.failed">
<formatter type="plain" usefile="true" />
<batchtest todir="${test.reports}">
<fileset dir="dist">
<include name="**/Test*.class" />

The my.jar file is in the \dist directiry.
Ilja Preuss

Joined: Jul 11, 2001
Posts: 14112
The junit task certainly can run tests from a jar file. I don't know an easy way to select the tests from a jar via batchtest, though, sorry.

The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
It is sorta covered in the JavaRanch Style Guide.
subject: Ant: runnig unit tests from a JAR?
Similar Threads
Not able run junit test cases from ANT
ANT issues - Unable to create JUnit Reports- Please help
Want to run multiple Test Cases by Ant ?
Junit and ant
Ant runs tests twice?