The “Dependency Test” means methods are test base on dependency. If the dependent method fails, all the subsequent test methods will be skipped, not marked as failed.TestNG uses “dependOnMethods” to implement the dependency testing as following
package com.javaskool;
import org.testng.annotations.Test;
public class TestExample {
@Test(dependsOnMethods={"method2"})
public void method1() {
System.out.println("This is method 1");
}
@Test
public void method2() {
System.out.println("This is method 2");
}
}
Click here to download example with jar files.[4.5 MB]
Recent Comments