Reputation: 644
I am using Maven SureFire, TestNG (extending AbstractTestNGCucumberTests) and Cucumber and have several feature files which each have several scenarios. I want to be able to run each scenario in a feature file in parallel but only one feature file at a time. Is this possible?
So to give an example:
Feature file 1
Scenario 1a
Scenario 1b
Scenario 1c
Feature file 2
Scenario 2a
Scenario 2b
Feature file 3
Scenario 3a
Scenario 3b
Scenario 3c
Scenario 3d
I want Scenarios 1a, 1b and 1c to run in parallel in feature file 1. Once those are complete run Scenarios 2a and 2b from feature 2 etc.
This is the test class that runs all scenarios from all features files at once currently.
@CucumberOptions (
plugin = {
"html:target/cucumber-reports",
"json:target/cucumber.json",
"usage:target/cucumber-usage.json"
},
tags = "not @disabled",
monochrome = true,
features = {
"src/test/resources/features/feature1.feature",
"src/test/resources/features/feature2.feature",
"src/test/resources/features/feature3.feature",
})
public class AllTests extends AbstractTestNGCucumberTests {
@Override
@DataProvider(parallel = true)
public Object[][] scenarios() {
return super.scenarios();
}
}
Is this possible using configuration
Thanks, Scott.
Upvotes: 1
Views: 1601
Reputation: 14746
This is not possible merely with configurations. The reason I say this is because you are expecting a multi level parallel execution strategy from within just a @DataProvider
which is NOT possible in TestNG as of today. You would need to leverage a suite xml file for controlling the parallel execution strategy at a higher level, which can then be tweaked at a lower level by leveraging a @DataProvider
coupled with a parallel
attribute.
The easiest way of getting this done is to do the following:
parallel = true
in your @DataProvider
Upvotes: 3