import org.testng.annotations.*;
/**
* TestNG Dependency Test
*
*/
public class TestNGTest7 {
@Test
public void method1() {
System.out.println("This is method 1");
}
@Test(dependsOnMethods={"method1"})
public void method2() {
System.out.println("This is method 2");
}
}
Result
PASSED: method1
PASSED: method2
The “method2()” will execute only if “method1()” is run successfully, else “method2()” will skip.
No comments:
Post a Comment