Skip to main content

MasterThought Cucumber Reporting

Masterthought 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.

Net MasterThought cucumber-reporting example

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.

Submitted by tgoswami on February 18, 2021

Tarun has 11+ years of experience in Quality Assurance in different domains like Banking, E-commerce, Health and Education.

About

At ProgramsBuzz, you can learn, share and grow with millions of techie around the world from different domain like Data Science, Software Development, QA and Digital Marketing. You can ask doubt and get the answer for your queries from our experts.