In this tutorial, we will see how to ignore test case. Sometimes, We need to ignore test cases. In this example, We will ignore WorkflowTest test case.
TestNG comes with annotation @Test and attribute "enabled". We need to make enabled equal to false.
TestNG Ignore Test Case Example
import org.testng.Assert; import org.testng.annotations.Test; public class IgnoreTestCase { @Test public void LoginTest(){ System.out.println("LoginTest test case is Passed"); } @Test(enabled = false) public void WorkflowTest(){ System.out.println(" Ignore this test case."); } @Test public void LogoutTest(){ System.out.println("LogoutTest test case is Passed"); System.out.println(" "); } }
Output: