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

查看:24
本文介绍了如何在 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 测试/运行程序,即我不希望使用需要(?) 之后对 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 并使用 @CucumberOptionsZucchiniOutput 标记的新测试类.然后该类应该实现 List<TestContext>getTestContexts() 方法返回您的专用上下文列表.

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 报告中.如果您已经进行了 Cucumber 测试,那么将它们升级到 Zucchini 测试并没有什么太大的关系.

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天全站免登陆