1 package test.regression; 2 3 import org.testng.Assert; 4 import org.testng.TestListenerAdapter; 5 import org.testng.TestNG; 6 import org.testng.annotations.Test; 7 8 import test.SimpleBaseTest; 9 10 public class BeforeTestFailingTest extends SimpleBaseTest { 11 12 @Test beforeTestFailingShouldCauseSkips()13 public void beforeTestFailingShouldCauseSkips() { 14 TestNG tng = create(MyTestngTest2.class); 15 TestListenerAdapter tla = new TestListenerAdapter(); 16 tng.addListener(tla); 17 tng.run(); 18 19 Assert.assertEquals(tla.getSkippedTests().size(), 1); 20 Assert.assertEquals(tla.getPassedTests().size(), 0); 21 } 22 } 23