我一直在繞圈試圖弄清楚這一點,似乎幾乎不可能使用maven並行選項來對抗Selenium Grid羣集。使用Maven Surefire進行並行Cucumber-JVM Selenium Grid測試
我的跑步者基於標籤運行,應該選取5或6個功能文件。
我使用Cucumber for Java,使用Maven surefire 2.19和Junit。
到目前爲止,我對POM萬無一失的配置是這樣的: -
<profile>
<id>RunFeature</id>
<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire.version}</version>
<configuration>
<threadCount>5</threadCount>
<parallel>methods</parallel>
<systemProperties>
<property>
<name>environmentName</name>
</property>
</systemProperties>
<includes>
<include>**/RunFeature.java</include>
</includes>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
</plugin>
</plugins>
</build>
</profile>
我的亞軍是這樣的: -
@RunWith(Cucumber.class)
@CucumberOptions(
plugin = {"json:target/cucumber.json"},
features = "classpath:",
glue = "classpath:",
dryRun = false,
strict = true)
public class RunFeature {
}
我正與與Maven運行: -
clean test -P RunFeature -D environmentName =「DEV」 -Dcucumber.options =「 - tags @runnable --tags @ testa - tags @testb 「
這是堆棧跟蹤: -
java.util.ConcurrentModificationException
at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:901)
at java.util.ArrayList$Itr.next(ArrayList.java:851)
at cucumber.runtime.RuntimeOptions$1.invoke(RuntimeOptions.java:287)
at com.sun.proxy.$Proxy17.feature(Unknown Source)
at cucumber.runtime.junit.JUnitReporter.feature(JUnitReporter.java:165)
at cucumber.runtime.junit.FeatureRunner.run(FeatureRunner.java:69)
at cucumber.api.junit.Cucumber.runChild(Cucumber.java:93)
at cucumber.api.junit.Cucumber.runChild(Cucumber.java:37)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.apache.maven.surefire.junitcore.pc.Scheduler$1.run(Scheduler.java:387)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Feature: Buyer guidelines on buyer detailscucumber.runtime.CucumberException: Expected step: "I login to testing as "testingUser"" got step: "I switch to the "System" tab"
at cucumber.runtime.junit.JUnitReporter.fetchAndCheckRunnerStep(JUnitReporter.java:71)
at cucumber.runtime.junit.JUnitReporter.match(JUnitReporter.java:61)
at cucumber.runtime.Runtime.runStep(Runtime.java:278)
at cucumber.runtime.model.StepContainer.runStep(StepContainer.java:44)
at cucumber.runtime.model.StepContainer.runSteps(StepContainer.java:39)
at cucumber.runtime.model.CucumberScenario.runBackground(CucumberScenario.java:59)
at cucumber.runtime.model.CucumberScenario.run(CucumberScenario.java:42)
at cucumber.runtime.junit.ExecutionUnitRunner.run(ExecutionUnitRunner.java:91)
at cucumber.runtime.junit.FeatureRunner.runChild(FeatureRunner.java:63)
at cucumber.runtime.junit.FeatureRunner.runChild(FeatureRunner.java:18)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at cucumber.runtime.junit.FeatureRunner.run(FeatureRunner.java:70)
at cucumber.api.junit.Cucumber.runChild(Cucumber.java:93)
at cucumber.api.junit.Cucumber.runChild(Cucumber.java:37)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.apache.maven.surefire.junitcore.pc.Scheduler$1.run(Scheduler.java:387)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
java.util.ConcurrentModificationException
at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:901)
at java.util.ArrayList$Itr.next(ArrayList.java:851)
at cucumber.runtime.RuntimeOptions$1.invoke(RuntimeOptions.java:287)
at com.sun.proxy.$Proxy17.feature(Unknown Source)
at cucumber.runtime.junit.JUnitReporter.feature(JUnitReporter.java:165)
at cucumber.runtime.junit.FeatureRunner.run(FeatureRunner.java:69)
at cucumber.api.junit.Cucumber.runChild(Cucumber.java:93)
at cucumber.api.junit.Cucumber.runChild(Cucumber.java:37)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.apache.maven.surefire.junitcore.pc.Scheduler$1.run(Scheduler.java:387)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
java.util.ConcurrentModificationException
at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:901)
at java.util.ArrayList$Itr.next(ArrayList.java:851)
at cucumber.runtime.RuntimeOptions$1.invoke(RuntimeOptions.java:287)
at com.sun.proxy.$Proxy17.uri(Unknown Source)
at cucumber.runtime.junit.JUnitReporter.uri(JUnitReporter.java:160)
at cucumber.runtime.junit.FeatureRunner.run(FeatureRunner.java:68)
at cucumber.api.junit.Cucumber.runChild(Cucumber.java:93)
at cucumber.api.junit.Cucumber.runChild(Cucumber.java:37)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.apache.maven.surefire.junitcore.pc.Scheduler$1.run(Scheduler.java:387)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
我不知道在哪裏可以從這裏走。
cucumber-jvm中的記者不是線程安全的,所以這不太可能。您可以嘗試使用多個跑步者進行分組測試,並在課堂級別配置並行執行。 我感覺真的很冒險,你可以嘗試這個重新實現黃瓜:https://github.com/jhorstmann/zuchini(免責聲明:由我創建) 文檔仍然缺乏,但它應該是主要兼容的,存儲庫中有一些示例。 –
另一個更容易(而不是更好)的解決方案可能是使用多個寫入不同報告的跑步者。每個功能文件都可以擁有自己的跑步者... – Dude
看看http://stackoverflow.com/a/41100104/2895913詳細解釋。 –