Skip to content

aravinder111/cucumber-reporting

 
 

Repository files navigation

Travis Status AppVeyor Status Shippable Status

Coverage Status Sonarqube coverage Sonarqube tech debt Coverity Codacy Codebeat

Maven Central License Contributors

Publish pretty cucumber reports

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.

Background

Cucumber is a test automation tool following the principles of Behavioural Driven Design and living documentation. Specifications are written in a concise human readable form and executed in continuous integration.

This project allows you to publish the results of a cucumber run as pretty html reports. In order for this to work you must generate a cucumber json report. The project converts the json report into an overview html linking to separate feature files with stats and results.

Install

Add a maven dependency to your pom

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

Read this if you need further detailed install and configuration instructions for using the Jenkins version of this project

Usage

File reportOutputDirectory = new File("target");
List<String> jsonFiles = new ArrayList<>();
jsonFiles.add("cucumber-report-1.json");
jsonFiles.add("cucumber-report-2.json");

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

Configuration configuration = new Configuration(reportOutputDirectory, projectName);
// optional configuration
configuration.setParallelTesting(parallelTesting);
configuration.setRunWithJenkins(runWithJenkins);
configuration.setBuildNumber(buildNumber);
// addidtional metadata presented on main page
configuration.addClassifications("Platform", "Windows");
configuration.addClassifications("Browser", "Firefox");
configuration.addClassifications("Branch", "release/1.0");

// optionally add metadata presented on main page via properties file
List<String> classificationFiles = new ArrayList<>();
classificationFiles.add("properties-1.properties");
classificationFiles.add("properties-2.properties");
configuration.addClassificationFiles(classificationFiles);

ReportBuilder reportBuilder = new ReportBuilder(jsonFiles, configuration);
Reportable result = reportBuilder.generateReports();
// and here validate 'result' to decide what to do
// if report has failed features, undefined steps etc

There is a feature overview page:

feature overview page

And there are also feature specific results pages:

feature specific page passing

And useful information for failures:

feature specific page passing

If you have tags in your cucumber features you can see a tag overview:

Tag overview

And you can drill down into tag specific reports:

Tag report

Trends report

Code quality

Once you developed your new feature or improvement you should test it by providing several unit or integration tests.

codecov.io

Contribution

Interested in contributing to the cucumber-reporting? Great! Start here.

About

HTML reports for Cucumber

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 98.8%
  • CSS 1.2%