New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce predefined @Disabled*/@Enabled* variants #219
Comments
I just realized I should write like this to skip the test on windows machines for my use case. However, I still think annotating such condition would be easier to detect than writing assumptions in body of the test methods. |
@ttddyy, that's an interesting idea, and I in fact had a similar idea (hence the new subject). I'm not sure that we will introduce such mechanisms in core JUnit 5, but I do imagine they will end up somewhere (perhaps in an add-on module or in an example project). p.s. this would be similar to |
We have recently received a recommendation for introducing an annotation like So that is also something to keep in mind. I'm currently thinking we should support the following use cases.
|
I wanted to add a use-case to this issue that was described during the "Metrics-Driven Continuous Delivery in Practice [TUT5941]" session at JavaOne. The presenter's company (Dynatrace) has developed a custom @ignore annotation which allows tests to be ignored only if the issue (in this case in Jira) it's testing against is still open. This seems like a pretty clever TDD trick too. |
Yep, that's also a clever use case. But something like that is very specific to a particular technology. So I don't foresee that being implemented as a generic solution within JUnit itself. |
No ... but the "condition =" idea above would satisfy both this use case and the @DisableUntil use case. |
This commit introduces conditional test execution support based on JVM system properties via @EnabledIfSystemProperty and @DisabledIfSystemProperty. Issue: #219
This commit introduces conditional test execution support based on OS environment variables via @EnabledIfEnvironmentVariable and @DisabledIfEnvironmentVariable. Issue: #219
This commit introduces conditional test execution support based on common operating systems via @EnabledOnOs and @DisabledOnOs. Issue: #219
This commit introduces conditional test execution support based on JRE versions via @EnabledOnJre and @DisabledOnJre. Issue: #219
This commit introduces conditional test execution support based on JVM system properties via @EnabledIfSystemProperty and @DisabledIfSystemProperty. Issue: #219
This commit introduces conditional test execution support based on OS environment variables via @EnabledIfEnvironmentVariable and @DisabledIfEnvironmentVariable. Issue: #219
This commit introduces conditional test execution support based on common operating systems via @EnabledOnOs and @DisabledOnOs. Issue: #219
This commit introduces conditional test execution support based on JRE versions via @EnabledOnJre and @DisabledOnJre. Issue: #219
This issue has been resolved in latest commits pushed to |
* Introduce @EnabledIf execution condition Supply a JavaScript controlling whether the annotated container or test is executed. Closes junit-team#219
This commit introduces conditional test execution support based on JVM system properties via @EnabledIfSystemProperty and @DisabledIfSystemProperty. Issue: junit-team#219
This commit introduces conditional test execution support based on OS environment variables via @EnabledIfEnvironmentVariable and @DisabledIfEnvironmentVariable. Issue: junit-team#219
This commit introduces conditional test execution support based on common operating systems via @EnabledOnOs and @DisabledOnOs. Issue: junit-team#219
This commit introduces conditional test execution support based on JRE versions via @EnabledOnJre and @DisabledOnJre. Issue: junit-team#219
Overview
I just happened to have a test only failing on MS Windows machines and thought about JUnit Jupiter.
I could write a custom extension implementing
ContainerExecutionCondition
andTestExecutionCondition
, but having a predefined@Disabled
annotation such as@DisabledIfWindows
or@Disabled(condition = IsWindowsEvaluator.class)
to extend disabling feature might be handy.Related Issues
Deliverables
@EnabledOnDayOfWeek
and@DisabledOnDayOfWeek
.@EnabledOnOs({})
, that should result in an exception instead of a disabled result.The text was updated successfully, but these errors were encountered: