Closed
Description
Tadaya Tsuyukubo opened SPR-14614 and commented
Status Quo
The JUnit Jupiter API in JUnit 5 currently provides @Disabled
to disable tests; however, disabling of tests via this annotation is determined at compile time. Thus it's not flexible.
Another option is to use Assumptions
within test methods, but it may not so intuitive since the logic resides in the method. Furthermore, the use of assumptions is not very reusable.
Proposal
For JUnit Jupiter and the Spring TestContext Framework, using SpEL expressions would provide a dynamic means for disabling tests.
Suggested API:
@DisabledIf("SpEL expression here")
Related Resources
Issue Links:
- Support @EnabledIf and @DisabledIf without loading ApplicationContext [SPR-14649] #19215 Support
@EnabledIf
and@DisabledIf
without loading ApplicationContext ("is depended on by") - Introduce support for enabling JUnit Jupiter tests with SpEL expressions [SPR-14644] #19210 Introduce support for enabling JUnit Jupiter tests with SpEL expressions