Hi,

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
https://github.com/mc1arke/ant/tree/JUnit4Conversion (
https://github.com/mc1arke/ant/compare/JUnit4Conversion.patch for anyone
who wants to apply a patch against their local workspace).

Notable changes:
1. Deprecation of org.apache.tools.ant.BuildFileTest
and org.apache.tools.ant.types.selectors.BaseSelectorTest
2. Introduction of org.apache.tools.ant.BuildFileRule and
org.apache.tools.ant.types.selectors.BaseSelectorRule to replace deprecated
classes, but with the removal of methods directly relating to asserting
values
3. Introduction of org.apache.tools.ant.AntAssert to provide additional
Asserts beyond the default JUnit ones, and thecreation of
org.apache.tools.ant.FileUtilities 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).

Thanks,
Michael

Reply via email to