如何在Cucumber-JVM中并行运行方案? [英] How to run scenarios in Cucumber-JVM in parallel?
问题描述
我有一组针对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插件采取一些变通办法,这之后需要(?)整理和合并黄瓜报告。)
(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),但是现在在cumulage-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.
仍然有一种方法可以使黄瓜jvm达到一定程度的并行性。 Zucchini软件包( https://github.com/Comcast/Zucchini )可以通过提供上下文级别来提供帮助并行性,如果您必须对Android / iOS / Chrome / etc等进行一系列测试,这可能会有所帮助。然后将测试结果合并到一个报告中。
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报告中。如果您已经有黄瓜测试,那么将它们升级到西葫芦测试并不需要太多。
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屋!