问题
I've couple test features in my project and so far i'm running them in parallel using runner classes with thread count.. but the problem here is optimising execution time because on of these threads taking longer time to finish test scenarios
Is there any better approach to execute test scenarios in parallel??
Any help.. much appreciated!!
回答1:
Take a look at Courgette-JVM
It has added capabilities to run cucumber tests in parallel on a feature level or on a scenario level.
It also provides an option to automatically re-run failed scenarios.
Usage
@RunWith(Courgette.class)
@CourgetteOptions(
threads = 10,
runLevel = CourgetteRunLevel.SCENARIO,
rerunFailedScenarios = true,
showTestOutput = true,
cucumberOptions = @CucumberOptions(
features = "src/test/resources/features",
glue = "steps",
tags = {"@regression"},
plugin = {
"pretty",
"json:target/courgette-report/courgette.json",
"html:target/courgette-report/courgette.html"}
))
public class RegressionTestSuite {
}
回答2:
Try using QAF gherkin it runs scenario in parallel rather than feature. you need to use factory class provided by the framework and configure your execution using testNG xml. Below is the sample config file:
<test name="Gherkin-QAF-Test" parallel="methods">
<parameter name="step.provider.pkg" value="com.qmetry.qaf.automation.impl.step.qaf" />
<parameter name="scenario.file.loc" value="resources/features" />
<classes>
<class name="com.qmetry.qaf.automation.step.client.gherkin.GherkinScenarioFactory" />
</classes>
</test>
Above configuration will run scenarios available in feature files under resources/features
in parallel.
来源:https://stackoverflow.com/questions/40632453/cucumber-test-scenarios-running-in-parallel