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 MissingGroupSampleTest { 10 11 @Test(dependsOnGroups = {"missing-group"}) 12 public void shouldBeSkipped() { 13 14 } 15 16 @Test(dependsOnGroups = {"missing-group"}, ignoreMissingDependencies=true) 17 public void shouldNotBeSkipped() { 18 19 } 20 21 public static void main(String[] args) throws Exception { 22 TestNG tng = new TestNG(); 23 String xml = "<suite name=\"dgf\" verbose=\"10\"><test name=\"dgf\"><classes><class name=\"test.dependent.MissingGroupSampleTest\"></class></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