当在Maven中引入Allure argLines时,黄瓜JVM并行插件不会生成预期的JSON报告文件

时间:2018-10-03 19:15:41

标签: cucumber-jvm allure cucumber-java

我正在与:

  • cucumber-jvm-parallel-plugin(使用Maven项目)
  • 魅力报告

概念参考证明:github/POC_CucumberJvmPPNotWorkingWithAllureInPOM

pom.xml:

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>

    <!-- Versioning -->
    <aspectj.version>1.9.1</aspectj.version>

</properties>


<build>
    <plugins>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.0</version>

            <configuration>
                <encoding>${project.build.sourceEncoding}</encoding>
                <source>${maven.compiler.source}</source>
                <target>${maven.compiler.target}</target>
            </configuration>

        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.22.0</version>

            <configuration>
                <argLine>
                     -javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"
                     -Dcucumber.options="--plugin io.qameta.allure.cucumber3jvm.AllureCucumber3Jvm"
                </argLine>
                <parallel>all</parallel>
                <forkCount>5</forkCount>
                <reuseForks>true</reuseForks>
                <testFailureIgnore>true</testFailureIgnore>
                <includes>
                    <include>**/*IT.class</include>
                </includes>
            </configuration>
        </plugin>

        <plugin>
            <groupId>com.github.temyers</groupId>
            <artifactId>cucumber-jvm-parallel-plugin</artifactId>
            <version>5.0.0</version>
            <executions>
                <execution>
                    <id>generateRunners</id>
                    <phase>generate-test-sources</phase>
                    <goals>
                        <goal>generateRunners</goal>
                    </goals>
                    <configuration>

                        <glue>
                            <package>stepDefinitions</package>
                        </glue>

                        <outputDirectory>
                            ${project.build.directory}/generated-test-sources/cucumber-jvm-parllel-plugin
                        </outputDirectory>
                        <featuresDirectory>
                            src/test/resources/features/
                        </featuresDirectory>
                        <cucumberOutputDir>
                            ${project.build.directory}/cucumber-jvm-parallel-plugin/json
                        </cucumberOutputDir>

                        <plugins>
                            <plugin>
                                <name>json</name>
                            </plugin>
                        </plugins>

                        <strict>true</strict>
                        <monochrome>true</monochrome>
                        <useTestNG>true</useTestNG>
                        <namingScheme>simple</namingScheme>
                        <namingPattern>Parallel{c}IT</namingPattern>
                        <parallelScheme>FEATURE</parallelScheme>
                    </configuration>
                </execution>
            </executions>
        </plugin>

    </plugins>
</build>

<dependencies>



    <!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-java -->
    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-java</artifactId>
        <version>4.0.0</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-jvm -->
    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-jvm</artifactId>
        <version>4.0.0</version>
        <type>pom</type>
    </dependency>

    <!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-picocontainer -->
    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-picocontainer</artifactId>
        <version>4.0.0</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-jvm-deps -->
    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-jvm-deps</artifactId>
        <version>1.0.6</version>
        <scope>provided</scope>
    </dependency>


    <!-- https://mvnrepository.com/artifact/io.cucumber/gherkin -->
    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>gherkin</artifactId>
        <version>5.1.0</version>
    </dependency>


    <!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-testng -->
    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-testng</artifactId>
        <version>4.0.0</version>
    </dependency>

    <dependency>
        <groupId>org.testng</groupId>
        <artifactId>testng</artifactId>
        <version>6.14.3</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/com.vimalselvam/cucumber-extentsreport -->
    <dependency>
        <groupId>com.vimalselvam</groupId>
        <artifactId>cucumber-extentsreport</artifactId>
        <version>3.1.1</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/com.aventstack/extentreports -->
    <dependency>
        <groupId>com.aventstack</groupId>
        <artifactId>extentreports</artifactId>
        <version>3.1.5</version>
        <scope>provided</scope>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.aspectj/aspectjweaver -->
    <dependency>
        <groupId>org.aspectj</groupId>
        <artifactId>aspectjweaver</artifactId>
        <version>${aspectj.version}</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/io.qameta.allure/allure-maven -->
    <dependency>
        <groupId>io.qameta.allure</groupId>
        <artifactId>allure-maven</artifactId>
        <version>2.9</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/io.qameta.allure/allure-cucumber3-jvm -->
    <dependency>
        <groupId>io.qameta.allure</groupId>
        <artifactId>allure-cucumber3-jvm</artifactId>
        <version>2.7.0</version>
    </dependency>


</dependencies>

预期: cumman-jvm-parallel-plugin应该生成报告json文件。

实际: 从命令行执行后:mvn clean验证何时存在surefire-plugin下的argLine以获取诱人的报告,而不是黄瓜-jvm-parallel-plugin生成report.json

<argLine>
-javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"
-Dcucumber.options="--plugin io.qameta.allure.cucumber3jvm.AllureCucumber3Jvm"

0 个答案:

没有答案