Let us say test1 method depends on test2 method.
Hard dependencies
In this type of dependency, if test2 fails, test1 is not executed and marked as Skipped. This is the default dependency.
Soft dependencies
In this type of dependency, even if test2 fails, test1 is executed. This is achieved by adding alwaysRun=true as shown in below example.
@Test(dependsOnMethods = "org.softpost.Class2.test2", alwaysRun = true) // we can make the test //dependent even from different class by mentioning the class and test name
public void test1(){
System.out.println("Test1 from Class1");
}
Hard dependencies
In this type of dependency, if test2 fails, test1 is not executed and marked as Skipped. This is the default dependency.
Soft dependencies
In this type of dependency, even if test2 fails, test1 is executed. This is achieved by adding alwaysRun=true as shown in below example.
@Test(dependsOnMethods = "org.softpost.Class2.test2", alwaysRun = true) // we can make the test //dependent even from different class by mentioning the class and test name
public void test1(){
System.out.println("Test1 from Class1");
}
No comments:
Post a Comment