如何使用cucumber-jvm-parallel-plugin生成TestNG runner文件?

时间:2018-02-20 10:28:49

标签: selenium selenium-webdriver cucumber testng cucumber-jvm

以下是我的POM文件。所有的配置都是正确的,我无法生成TestNG转轮文件。请帮我做正确的配置。

<build>
    <pluginManagement>
        <plugins>

            <plugin>
                <groupId>com.github.temyers</groupId>
                <artifactId>cucumber-jvm-parallel-plugin</artifactId>
                <version>4.2.0</version>
                <executions>
                    <execution>
                        <id>generateRunners</id>
                        <phase>generate-test-sources</phase>
                        <goals>
                            <goal>generateRunners</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>runner</outputDirectory>
                            <glue>
                                <package>com.compareglobalgroup.stepdefs</package>
                                <package>com.compareglobalgroup.cucumber.hooks</package>
                            </glue>
                            <featuresDirectory>src/test/resources/feature</featuresDirectory>
                            <cucumberOutputDir>target/cucumber-parallel</cucumberOutputDir>
                            <format>json</format>
                            <plugins>
                                <plugin>
                                    <name>json</name>
                                </plugin>
                            </plugins>
                            <tags>
                                <tag>@BBDK</tag>
                            </tags>
                            <useTestNG>true</useTestNG>
                            <!-- <namingScheme>simple</namingScheme> <namingPattern>Parallel{c}TestRunner</namingPattern> -->
                            <parallelScheme>FEATURE</parallelScheme>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.7.0</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.20.1</version>
                <configuration>
                    <forkCount>10</forkCount>
                    <reuseForks>true</reuseForks>
                    <includes>
                        <include>**/Parallel*IT.class</include>
                    </includes>
                    <!-- You can specify a specific testng.xml file here <suiteXmlFiles> 
                        <suiteXmlFile>src/test/resources/testng-sample.xml</suiteXmlFile> </suiteXmlFiles> -->
                    <!-- Or dynamically with something like '-DsuiteXmlFile=src/test/resources/testng-sample.xml' -->
                    <!-- <suiteXmlFiles> <suiteXmlFile>${suiteXmlFile}</suiteXmlFile> </suiteXmlFiles> -->
                    <!-- Build with '-DskipTests=true' to bypass test execution @ build 
                        time Default: false -->
                    <skipTests>false</skipTests>
                    <testFailureIgnore>true</testFailureIgnore>
                    <systemPropertyVariables>
                        <browser>${browser}</browser>
                        <execution>${execution}</execution>
                        <environment>${environment}</environment>
                        <!-- <suiteXmlFile>${suiteXmlFile}</suiteXmlFile> -->
                        <country>${country}</country>
                        <vertical>${vertical}</vertical>
                        <homeUrl>${homeUrl}</homeUrl>
                        <isHeadless>${isHeadless}</isHeadless>
                    </systemPropertyVariables>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>
</build>

1 个答案:

答案 0 :(得分:1)

您需要在

下提供<plugin>条目
<build>
    <plugins>
        <plugin>
        <!-- add your plugin entry here -->
        </plugin>
    </plugins>
</build>

但是你已经在<pluginManagement>下添加了它,它通常用于控制从当前项目继承的项目的插件行为。有关详细信息,请参阅here