We have test classes built on Spring 2.0.8 AbstractTransactionalDataSourceSpringContextTests. There are a huge number of them, all of which are written in the style of JUnit3.
To use JUnit 4 filtering, we came up with a replacement JUnit38Runner, which allows you to compare these tests with a specific application environment and filter them accordingly.
The entire test suite works just fine outside Ant, using the @RunWith annotation on our custom JUnit38Runner.
However, when we try to run in Ant, it forces individual tests to run as junit.framework.TestSuite or wrapped in a JUnit4TestAdapter, both of which ignore @RunWith annotations under JUnit4. Even worse, our existing packages are explicitly overridden by Ant, which calls the suite () methods directly rather than delegating to JUnit.
I tried to spread from Ant JUnitTestRunner and just override the run () method, however the class is simply not written for extension.
Besides copying the whole JUnitTestRunner and hacking it (which will open us problems with fragile code), is anyone lucky with other approaches to solving this problem?
junit junit4 ant
Matt
source share