黄瓜测试场景并行运行?

时间:2016-11-16 12:42:18

标签: multithreading selenium selenium-webdriver cucumber cucumber-jvm

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

是否有更好的方法可以并行执行测试场景?

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

2 个答案:

答案 0 :(得分: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 {
    }

答案 1 :(得分: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下的功能文件中可用的方案。

相关问题