Disable Test Method and Class - @Disabled

This lesson demonstrates how to disable the test method or a complete test class.

@Disabled annotation

There are many ways to enable or disable test methods or test class in Junit 5. @Disabled annotation if applied to the test class, then all the tests present in the class gets disabled and if applied on the test method, then that test method is not executed. @Disabled annotation also takes one optional parameter, which provides a reason for disabling test case for documentation.

Get hands-on with 1400+ tech skills courses.