我想在不同的瀏覽器(Firefox和Chrome)上並行運行我的黃瓜JVM測試,因爲我的runner文件如下所示,然後是我的pom.xml設置。我們如何才能實現Cucumber JVM測試並行運行?
@RunWith(Cucumber.class) @CucumberOptions( 格式= { 「漂亮」, 「HTML:目標/黃瓜報告」, 「JSON:目標/黃瓜-report.json」}, 特徵= { 「類路徑:接受/特徵」}, 膠水= { 「」}, 標籤= { 「@chrome」}, 嚴格=真)
公共類AcceptanceITCaseTest2 {
@AfterClass
public static void afterClass() {
if(getDriver()!=null) {
getDriver().manage().deleteAllCookies();
getDriver().quit();
}
}
}
的pom.xml
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>add-integration-test-sources</id>
<phase>generate-test-sources</phase>
<goals>
<goal>add-test-source</goal>
</goals>
<configuration>
<sources>
<source>src/test/ac/java/acceptance</source>
<source>src/test/ac/java</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>enter code here
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.19.1</version>
<executions>
<execution>
<id>acceptance-tests</id>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<parallel>classes</parallel>
<forkCount>2</forkCount>
<reuseForks>false</reuseForks>
<useFile>false</useFile>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
</execution>
</executions>
</plugin>
命令:
MVN測試-Dit.test = AcceptanceITCaseTest1,AcceptanceITCaseTest2 -P測試
輸出 -
試驗運行:0,故障:0,錯誤:0,跳過:0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 15.002s
[INFO] Finished at: Tue Jun 21 13:43:59 BST 2016
[INFO] Final Memory: 27M/260M
有人可以請求嗎讓我知道我在這裏失蹤了什麼?爲什麼我無法在這裏平行踢兩個單獨的跑步者?
任何幫助表示讚賞。
謝謝。
希望這將幫助你:https://opencredo.com/running-cucumber-jvm- test-in-parallel/ –
已經看到了這個頁面,但是這似乎創建了跑步者文件運行時間,這對我們沒有幫助。 我們正在使用黃瓜JVM框架,並且我們需要嚴格地在不同的瀏覽器上執行腳本,我們需要單獨的runner文件。 感謝您的回覆。 – notsogoodcoder
你好,看看http://stackoverflow.com/a/41100104/2895913我已經詳細解釋過了。 –