Cucumber test scenarios running in parallel?

梦想与她 提交于 2019-12-12 04:29:39

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!