-
Notifications
You must be signed in to change notification settings - Fork 0
JUnit 5: Disabling JUnit tests
Kristina edited this page Nov 8, 2017
·
3 revisions
In JUnit you can disable unit tests or test classes using the @Disabled annotation.
To disable a unit test just add the @Disabled annotation right before the unit test.
@Disabled
@Test
void SkippedTestMethodTest(){
fail("Fail Build");
}
To disable a unit test class just add the @Disabled annotation right before the class name.
@Disabled
class DisabledTestClassTest {
@Test
void SkippedFailTest(){
fail("This test will be skipped");
}
@Test
void SkippedPassTest(){
assertEquals(4,2+2);
}
}
You can find demos of this functionality here.
Always Learning
- Home
- Websites
- Linux
- Java
- Gradle
- JUnit
- Database