cucumber-report-historic-scenarios
v1.0.5
Published
A report generator that read cucumber_report.json files and creates a report with historic runs for each scenario name.
Readme
Cucumber report historic scenarios
Using cucumber_report.json files, generates an HTML report for historic execution for each test scenario.
It expects report files compatible with cucumber, this was tested with: "@cucumber/cucumber": "11.3.0" but it should work with earlier versions.
Install with: npm install cucumber-report-historic-scenarios
How to run
Option 1. Using as a library
Include the generator to your file:
// import the package
const { generateHtml: historicCucumberReportGenerateHtml } = require('cucumber-report-historic-scenarios');
function main(){
// make sure to change this as required
const reportsPath = '/tmp/reports/historic';
const outputFile = './historic-reports-by-scenario.html';
const templateFile = './node_modules/cucumber-report-historic-scenarios/resources/historic_cucumber_report_template.ejs'; // this points to the package's template, you could copy or modify if needed
const maxRecent = 12;
// will do the whole reading and generation, will save an html file.
historicCucumberReportGenerateHtml(reportsPath, outputFile, templateFile, maxRecent);
}
main();Option 2 using cli
In package root's directory:
Gather reports: You need to prepare several
cucumber_report.jsonfiles, you should rename them according to its creation date and time using format ISO Timestamp. For instancecucumber-report-2025-11-06T22-02-37-741Z.json, cucumber-report-2025-12-09T03-26-17-997Z.json, ...Run the report command by using
npm run test:cli. By default looks inreports/directory for report json files. You can also specify the output directory which by default ishistoric-reports-by-scenario.html.
Options:
-p, --path <dir> Directory where to look for report-json files (default: ./reports)
-o, --output <dir> File and path where to save the html report (default historic-reports-by-scenario.html)
-t, --template <dir> Ejs template file to render html (default historic_cucumber_report_template.ejs)
-m, --max-recent <n> Max number of recent files to include in the report (default all files)Example: npm run test:generate -- --path /home/project/reports/json/historic --output /tmp/out.html --template /home/project/resources/historic_cucumber_report_template.ejs --max-recent 10
Customize
- Modify the
resources/historic_cucumber_report_template.ejsfile, which is an html file using ejs
LICENSE
MIT
