Generate pretty test execution report

In this post we will show how to generate a pretty report after cucumber test execution.

Using technology:

  • Maven
  • Java 8
  • Cucumber¬†1.2.5
  1. First of all you need to add following library in your pom.xml file:

After that you will need to do some changes in your Cucumber Runner to generate a json file after test execution.

        jsonReport = "target/cucumber.json"
@CucumberOptions(features = {"src/main/tests/features"},
        glue = {"com.straighterline.core",
        plugin = {
public class CucumberRunner {

In my case I’ve just added:

jsonReport = "target/cucumber.json"

To save the execution cucumber report in “target/cucumber.json” and after that added plugin.

 plugin = {

Now is the moment to generate a pretty report how you see in the picture above, so for this we will create an java executable class there will be define the code to generate report in target repository.

public class ReportGenerator {
    public static void main(String[] args) throws IOException {
        File reportOutputDirectory = new File("target");
        List&lt;String&gt; jsonFiles = new ArrayList&lt;&gt;();

        String buildNumber = "1";
        String projectName = "cucumberProject";
        boolean runWithJenkins = false;

        Configuration configuration = new Configuration(reportOutputDirectory, projectName);
// optional configuration - check javadoc
// addidtional metadata presented on main page
        configuration.addClassifications("Platform", "Windows");
        configuration.addClassifications("Browser", "Firefox");
        configuration.addClassifications("Branch", "release/1.0");
        ReportBuilder reportBuilder = new ReportBuilder(jsonFiles, configuration);

This is all you need, hope this will help you!
In case of some question don’t hesitate to add a comment!