TestNG combine method threadCount and dataProviderThreadCount

32 Views Asked by At

I'm using the maven-failsafe-plugin to run testNG tests. It has threadCount configuration for methods and also dataproviderthreadcount property. Tests are run on physical devices, so threadCount * dataproviderthreadcount can't exceed the number of devices I have. When tests without data provider are run, I underutilize my resources. Can the number of thread counts be set for both method and data provider?

1

There are 1 best solutions below

0
Krishnan Mahadevan On

You can now do this if you use the latest released version of TestNG viz., 7.9.0

This version of TestNG provides two new attributes for controlling the thread pool size.

Quoting the documentation

  • use-global-thread-pool - When this attribute is set to true at the suite level, TestNG will start using a common thread pool for running both your regular test methods and data driven test methods. The size of the thread pool is determined using the attribute thread-count. This attribute has a default value of false.
  • share-thread-pool-for-data-providers - When this attribute is set to true at the suite level, TestNG will start using a shared thread pool for all the data driven tests in a given <suite>. The size of the thread pool is determined using the attribute data-provider-thread-count. This attribute has a default value of false.

More details are available at https://testng.org/#_controlling_threadpool_usage