[SUREFIRE-2075] Only set thread count if specified in configuration by sbabcoc · Pull Request #528 · apache/maven-surefire (original) (raw)
@Tibor17 The [threadCount] value is ignored if not running in parallel mode;
from [org.testng.TestRunner] in TestNG 7.3 : int threadCount = parallel ? xmlTest.getThreadCount() : 1;
(In the implementation of xmlTest.getThreadCount(), if [threadCount] is explicitly specified in XmlTest, this value is used; otherwise, the value is acquired from XmlSuite.)
In TestNG 5.1, tests are executed on the main thread when running in sequential mode.
I'm not clear why a default thread count of 5 doesn't make sense for parallel configurations. Setting the default value to 1 is what doesn't make sense to me, because this will produce sequential execution behavior in configurations that specify parallel execution unless a thread count value is also specified.
As it's currently implemented, the base Surefire TestNG configurator overrides the default thread count value established by the TestNG framework, altering the default parallel execution behavior. This default value imposed by TestNGMapConfigurator also contradicts the Surefire documentation.
With my revisions in place, the documented default thread count is used, and all of the unit tests and integration tests complete successfully.