Donut report (donut-maven-plugin) is not getting g

2020-07-28 11:51发布

问题:

I am using Donut report (donut-maven-plugin) for aggregating a report for parallel cucumber tests ran using cucumber-jvm-parallel-plugin from github.temyers team.

Here is my POM snippet:

<profiles>
    <profile>
        <id>TestSuite1</id>
        <activation>
            <activeByDefault>true</activeByDefault>
        </activation>
        <properties>
            <app.config>//src//test//java//envConfig//localGridConfig.properties</app.config>
            <test.tag>@android</test.tag>
            <dummy.tag>@dummy</dummy.tag>
            <device.name>browserstack.ios</device.name>
            <!--<target.env>browserStackEnv</target.env>-->
        </properties>
    </profile>

    <profile>
        <id>TestSuite2</id>
        <activation>
            <activeByDefault>false</activeByDefault>
        </activation>
        <properties>
            <app.config>//src//test//java//envConfig//sauceLabsGridConfigAndroid.properties</app.config>
        </properties>
    </profile>

    <profile>
        <id>TestSuite3</id>
        <activation>
            <activeByDefault>false</activeByDefault>
        </activation>
        <properties>
            <app.config>//src//test//java//envConfig//sauceLabsGridConfigIOS.properties</app.config>
        </properties>
    </profile>

