How to run cucumber jvm test scenarios in parallel using Gradle?

ε祈祈猫儿з 提交于 2019-12-10 21:35:26

问题


I couldn't find best solution for running cucumber test scenarios in parallel using gradle

The best possible solution found so far is this.. but I can't run it locally successfully

Any help much appreciated!!

Thanks in advance.


回答1:


Take a look at Courgette-JVM

You can execute this with a gradle task.

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:


You should try gherkin client of QMetry Automation Framework. By using it you can run individual scenario in parallel. You will get features like TestNG xml run configuration, detailed reporting, parallel execution, step listener and many more.

In order to convert existing cucumber-jvm project to QAF following are the stpes:

  • Download blank project QAF-bank-project ANT+IVY or qaf-blank-project-gradle or qaf-blank-project-maven
  • Copy your features files into scenario directory
  • Copy your java src files into src directory
  • Place @QAFTestStepProvider annotation at class defining cucumber steps
  • Create XML configuration file and run. You will find sample xml configuration file under config dir. For Gherkin your config file should look like below:
<test name="Gherkin-QAF-Test">
   <parameter name="step.provider.pkg" value="your.pkg.where.steps.defined" />
   <parameter name="scenario.file.loc" value="resources/features" />
   <classes>
      <class name="com.qmetry.qaf.automation.step.client.gherkin.GherkinScenarioFactory" />
   </classes>
</test>

You can use tags as groups for run-configuration-filter and all other TestNG and QAF features.



来源:https://stackoverflow.com/questions/42513907/how-to-run-cucumber-jvm-test-scenarios-in-parallel-using-gradle

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