How to run scenarios in Cucumber-JVM in parallel?(如何在 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 并使用 @CucumberOptions 和 ZucchiniOutput 标记的新测试类.然后该类应该实现 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 中并行运行场景?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何在 Cucumber-JVM 中并行运行场景?
基础教程推荐
- 验证是否调用了所有 getter 方法 2022-01-01
- 如何在 JFrame 中覆盖 windowsClosing 事件 2022-01-01
- Java 实例变量在两个语句中声明和初始化 2022-01-01
- 如何在 Spring @Value 注解中正确指定默认值? 2022-01-01
- 多个组件的复杂布局 2022-01-01
- 从 python 访问 JVM 2022-01-01
- Java Swing计时器未清除 2022-01-01
- 不推荐使用 Api 注释的描述 2022-01-01
- 大摇大摆的枚举 2022-01-01
- 在 Java 中创建日期的正确方法是什么? 2022-01-01
