通过maven运行时未生成Cucumber HTML报告

bogh5gae  于 2023-03-17  发布在  Maven
关注(0)|答案(1)|浏览(169)

请查找我的Pom.xml

4.0.0

<groupId>Cucumberreports</groupId>
<artifactId>Cucumberreports</artifactId>
<version>0.0.1-SNAPSHOT</version>

<name>Cucumberreports</name>
<!-- FIXME change it to the project's website -->
<url>http://www.example.com</url>

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

<dependencies>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.11</version>
        <scope>test</scope>
    </dependency>

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

    <!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-junit -->
    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-junit</artifactId>
        <version>6.11.0</version>
        <scope>test</scope>
    </dependency>

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

    <!-- https://mvnrepository.com/artifact/net.masterthought/cucumber-reporting -->
    <!-- https://mvnrepository.com/artifact/net.masterthought/maven-cucumber-reporting -->
    <dependency>
        <groupId>net.masterthought</groupId>
        <artifactId>maven-cucumber-reporting</artifactId>
        <version>5.5.4</version>
    </dependency>


</dependencies>

<build>
    <pluginManagement><!-- lock down plugins versions to avoid using Maven 
            defaults (may be moved to parent pom) -->
        <plugins>
<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>3.0.0-M5</version>
                <configuration>
                    <includes>
                        <include>**/CucumberRunner*.java</include>
                    </includes>
                    <testFailureIgnore>true</testFailureIgnore>
                </configuration>

            </plugin>
<plugin>
            <groupId>net.masterthought</groupId>
            <artifactId>maven-cucumber-reporting</artifactId>
            <version>5.5.4</version>
            <executions>
                <execution>
                    <id>execution</id>
                    <phase>verify</phase>
                    <goals>
                        <goal>generate</goal>
                    </goals>
                    <configuration>
                        <projectName>Cucumberreports</projectName>
                        <!-- optional, per documentation set this to "true" to bypass generation of Cucumber Reports entirely, defaults to false if not specified -->
                        <skip>false</skip>
                        <!-- output directory for the generated report -->
                        <outputDirectory>target/cucumber-reports/advanced-reports</outputDirectory>
                        <!-- optional, defaults to outputDirectory if not specified -->
                        <inputDirectory>target/cucumber-reports/cucumber.json</inputDirectory>
                        <jsonFiles>
                            <!-- supports wildcard or name pattern -->
                            <param>**/*.json</param>
                        </jsonFiles>
                        <!-- optional, defaults to outputDirectory if not specified -->
                        <classificationDirectory>${project.build.directory}/cucumber-reports</classificationDirectory>
                        <classificationFiles>
                                <!-- supports wildcard or name pattern -->
                                <param>sample.properties</param>
                                <param>other.properties</param>
                        </classificationFiles>
                        <parallelTesting>false</parallelTesting>
                        <!-- optional, set true to group features by its Ids -->
                        <mergeFeaturesById>false</mergeFeaturesById>
                        <!-- optional, set true to get a final report with latest results of the same test from different test runs -->
                        <mergeFeaturesWithRetest>false</mergeFeaturesWithRetest>
                        <!-- optional, set true to fail build on test failures -->
                        <checkBuildResult>false</checkBuildResult>
                    </configuration>
                </execution>
            </executions>
        </plugin>
        </plugins>
    </pluginManagement>
</build>
**Runner Class -**

package Cucumberreports.Cucumberreports;

import org.junit.runner.RunWith;

import io.cucumber.junit.Cucumber;
import io.cucumber.junit.CucumberOptions;

@RunWith(Cucumber.class)
@CucumberOptions( features = {"C:\\Users\\rishabh Patel\\eclipse-workspace\\Cucumberreports\\Feature"},
        glue  = {"Stepdefinition"},
        plugin = {"pretty", "json:target/cucumber-reports/cucumber.json"}
//monochrome= true
)
    public class CucumberRunner {}

PFA截图
enter image description here

jvidinwx

jvidinwx1#

在你的runner类中包含如下的html报告

plugin = {
                        "pretty",
                        "json:target/cucumber-report/cucumber.json",
                        "html:target/cucumber-report/cucumber.html"}

相关问题