testng: Parallel=methods not working when tests have different priorities set

TestNG Version : 6.11

Expected behavior

Irrespective of priority, all testcases should run in parallel if executors are available.

Actual behavior

It waits for higher priority testcase to complete and then starts testcase on another thread.

Test case sample

This is sample class

public class SimpleTest {
	@Test(priority = 1)
	public void test1() throws InterruptedException {
		System.out.println("Test 1:::Start::" + new Date());
		System.out.println("Test 1:::Thread::" + Thread.currentThread().getName());
		Thread.sleep(3000);
		System.out.println("Test 1:::End::" + new Date());

	}

	@Test(priority = 2)
	public void test2() throws InterruptedException {
		System.out.println("Test 2:::Start::" + new Date());
		System.out.println("Test 2:::Thread::" + Thread.currentThread().getName());
		Thread.sleep(3000);
		System.out.println("Test 2:::End::" + new Date());
	}
}

This is my config file

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Testng Issue" verbose="0" >
	<test name="1" enabled="true" parallel="methods">
		<classes>
			<class name="com.methodparalleltest.SimpleTest"></class>
		</classes>
	</test>
</suite>

Sample Output:

Test 1:::Start::Mon Jul 17 20:25:22 IST 2017
Test 1:::Thread::TestNG-test=1-1
Test 1:::End::Mon Jul 17 20:25:25 IST 2017
Test 2:::Start::Mon Jul 17 20:25:25 IST 2017
Test 2:::Thread::TestNG-test=1-2
Test 2:::End::Mon Jul 17 20:25:28 IST 2017

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 1
  • Comments: 17 (14 by maintainers)

Commits related to this issue

Most upvoted comments

@juherr I just tried it with 6.14.3 and still have issues.