Search This Blog

Wednesday, 9 December 2015

Ignore JUnit Test Case

How can we stop a test case not to run??


Dont use java comment to comment the test case function,
Please use @Ignore annotation to comment test case,


Example


on function level


@Ignore("not ready yet")
@Test public void testOnething() {
System.out.println("This method is ignored because its not ready yet");
}


on class level

@Ignore public class Ignored {
@Test public void test1() {
System.out.println("Ignored test case 1");
}
@Test public void test2() {
System.out.println("Ignored test case 2");
}
 }

No comments:

Post a Comment