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