1 package test; 2 3 import org.testng.Assert; 4 import org.testng.SkipException; 5 import org.testng.annotations.Test; 6 7 /** 8 * Use this test to show run/failed/skip result 9 * differences between testng-5.12 and testng-5-14 10 * 11 * @author CA Technologies 12 */ 13 14 15 public class CountSampleTest { 16 17 @Test(groups = {"functional"}) testInvokedAndSkipped()18 public void testInvokedAndSkipped() throws SkipException { 19 // System.out.println("Skipping this test after it is invoked."); 20 throw new SkipException("This test is skipped after invocation"); 21 } 22 23 @Test(groups = {"functional"}) testInvokedAndFailed()24 public static void testInvokedAndFailed() { 25 // System.out.println("Failing this test after it is invoked."); 26 Assert.fail("Failing this test on purpose"); 27 } 28 29 @Test(groups = {"functional"}, dependsOnMethods = {"testInvokedAndFailed"}) testWillNotBeInvokedOnlySkipped()30 public static void testWillNotBeInvokedOnlySkipped() { 31 // System.out.println("This test will be skipped, " + 32 // "but not invoked because its dependsOnMethod fails."); 33 } 34 } 35