Ignore a Test in JUnit

In JUnit, @Ignore annotation is used to skip or ignore a test case/ test method if it is not ready to test. We need to import a statement “import org.junit.Ignore;” when working with @Ignore.

Example:

import org.junit.Ignore;
import org.junit.Test;
public class JUnitEamples {
	
	@Ignore("Im Not Ready")
	@Test
	public void testCaseAccounting(){
			System.out.println("I’m not ready, please don't execute me");
		}
	
	@Test
	public void testCaseBanking(){
			System.out.println("I’m ready to execute");
		}
}

When we execute the above program, it will give the output as “2 test methods” executed.
Test method : testCaseAccounting – Ignored
Test method : testCaseBanking - Passed

Please find the below output of the above program.
ignore test in Junit

Test Frameworks: 

Add new comment

CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.