0

我想在不同的浏览器(Firefox 和 chrome)中并行运行我的黄瓜 JVM 测试,因为每个浏览器都有如下运行程序文件,然后是我的 pom.xml 设置。

@RunWith(Cucumber.class) @CucumberOptions( format = {"pretty", "html:target/cucumber-report", "json:target/cucumber-report.json"}, features = {"classpath:acceptance/feature" },胶水 = {""},标签 = {"@chrome"},严格 = 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 测试 -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

谁能让我知道我在这里缺少什么?为什么我不能在这里并行踢 2 个单独的跑步者?

任何帮助表示赞赏。

谢谢。

4

1 回答 1

0

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

<includes>
     <include>*Test*.class</include>
</includes>
于 2016-06-23T16:58:12.267 回答