ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Clarke <>
Subject Migration of Ant test to JUnit4
Date Sat, 12 Apr 2014 13:37:06 GMT

I've now completed the migration of Ant's test cases to JUnit4 and would
like to give other developers a chance to review/comment on these changes
before I merge them back into SVN. My changes can be found on Github at ( for anyone
who wants to apply a patch against their local workspace).

Notable changes:
1. Deprecation of
2. Introduction of and to replace deprecated
classes, but with the removal of methods directly relating to asserting
3. Introduction of to provide additional
Asserts beyond the default JUnit ones, and thecreation of to provide common file utilities used in
many tests
4. Addition of @Test annotation to all Test methods, and addition or
@Ignore annotations to methods that had previously been commented out or
named in a way that prevented JUnit 3 seeing/running them.
5. Use of JUnit's Assume to dynamically skip tests that previously silently
returned if certain conditions weren't met (e.g. the Symlink tests not
running on Windows)
6. TODO markers added to tests that previously used exception handling
checks but didn't check the value of the exception being returned. I'll
look at coming back to these in the future to add proper asserts and remove
the TODOs.
7. Removal of Thread.sleep in tests, and the sleep command in associated
XML build files where this has been used to force a difference in file
creation timestamps, and the use of File.setLastModified() instead. This
has knocked 1 minute 30 seconds off the JUnit execution time using
Cloudbees Buildhive Jenkins instance, although I've not looked at whether
similar can be done for the AntUnit tests.
8. Updated the documentation for writing tests to refer to the new 'Rule'
classes rather than the previous Test classes

I'll hold of committing these changes to SVN for a couple of days to give
people a chance to comment. Unless I hear any significant objections to
these changes by the middle of Wednesday, I'll look commit to SVN on
Wednesday night (UK time).


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message