Ignore test

This example will show how to ignore a unit test using Junit 4. Occasionally you push code and you forget to run your unit test which breaks the build. You get the build notification and your name up on "you broke the build wall". To keep things functional you may want to disable a test or a group of tests. You can do this by annotating your unit test with the @Ignore annotation which prevents your test from being executed. In addition, you can annotate a class containing test methods and none of the @Test methods will be executed.

As a good practice, I often encourage developers when ignoring a junit test to include a comment within the include annotation to explain why and hopefully reduce confusion.

Ignore test

@Ignore("Ignore this test")
@Test
public void ignore_test_junit () {
    assertFalse(true);
}