Skip to main content

Generate Cucumber TestNG reports using Net Masterthought

This library provides pretty html reports for Cucumber. It works by generating html from the cucumber json file. This is a Java report publisher primarily created to publish cucumber reports on the Jenkins build server. It publishes pretty html reports with charts showing the results of cucumber runs.

It has been split out into a standalone package so it can be used for Jenkins and maven command line as well as any other packaging that might be useful. Generated report has no dependency so can be viewed offline.

Step 1: Add following dependency to your pom.xml. You can check for the latest version here

<dependency>
    <groupId>net.masterthought</groupId>
    <artifactId>cucumber-reporting</artifactId>
    <version>(check version above)</version>
</dependency>

Step 2: Add the following plugin in pom.xml

<plugin>
    <groupId>net.masterthought</groupId>
    <artifactId>maven-cucumber-reporting</artifactId>
    <version>2.8.0</version>

    <executions>
        <execution>
            <id>execution</id>
            <phase>test</phase>
            <goals>
                <goal>generate</goal>
            </goals>
            <configuration>
                <projectName>Project Name</projectName>
                <outputDirectory>${project.build.directory}/Report/cucumber-reports</outputDirectory>
                <cucumberOutput>${project.build.directory}/cucumber/cucumber.json</cucumberOutput>
                <skippedFails>true</skippedFails>
                <enableFlashCharts>false</enableFlashCharts>
            </configuration>
        </execution>
    </executions>
</plugin>

Step 3: Check your cucumber plugin options configured like this

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

Step 4: Execute project using mvn test command

Step 5: Refresh your project and check inside \target\Report\cucumber-reports\cucumber-html-reports that report generated with name feature-overview.

Video Tutorial

About

Elix is a premium wordpress theme for portfolio, freelancer, design agencies and a wide range of other design institutions.