testng: Parallel (methods) execution with dependsOn running in unexpected order
Stackoverflow reference here: http://stackoverflow.com/questions/41253297
I’m trying to run tests with parallel methods. Method3 is not waiting for method1 to complete. It appears to wait for method2 to complete, but I’m not sure why.
TestNG Version
6.10
Expected behavior
Output should be
Starting method1
Starting method2
Ending method2
Ending method1
Starting method3
Ending method3
Actual behavior
Output is:
Starting method1
Starting method2
Ending method2
Starting method3
Ending method3
Ending method1
Is the issue reproductible on runner?
- Shell
- Maven
- Gradle
- Ant
- Eclipse
- IntelliJ
- NetBeans
Test case sample
public class TestClass {
@Test(groups = { "groupA" })
public void method1() throws InterruptedException {
System.out.println("Starting method1");
Thread.sleep(1000 * 10); // wait 10 seconds
System.out.println("Ending method1");
}
@Test(groups = { "groupB" })
public void method2() throws InterruptedException {
System.out.println("Starting method2");
Thread.sleep(1000 * 2); // wait 2 seconds
System.out.println("Ending method2");
}
@Test(groups = "groupB", dependsOnGroups = { "groupA" })
public void method3() throws InterruptedException {
System.out.println("Starting method3");
Thread.sleep(1000 * 2); // wait 2 seconds
System.out.println("Ending method3");
}
}
testng.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Suite" parallel="methods" thread-count="5">
<test name="Test">
<classes>
<class name="com.testngGroup.TestClass"></class>
</classes>
</test>
</suite>
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 2
- Comments: 16 (8 by maintainers)
Leaving a note for myself and future fixers: this is an important issue which we should fix as soon as possible.