1 package test.dependent; 2 3 import org.testng.TestNG; 4 import org.testng.annotations.Test; 5 import org.testng.xml.Parser; 6 7 import java.io.ByteArrayInputStream; 8 9 public class MissingMethodSampleTest { 10 11 @Test(dependsOnMethods="missingMethod", ignoreMissingDependencies=true) explicitlyIgnoreMissingMethod()12 public void explicitlyIgnoreMissingMethod() { 13 14 } 15 16 @Test(dependsOnMethods="missingMethod", alwaysRun=true) alwaysRunDespiteMissingMethod()17 public void alwaysRunDespiteMissingMethod() {} 18 main(String[] args)19 public static void main(String[] args) throws Exception { 20 TestNG tng = new TestNG(); 21 String xml = "<suite name=\"dgf\" verbose=\"10\"><test name=\"dgf\"><classes>" + 22 "<class name=\"test.dependent.MissingMethodSampleTest\"/>" + 23 "</classes></test></suite>"; 24 System.out.println(xml); 25 ByteArrayInputStream is = new ByteArrayInputStream(xml.getBytes()); 26 tng.setXmlSuites(new Parser(is).parseToList()); 27 tng.run(); 28 } 29 } 30