Disabled Tests and Display Name Generator
Explore how to mark tests as disabled in JUnit 5 using the @Disabled annotation to exclude them from execution. Understand how display name generators, such as Simple, ReplaceUnderscores, and IndicativeSentences, customize test method naming and enhance test clarity. Discover the priority rules for naming tests and configuring default display name generators for better test management.
What are disabled tests?
We can use the annotation org.junit.jupiter.api.Disabled to mark a test class or test method as disabled. Normal tests execute and the test case either passes or fails. A disabled test never executes.
Example of a disabled test
Here's an example of a disabled test:
Lines 5–8: We’ve defined a normal test that executes and passes because the condition is
True.Lines 10–14: ...