TestNG-ThreadCount Suite Level vs Test level

If Thread Count is mentioned in both suite and test, which one actually taken into consideration?

<suite name="Suite1" thread-count="5" verbose="1">

@Test(invocationCount = 5,threadPoolSize =3)

suite.xml: Thread count is mentioned as 5

ValidateInvocationcount.java : threadPoolSize=3

Below is the execution result

running 0 20 running 0 18 running 0 19 running 3 20 running 4 18

=============================================== Suite1 Total tests run: 5, Passes: 5, Failures: 0, Skips: 0

Explanation :face_with_monocle:

  1. Test case is executed 5 times as invocationCount mentioned as 5
  2. There are only 3 active threads 18,19 and 20. This means the Suite thread count is overrriden by the Test threadpool value

Happy Testing!

1 Like