JUnit 5 @Disabled Test Example

By | October 2, 2020

JUnit 5 @Disabled annotation can be used to disable the entire test class or individual test method.

It accepts only one optional parameter, which indicates the reason why this test is disabled.

When @Disabled annotation is applied over test class then all test methods within that class are automatically disabled, or if it is used before any specific test method then that test method is only disabled.

Let’s try to understand how to use @Disabled annotation in Junit using a demo project





The output of the above project: 


You May Also Like:

Junit 5 Architecture
JUnit 5 Annotations
JUnit 5 Maven Dependency
JUnit 5 with Gradle Dependency
JUnit 5 Test Lifecycle
JUnit 5 @BeforeAll annotation example
Unit 5 @AfterAll annotation example
JUnit 5 @BeforeEach and @AfterEach annotation Example
JUnit 5 Display Names
Assertions in JUnit 5 Examples
Third-party Assertion Libraries support in JUnit 5
JUnit 5 Assumptions Examples

That’s all about JUnit 5 @Disabled Test Example
If you have any feedback or suggestion please feel free to drop in below comment box.

Leave a Reply

Your email address will not be published. Required fields are marked *