我们如何实现并行运行的Cucumber JVM测试? [重复]

这个问题在这里已有答案:

我想在不同的浏览器(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)

公共类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)

3 years ago

尝试将下面提到的 includes 放在maven-surefire插件的 configuration 块中

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