There's been a lot of rumor about JUnit 4 lately and thankfully Kent Beck provided some information on the JUnit list. He also points to a short introduction by Gunjan Doshi.
With this to me it looks as if it won't affect the Ant <junit> task at all - if you plan for it.
The first thing you have to be aware of is that JUnit 4 requires Java 5 at runtime. So you either need to run Ant on a Java 5 VM if you want to use JUnit 4, or use fork="true" and specify a Java 5 VM in the executable attribute of the <junit> task.
And then you will need to provide a suite()
method in
all your test classes and wrap your class in a
JUnit4TestAdapter
, otherwise Ant's testrunner won't see
any tests in your classes. With this you should be able to use Ant
the same way you always did.
Right now this is pure theory since I haven't actually tried anything yet. During the next days I hope to free up some time to check out the JUnit 4 branch from CVS and play with it. If I should find any problems, I'll make some noise.
Longer term Ant may provide an additional testrunner that is used if Ant detects JUnit 4 on the <classpath> specified by the user, but this should not be required to use the task.
For Ant's own unit tests I'm totally with Steve. Since a switch would require our tests to be Java 5 only it will take a long time before we'll leave JUnit 3.8.1 behind.
path: /en/Apache/Ant | #