首页 文章

黄瓜测试场景并行运行?

提问于
浏览
0

我在我的项目中有几个测试功能,到目前为止,我正在使用带有线程计数的运行程序并行运行它们 . 但问题是优化执行时间,因为这些线程需要更长的时间才能完成测试场景

有没有更好的方法来并行执行测试场景?

任何帮助..非常感谢!!

2 回答

  • 1

    看看Courgette-JVM

    它增加了在功能级别或场景级别上并行运行黄瓜测试的功能 .

    它还提供自动重新运行失败方案的选项 .

    用法

    @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 {
        }
    
  • 0

    尝试使用QAF gherkin它并行运行场景而不是功能 . 您需要使用框架提供的工厂类,并使用testNG xml配置执行 . 下面是示例配置文件:

    <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>
    

    以上配置将并行运行 resources/features 下的功能文件中可用的方案 .

相关问题