mavencucumberpom.xmltest-runnercucumber-html-reporter

Maven cucumber report is not generated


Everything in POM.XML and TestRunner.java is well configured, chcecked hunderd times, every time I run mvn clean verify - cucumber.json is generated, but cucucumbner-html never. Not even the folder. THere is nothing. Trying to find out whats wrong from 2 days and nothing helps... Do you have any ideas?

<?xml version="1.0" encoding="UTF-8"?>

<modelVersion>4.0.0</modelVersion>

<groupId>com.xxx</groupId>
<artifactId>restassured-bdd</artifactId>
<version>1.0-SNAPSHOT</version>

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

<dependencies>
    <!-- Cucumber -->
    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-java</artifactId>
        <version>7.16.1</version>
    </dependency>
    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-junit</artifactId>
        <version>7.16.1</version>
    </dependency>

    <!-- JUnit -->
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.13.2</version>
        <scope>test</scope>
    </dependency>

    <!-- REST Assured -->
    <dependency>
        <groupId>io.rest-assured</groupId>
        <artifactId>rest-assured</artifactId>
        <version>5.4.0</version>
        <scope>test</scope>
    </dependency>

    <!-- Hamcrest -->
    <dependency>
        <groupId>org.hamcrest</groupId>
        <artifactId>hamcrest</artifactId>
        <version>2.2</version>
        <scope>test</scope>
    </dependency>

    <!-- Jackson -->
    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-databind</artifactId>
        <version>2.15.2</version>
    </dependency>

    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>messages</artifactId>
        <version>24.1.0</version>
    </dependency>
</dependencies>

<build>
    <plugins>
        <!-- Test runner -->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>3.2.5</version>
            <configuration>
                <includes>
                    <include>**/TestRunner.java</include>
                </includes>
            </configuration>
        </plugin>

        <!-- Cucumber HTML Reporter -->
        <plugin>
            <groupId>net.masterthought</groupId>
            <artifactId>maven-cucumber-reporting</artifactId>
            <version>5.7.6</version>
            <executions>
                <execution>
                    <id>generate-cucumber-report</id>
                    <phase>verify</phase>
                    <goals>
                        <goal>generate</goal>
                    </goals>
                    <configuration>
                        <projectName>restassured-bdd</projectName>
                        <outputDirectory>${project.build.directory}/cucumber-html-reports</outputDirectory>
                        <inputDirectory>${project.build.directory}/cucumber</inputDirectory>
                        <jsonFiles>
                            <param>**/*.json</param>
                        </jsonFiles>
                    </configuration>
                </execution>
            </executions>
        </plugin>

    </plugins>
</build>

And TestRunner.java:

@RunWith(Cucumber.class)
@CucumberOptions(
        features = "src/test/resources/features",
        glue = "stepdefinitions",
        plugin = {"pretty", "json:target/cucumber/cucumber.json"},
        monochrome = true
)
public class TestRunner {}

Solution

  • ok guys found the solution my self, so if any of you will encounter this, this was solution:

    I was missing <testFailureIgnore>true</testFailureIgnore> in <configuration> for maven-surefire-plugin.
    And I had some failures in tests (as expected - to known reported bugs) and those failures was blocking report generation.
    Cheers!

    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>3.2.5</version>
        <configuration>
            <testFailureIgnore>true</testFailureIgnore>
        </configuration>
    </plugin>