我在src/test/resources/ feature /中有下面的特性文件(单独的特性文件),我想并行运行它们。比如:一个特性文件必须在chrome中执行,另一个特性文件必须在firefox中执行,就像前面提到的@标记名称一样。
Feature: Refund item
@chrome
Scenario: Jeff returns a faulty microwave
Given Jeff has bought a microwave for $100
And he has a receipt
When he returns the microwave
Then Jeff should be refunded $100
Feature: Refund Money
@firefox
Scenario: Jeff returns the money
Given Jeff has bought a microwave for $100
And he has a receipt
When he returns the microwave
Then Jeff should be refunded $100有人能帮我做到这一点吗?我用的是黄瓜-java 1.2.2版本,AbstractTestNGCucumberTests用的是跑步。另外,让我知道如何使用特性文件动态创建测试运行程序,并使它们并行运行。
发布于 2016-12-12 11:43:26
更新: 4.0.0版本可在maven中央存储库中获得,其中包含大量更改.更多细节请看这里。
更新: 2.2.0版本可在maven中央存储库获得。
您可以使用开源插件黄瓜-jvm-并行插件,它与现有解决方案相比有许多优点。可在maven 存储库上获得
<dependency>
<groupId>com.github.temyers</groupId>
<artifactId>cucumber-jvm-parallel-plugin</artifactId>
<version>2.1.0</version>
</dependency><forkCount>n</forkCount> 'n‘与高级硬件支持成正比;2)可用节点,即注册的浏览器实例到集线器。Really large (>50 node) Hub installations may need to increase the jetty threads by setting -DPOOL_MAX=512 (or larger) on the java command line.
java -jar selenium-server-standalone-<version>.jar -role hub -DPOOL_MAX=512发布于 2016-12-09 06:13:55
黄瓜不支持开箱即用并行执行。我试过了,但这不友好。
发布于 2016-12-09 17:51:50
如果您所期望的是能够并行运行多个特性,那么您可以尝试执行以下操作:
parallel=true设置为@DataProvider注释的方法。由于来自TestNG的默认TestNG是10,现在您已经指示TestNG并行运行features,您应该开始看到您的特性文件被并行执行。
但是我知道Cucumber报告本身并不是线程安全的,所以您的报告可能会出现错误。
https://stackoverflow.com/questions/41034116
复制相似问题