我们如何实现并行运行的Cucumber JVM测试?

时间:2016-06-21 12:56:10

标签: cucumber-jvm cucumber-java

我想在不同的浏览器(Firefox和Chrome)中并行运行我的黄瓜JVM测试,因为我有每个浏览器的转接文件,然后是我的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)

public class 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

任何人都可以让我知道我在这里缺少什么吗?为什么我不能在这里并行踢出两个独立的跑步者?

感谢任何帮助。

感谢。

1 个答案:

答案 0 :(得分:0)

尝试在maven-surefire插件的配置块中添加下面提到的包含

<includes>
     <include>*Test*.class</include>
</includes>