Cucumber Reporting

Krushna Dash
2 min readMay 2, 2020

Cucumber is one of the most popular tools written in ruby to do Behavioral-driven development, there are good numbers of the plugin available to generate test reports in different formats.

Refer here to find out all available plugin

https://cucumber.io/docs/cucumber/reporting/

Here will cover generation of below reports

  • Pretty Format -HTML Report
  • JSON report
  • Cucumber JVM Report

To generate the cucumber HTML and JSON report we need to add the plugin to CucumberTest class like below.

plugin = { “json:target/cucumber.json”, “pretty”,“html:target/cucumber-reports” }

The full example of the Test class.

@RunWith(Cucumber.class)
@CucumberOptions(features = "src/test/resources/", plugin = { "json:target/cucumber.json", "pretty",
"html:target/cucumber-reports" })
public class CucumberTest {

}

By adding the above configuration to cucumber test class we can see different the HTML and JSON report at target directories after running of the test cases, like below.

There is a cucumber JVM report plugin which can be used to generate pretty HTML reports with charts showing the results of cucumber runs. This is mainly used to publish cucumber reports on the Jenkins build server. There is a maven plugin also to generate the same report in the local directory. We will see both here.
Here is the git hub project for the pretty cucumber HTML report
https://github.com/damianszczepanik/cucumber-reporting

To generate the cucumber pretty HTML report with the chart using a maven plugin add below to build plugins.

As per the above configuration, this will run at “verify” maven phase and generate the HTML report at the target directory.

Here is the detailed instruction on publishing the cucumber report on the Jenkins build server: https://github.com/jenkinsci/cucumber-reports-plugin/wiki/Detailed-Configuration

Here is the source code of this project :https://github.com/krushnaDash/spring-bdd

--

--