ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Clarke <>
Subject Suggestion - JUnit4 tests for Ant
Date Thu, 07 Mar 2013 20:48:57 GMT
I'd like to make a proposal around unit testing the Ant core.

Whilst Ant has support for JUnit4, most of the unit tests are written
against JUnit 3. This itself isn't an issue, although some of the existing
test structures prevent new test being written in JUnit4.

I'd like to propose introducing some JUnit4 support into Ant's tests. One
big possibility is in BuildFileTest, which currently extends TestCase so
limits any extending class to JUnit 3. In my attached patch I've split this
into a Junit4 rule - BuildFileRule - and a class to provide Assert
functions not currently in Junit's bundled Asserts. I've also migrated a
couple of existing tests as an example of using these new classes.

Aside from other features available under JUnit4, this change allows
reporting of which tests are skipped per configuration on the CI  builds
(for tests that use JUnit's Assume class rather than just return). This
should make it easy to tell what features are actually being checked on
each build.

Does anyone have any objection to such a change and, if no objections,
should I look to migrate more classes? I don't have commit access to Ant so
would need someone to apply any patches for me - I'm happy to email them to
this list or put the changes into Github (or similar) for someone to pull
if wanted.

Any comments or suggestions appreciated.


View raw message