junit

Ignore test cases in Junit

Introduction#

Sometimes you want to ignore some of the test cases you have in Junit. For instance, they are partially done and you want to come back to them later.

Ignore test case in Junit

  1. Go to the test method you want to ignore
  2. Before the @Test annotation, enter @Ignore
  3. optional: You can add description why are you ignoring this test method, something like: @Ignore ("ignoring this test case for now")

a sample method would be:

@Ignore ("not going to test this method now")
@Test
public void test() {
     assertfalse(true);
}

This modified text is an extract of the original Stack Overflow Documentation created by the contributors and released under CC BY-SA 3.0 This website is not affiliated with Stack Overflow