Hello everyone,
On behalf of the TestNG Dev team,I am pleased to announce the availability of TestNG 7.9.0 org.testng:testng:7.9.0
TestNG 7.9.0 is now available in Maven Central.
Contributors who helped make TestNG become better in this release:
Special thanks go to:
In this release, we spent time squashing some bugs (Please see below for a full list of issues that were fixed)
We also pushed in some interesting new features into this release.
Traditionally TestNG spins off a data driven test in its own thread pool.
Lets say we have the following as a scenario:
parallel="methods"
in the <suite>
.parallel
.For this scenario, TestNG would spin off totally 6 threads.
This becomes more complex when we have a lot of data driven test methods and we would like to control our parallel execution.
We can now instruct TestNG to share a common thread pool across all data driven tests using one of the two approaches:
-shareThreadPoolForDataProviders true
share-thread-pool-for-data-providers=true
[ Remember to update your suite file to point to the newer DTD at https://testng.org/testng-1.1.dtd
]With this new configuration enabled and for the above scenario, TestNG will always spin off ONLY 3 threads for the entire suite ( because that’s the thread pool size defined via the data provider thread count attribute ) and run the 6 methods ( 2 methods with 3 iterations each) in this global thread pool of size 3.
For more information, please refer to the official documentation
TestNG now allows you to configure it to use a common thread pool which will be shared amongst both your regular test methods and your data driven test methods for a given <suite>
. This can be done via one of the below two approaches:
-useGlobalThreadPool true
use-global-thread-pool=true
[ Remember to update your suite file to point to the newer DTD at https://testng.org/testng-1.1.dtd
]Lets say we have the following as a scenario:
parallel="methods"
in the <suite>
.parallel
.With this new configuration enabled and for the above scenario, TestNG will always spin off ONLY 3 threads for the entire suite ( because that’s the thread pool size defined via the thread count attribute ) and run the 4 methods ( 1 method with 3 iterations and 1 regular method) in this global thread pool of size 3.
For more information, please refer to the official documentation
Remember: When using this feature, you need to ensure that you have a properly sized thread pool for running your tests (both regular and data driven tests), else your tests may stall for a long time.
For both these two new features to work it’s important that we run with the custom thread pool implementation in TestNG as disabled. From this release onwards the custom thread pool implementation [ which can be turned ON via the JVM argument -Dtestng.favor.custom.thread-pool.executor=true
] should be disabled. This implementation is going to go away in the next release and its existence shouldn’t be evident to your regular executions.