Closed
Description
Dave Syer opened SPR-7731 and commented
Overview
Sometimes (always?) it would be nice to have a @Rule
implementation that did the job of the SpringJUnit4ClassRunner
.
The main motivation for this is to be able to use other runners (e.g. @Parameterized
, @Categories
, Mockito, etc.).
There might even be a case for deprecating the runner in favor of a @Rule
?
Further Resources
- @Rules annotation at class level junit-team/junit4#200
- JUnit should have an exhaustive listener framework junit-team/junit4#444
- Add support for test pre-processors junit-team/junit4#766
- SPR-10217 Implement JUnit 4 Support using Rules #222
- https://github.com/mmichaelis/spring-aware-rule
Attachments:
- SpringContextRule.java (4.72 kB)
- SpringContextRule.java (4.49 kB)
- spring-test-4.2.0.BUILD-SNAPSHOT.jar (501.52 kB)
Issue Links:
- Introduce a TestExecutionListener for DbUnit [SPR-6593] #11259 Introduce a TestExecutionListener for DbUnit ("Cloned from")
- Document SpringClassRule and SpringMethodRule in the reference manual [SPR-13037] #17629 Document SpringClassRule and SpringMethodRule in the reference manual ("is depended on by")
- JUnit @Rule executes outside of transaction when using the TransactionalTestExecutionListener [SPR-9232] #13870 JUnit
@Rule
executes outside of transaction when using the TransactionalTestExecutionListener ("is depended on by") - Implement JUnit 4 Support using Rules [SPR-10217] #14850 Implement JUnit 4 Support using Rules ("is duplicated by")
- Add support for parameterized JUnit 4 tests in the Spring TestContext Framework [SPR-5292] #9965 Add support for parameterized JUnit 4 tests in the Spring TestContext Framework
25 votes, 30 watchers