Write three TestNG test methods and ignore a specific test method.
Create a new test class named “Ignore Test”. Create three test methods “testMethod1”, “testMethod2” and “testMethod3”.
Use the ‘enabled=false’ attribute to ignore the second test. Now execute the test suite to observe that the second test method “testMethod2” is skipped.
package practice;
import org.testng.annotations.Test;
public class IgnoreTest {
@Test
public void testMethod1() {
System.out.println("I am test Method 1");
//write code
}
@Test(enabled=false)
public void testMethod2() {
System.out.println("I am test Method 2");
//write code
}
@Test
public void testMethod3() {
System.out.println("I am test Method 3");
//write code
}
}
Copyright © 2023 - Proleed Academy | All Rights Reserved.