</profiles>
<build>
    <!--<sourceDirectory>src</sourceDirectory>-->
    <plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.1</version>
            <configuration>
                <source>1.7</source>
                <target>1.7</target>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-failsafe-plugin</artifactId>
            <version>2.20</version>
            <configuration>
                <parallel>methods</parallel>
                <threadCount>5</threadCount>
            </configuration>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.19</version>
            <configuration>
                <forkCount>5</forkCount>
                <reuseForks>true</reuseForks>
                <includes>
                    <include>**/Parallel*IT.class</include>
                </includes>
                <systemPropertyVariables>
                    <deviceName>${device.name}</deviceName>
                    <targetEnv>${target.env}</targetEnv>
                </systemPropertyVariables>
            </configuration>
        </plugin>


        <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>
                    <!--<phase>validate</phase>-->
                    <goals>
                        <goal>generateRunners</goal>
                    </goals>
                    <configuration>
                        <!-- Mandatory -->
                        <!-- List of package names to scan for glue code. -->
                        <glue>
                            <package>stepDefs</package>
                        </glue>
                        <!-- These are optional, with the default values -->
                        <!-- Where to output the generated tests -->
                        <outputDirectory>${project.build.directory}/cucumber-parallel/html</outputDirectory>
                        <!--<outputDirectory>${project.build.directory}/generated-test-sources/cucumber</outputDirectory>-->
                        <!-- The directory, which must be in the root of the runtime classpath, containing your feature files.  -->
                        <featuresDirectory>src/main/resources/features/</featuresDirectory>
                        <!-- Directory where the cucumber report files shall be written  -->
                        <!--<cucumberOutputDir>target/cucumber-parallel</cucumberOutputDir>-->
                        <cucumberOutputDir>target/cucumber-parallel</cucumberOutputDir>
                        <!-- List of cucumber plugins. When none are provided the json formatter is used. For more
                             advanced usage see section about configuring cucumber plugins -->
                        <format>json,html,rerun</format>

                        <plugins>
                            <plugin>
                                <name>json</name>
                                <extension>json</extension>
                                <!--Optional output directory. Overrides cucumberOutputDirectory. Usefull when different
                                    plugins create files with the same extension-->
                                <outputDirectory>${project.build.directory}/cucumber-parallel/json</outputDirectory>
                            </plugin>
                            <!--<plugin>-->
                            <!--<name>com.example.CustomHtmlFormatter</name>-->
                            <!--<extension>html</extension>-->
                            <!--</plugin>-->
                            <plugin>
                                <name>com.cucumber.listener.ExtentCucumberFormatter</name>
                                <extension>html</extension>
                            </plugin>
                        </plugins>
                        <customVmTemplate>
                            src/main/resources/cucumber-extents-report-runner.java.vm
                        </customVmTemplate>
                        <!-- CucumberOptions.strict property -->
                        <strict>true</strict>
                        <!-- CucumberOptions.monochrome property -->
                        <monochrome>true</monochrome>
                        <!-- The tags to run, maps to CucumberOptions.tags property. Default is no tags. -->
                        <tags>
                            <tag>
                                <!--${dummy.tag}-->
                            </tag>
                        </tags>
                        <!-- Generate TestNG runners instead of JUnit ones. -->
                        <useTestNG>false</useTestNG>
                        <!-- The naming scheme to use for the generated test classes.  One of 'simple' or 'feature-title' -->
                        <namingScheme>simple</namingScheme>
                        <!-- The class naming pattern to use.  Only required/used if naming scheme is 'pattern'.-->
                        <!--<namingPattern>**/Parallel*IT.class</namingPattern>-->
                        <namingPattern>Parallel{c}IT</namingPattern>

                        <!-- One of [SCENARIO, FEATURE]. SCENARIO generates one runner per scenario.  FEATURE generates a runner per feature. -->
                        <parallelScheme>SCENARIO</parallelScheme>
                        <!--<parallelScheme>FEATURE</parallelScheme> &lt;!&ndash;Using Feature for accomodating Scenario Outline &ndash;&gt;-->

                        <!-- Specify a custom template for the generated sources (this is a path relative to the project base directory) -->
                        <!--<customVmTemplate>src/test/resources/cucumber-custom-runner.vm</customVmTemplate>-->
                        <!-- Specify a custom package name for generated sources. Default is no package.-->
                        <packageName>
                        </packageName>

                    </configuration>
                </execution>
            </executions>
        </plugin>

        <!-- Cucumber report merger

        -->
        <plugin>
            <groupId>report.donut</groupId>
            <artifactId>donut-maven-plugin</artifactId>
            <version>0.0.6</version>
            <executions>
                <execution>
                    <id>execution</id>
                    <phase>post-integration-test</phase>
                    <goals>
                        <goal>generate</goal>
                    </goals>
                    <configuration>
                        <sourceDirectory>${project.build.directory}/cucumber-parallel</sourceDirectory>
                        <outputDirectory>${project.build.directory}/TrackMergeReport</outputDirectory>
                        <timestamp>${maven.build.timestamp}</timestamp>
                        <template>default</template>
                        <projectName>NativeAppsAutomation</projectName>
                        <!-- optional -->
                        <customAttributes>
                            <customAttribute>
                                <name>App Name</name>
                                <!--<value>${app.name}</value>-->
                                <value>smartphone.editor.beta</value>
                            </customAttribute>
                            <customAttribute>
                                <name>Device Name</name>
                                <!--<value>${app.name}</value>-->
                                <value>${device.name}</value>

                            </customAttribute>

                            <customAttribute>
                                <name>Target Env</name>
                                <value>${target.env}</value>
                            </customAttribute>
                        </customAttributes>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>

Note: - There's no trace/mention about attempt to generate Donut report in maven run log (when one of the tests fail): - I use mvn clean verify or mvn clean integration-test to run the framework

   Run 1: PASS
  Run 2: PASS
  Run 3: Can't locate an element by this strategy: Locator map: 
- native content: "By.chained({By.xpath: //*[contains(@text,'rints')]})" 
- html content: "By.cssSelector: div[data-id='print'] > .caption"


Tests run: 51, Failures: 0, Errors: 9, Skipped: 5

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 13:49 min
[INFO] Finished at: 2018-01-05T14:54:50+01:00
[INFO] Final Memory: 27M/306M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.19:test

(default-test) on project NativeAppsAutomation-project: There are test failures. [ERROR] [ERROR] Please refer to /../target/surefire-reports for the individual test results. [ERROR] -> [Help 1]

Noticed that - individual plain Cucumber reports (json, Html, xml) are getting generated in the target/cucumber-parallel folder as expected for both All pass & runs with failures or all failures. Whereas , when all tests pass then Donut aggregate report is getting generated,