node package manager

sm-cucureport

sm-cucureport

Release History

  • 0.1.0 Initial release

Generate Bootstrap (HTML) reports with coverage (in terms of %) for cucumber projects.

Install

npm install sm-cucureport --save-dev

Usage

This module will convert the JSON output from cucumber into an elegant and detailed bootstrap (HTML) report. For this you have make sure your cucumber setup is generating JSON files and provide the path as needed.

Example of usage:

 
var reporter = require('sm-cucureport');
 
var options = {
        theme: 'bootstrap',
        jsonFile: 'test/report/cucumber_report.json',
        output: 'test/report/cucumber_report.html',
        reportSuiteAsScenarios: true,
        launchReport: true,
        metadata: {
            "App Version":"0.3.2",
            "Test Environment": "STAGING",
            "Browser": "Chrome  54.0.2840.98",
            "Platform": "Windows 10",
            "Parallel": "Scenarios",
            "Executed": "Remote"
        }
    };
 
    reporter.generate(options);
 

Options

theme

Available: ['bootstrap'] Type: String

jsonFile

Type: String

Provide path of the Cucumber JSON format file

output

Type: String

Provide HTML output file path and name

reportSuiteAsScenarios

Type: Boolean Supported in the Bootstrap theme.

true: Reports total number of passed/failed scenarios as HEADER.

false: Reports total number of passed/failed features as HEADER.

launchReport

Type: Boolean

Automatically launch HTML report at the end of test suite

true: Launch HTML report in the default browser

false: Do not launch HTML report at the end of test suite

ignoreBadJsonFile

Type: Boolean

Report any bad json files found during merging json files from directory option.

true: ignore any bad json files found and continue with remaining files to merge.

false: Default option. Fail report generation if any bad files found during merge.

name

Type: String (optional)

Custom project name. If not passed, module reads the name from projects package.json which is preferable.

storeScreenShots

Type: Boolean Default: undefined

true: Stores the screenShots to the default directory. It creates a directory 'screehshot' if does not exists.

false or undefined : Does not store screenShots but attaches screenShots as a step-inline images to HTML report

metadata

Type: JSON (optional) Default: undefined

Print more data to your report, such as browser info, platform, app info, environments etc. Data can be passed as JSON key-value pair. Reporter will parse the JSON and will show the Key-Value under Metadata section on HTML report. Checkout the below preview HTML Report with Metadata.

Pass the Key-Value pair as per your need, as shown in below example,

 
 metadata: {
        "App Version":"0.3.2",
        "Test Environment": "STAGING",
        "Browser": "Chrome  54.0.2840.98",
        "Platform": "Windows 10",
        "Parallel": "Scenarios",
        "Executed": "Remote"
      }
 

Tips

Attach Screenshots to HTML report

Capture and Attach screenshots to the Cucumber Scenario and HTML report will render the screenshot image

 
  driver.takeScreenshot().then(function (buffer) {
    return scenario.attach(new Buffer(buffer, 'base64'), 'image/png');
  }
 

Attach Plain Text to HTML report

Attach plain-texts/data to HTML report to help debug/review the results

 
  scenario.attach('test data goes here');
 

Attach pretty JSON to HTML report

Attach JSON to HTML report

 
  scenario.attach(JSON.stringify(myJsonObject, undefined, 4));