我想在不同的浏览器(Firefox和chrome)中并行运行我的cucumberJVM测试,因为我有如下每个浏览器的runner文件,后面跟着我的pom。xml设置。
@RunWith(Cucumber.class) @CucumberOptions( format = {“pretty”, “html:target/cucumber-report”, “json:target/cucumber-report.json”}, features = {“classpath:acceptance/feature”}, glue = {“”}, tags = {“@chrome”}, strict = true)
公共类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 test -Dit.test=AcceptanceITCaseTest1,AcceptanceITCaseTest2 -P test
输出-
测试运行: 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
有人能告诉我这里缺少什么吗?为什么我不能在这里并行踢两个单独的跑步者?
感谢您的帮助。
谢谢。
试着把下面提到的包含在maven-surefire插件的配置块中
<includes>
<include>*Test*.class</include>
</includes>