|
31 | 31 | import org.testng.internal.ExitCode;
|
32 | 32 | import org.testng.internal.IConfiguration;
|
33 | 33 | import org.testng.internal.ListenerOrderDeterminer;
|
| 34 | +import org.testng.internal.ObjectBag; |
34 | 35 | import org.testng.internal.OverrideProcessor;
|
35 | 36 | import org.testng.internal.ReporterConfig;
|
36 | 37 | import org.testng.internal.RuntimeBehavior;
|
@@ -609,6 +610,14 @@ public boolean isPropagateDataProviderFailureAsTestFailure() {
|
609 | 610 | return this.m_configuration.isPropagateDataProviderFailureAsTestFailure();
|
610 | 611 | }
|
611 | 612 |
|
| 613 | + public void shareThreadPoolForDataProviders(boolean flag) { |
| 614 | + this.m_configuration.shareThreadPoolForDataProviders(flag); |
| 615 | + } |
| 616 | + |
| 617 | + public boolean isShareThreadPoolForDataProviders() { |
| 618 | + return this.m_configuration.isShareThreadPoolForDataProviders(); |
| 619 | + } |
| 620 | + |
612 | 621 | /**
|
613 | 622 | * Set the suites file names to be run by this TestNG object. This method tries to load and parse
|
614 | 623 | * the specified TestNG suite xml files. If a file is missing, it is ignored.
|
@@ -1082,6 +1091,7 @@ public void run() {
|
1082 | 1091 | m_end = System.currentTimeMillis();
|
1083 | 1092 |
|
1084 | 1093 | if (null != suiteRunners) {
|
| 1094 | + suiteRunners.forEach(ObjectBag::cleanup); |
1085 | 1095 | generateReports(suiteRunners);
|
1086 | 1096 | }
|
1087 | 1097 |
|
@@ -1186,6 +1196,9 @@ public List<ISuite> runSuitesLocally() {
|
1186 | 1196 | // First initialize the suite runners to ensure there are no configuration issues.
|
1187 | 1197 | // Create a map with XmlSuite as key and corresponding SuiteRunner as value
|
1188 | 1198 | for (XmlSuite xmlSuite : m_suites) {
|
| 1199 | + if (m_configuration.isShareThreadPoolForDataProviders()) { |
| 1200 | + xmlSuite.setShareThreadPoolForDataProviders(true); |
| 1201 | + } |
1189 | 1202 | createSuiteRunners(suiteRunnerMap, xmlSuite);
|
1190 | 1203 | }
|
1191 | 1204 |
|
@@ -1454,6 +1467,8 @@ public static TestNG privateMain(String[] argv, ITestListener listener) {
|
1454 | 1467 | * @param cla The command line parameters
|
1455 | 1468 | */
|
1456 | 1469 | protected void configure(CommandLineArgs cla) {
|
| 1470 | + Optional.ofNullable(cla.shareThreadPoolForDataProviders) |
| 1471 | + .ifPresent(this::shareThreadPoolForDataProviders); |
1457 | 1472 | Optional.ofNullable(cla.propagateDataProviderFailureAsTestFailure)
|
1458 | 1473 | .ifPresent(value -> propagateDataProviderFailureAsTestFailure());
|
1459 | 1474 | setReportAllDataDrivenTestsAsSkipped(cla.includeAllDataDrivenTestsWhenSkipping);
|
|
0 commit comments