Use Maven Cucumber Reporting Plugin to generate extended HTML Reports

Steps To Configure Maven Cucumber Reporting Plugin:

Add the below plugin to pom.xml

<projectName>: Project name which will be displayed at the top of the report

<skip>: Report Generation can be skipped

<outputDirectory>: Path of the directory where reports will be generated

<inputDirectory>: Path of the directory where Cucumber xml report will be generated

<plugin>
    <groupId>net.masterthought</groupId>
    <artifactId>maven-cucumber-reporting</artifactId>
    <version>5.3.0</version>
    <executions>
        <execution>
            <id>execution</id>
            <phase>verify</phase>
            <goals>
                <goal>generate</goal>
            </goals>
            <configuration>
                <projectName>Sample-Cucumber-TestNG</projectName>
                <skip>false</skip>
                <outputDirectory>reports/html-reports</outputDirectory>
                <inputDirectory>target/cucumber-reports</inputDirectory>
                <jsonFiles>
                    <param>**/*.json</param>
                </jsonFiles>
            </configuration>
        </execution>
    </executions>
</plugin>

Make sure the Cucumber Runner File contains the JSON Reporting Plugin. Also the path should be same as the <inputDirectory> mentioned above

@CucumberOptions(
        plugin = {"pretty",
                "html:target/cucumber-reports/cucumber.html",
                "json:target/cucumber-reports/cucumber.json"
        },
        features = {"src/test/resources/features"},
        glue = {"com.example.StepDefinitions"},
        tags = "@regression"
)

public class TestRunner extends AbstractTestNGCucumberTests {
}

Run the project from the command line by using the below maven command:

mvn clean install

After execution is completed, reports will be generated in the output directory “reports/html-reports/cucumber-html-reports”.

Open the overview-features.html  file in any browser. It should look like below:

 

 

Share

Bijan Patel

Founder & Creator of QAScript | 12+ years of IT Experience | Full Stack Automation Engineer | Blogger | Trainer

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

error: Content is protected !!