You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I am using TestNG 7.10 and want to retry failed tests. I have no issues rerunning tests that do not have the dependsOnMethods attribute. However, if a test method with dependsOnMethods fails, I want to rerun it along with all its dependent test methods, even if they previously passed.
public class RerunWithDependenciesTest {
@Test
public void testOne() {
System.out.println("TEST 1");
}
@Test(dependsOnMethods = "testOne", alwaysRun = true)
public void testTwo() {
System.out.println("TEST 2");
}
@Test(dependsOnMethods = {"testOne", "testTwo"})
public void testThree() {
System.out.println("TEST 3");
Asserter.assertThatTrue("TEST 3", false);
}
@Test(dependsOnMethods = {"testOne", "testTwo"})
public void testFour() {
System.out.println("TEST 4");
}
@Test
public void testFive() {
System.out.println("TEST 5");
Asserter.assertThatTrue("TEST 5", false);
}
}
When testThree fails, I want to rerun testOne and testTwo (which previously passed) before rerunning testThree.
I would really appreciate any recommendations on how to achieve this behavior in TestNG.
Thanks!
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi,
I am using TestNG 7.10 and want to retry failed tests. I have no issues rerunning tests that do not have the dependsOnMethods attribute. However, if a test method with dependsOnMethods fails, I want to rerun it along with all its dependent test methods, even if they previously passed.
When testThree fails, I want to rerun testOne and testTwo (which previously passed) before rerunning testThree.
I would really appreciate any recommendations on how to achieve this behavior in TestNG.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions