如何在Cucumber-JVM中并行运行功能/场景? [英] How to run features/scenarios in Cucumber-JVM in parallel?

查看:1351
本文介绍了如何在Cucumber-JVM中并行运行功能/场景?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一组为Cucumber-JVM编写的验收测试。为了减少反馈时间,我想并行运行场景(一个特性)。

I have a set of acceptance tests written for the Cucumber-JVM. In order to reduce the feedback time I would like to run the scenarios (of a feature) in parallel. How do I do that in the simplest and most convenient way?

(我更喜欢能够在Java代码中表达这一点,作为一个普通的JUnit测试/运行器,也就是说,我不想使用maven-surefire或maven-failsafe插件来解决这个问题,后者需要(?)twiddling和合并Cucumber报告。)

(I would prefer to be able to express this in Java code, as a regular JUnit test/runner, i.e. I would prefer not to resort to some workaround using the maven-surefire or maven-failsafe plugin which would require(?) twiddling and merging of the Cucumber reports afterwards.)

推荐答案

由于cucumber-jvm包的性质,测试并行化暂时受到限制。有未来改变API(gherkin3,cucumber-jvm v2)的暂定计划,但没有什么可用于完全并行化现在在cucumber-jvm。

Due to the nature of the cucumber-jvm package, test parallelization is limited for the time being. There are tentative plans for the future to change the API (gherkin3, cucumber-jvm v2), but nothing is available for full parallelization now on the cucumber-jvm.

还有一种方法可以在cucumber-jvm上实现一定程度的并行性。 Zucchini包( https://github.com/Comcast/Zucchini )可以通过提供上下文级别并行性,如果您必须针对Android / iOS / Chrome /等运行一系列测试,则可以帮助您将测试结果合并到单个报告中。

There is still a way to attain a degree of parallelism on the cucumber-jvm. The Zucchini package (https://github.com/Comcast/Zucchini) can help by providing context-level parallelism, which could help if you have to run a battery of tests against Android / iOS / Chrome / etc. Test results are then merged into a single report.

要开始使用Zucchini,创建一个扩展 AbstractZucchiniTest 的新测试类,并标记为 @CucumberOptions ZucchiniOutput 。然后该类应该实现 List< TestContext>

To start using Zucchini, create a new test class that extends AbstractZucchiniTest and is tagged with @CucumberOptions and ZucchiniOutput. The class should then implement the List<TestContext> getTestContexts() method that returns a list of your specialized contexts.

Zucchini还提供了其他功能,例如跨上下文屏障同步和聚合测试输出到HTML报告中。如果你已经有黄瓜测试,没有太多的参与升级到西葫芦测试。

Zucchini also provides other features such as cross-context barrier synchronization and aggregated test output into an HTML report. If you already have cucumber tests, there isn't much involved in upgrading them to Zucchini tests.

这篇关于如何在Cucumber-JVM中并行运行功能/场景?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