Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

286
Vistas
Unable to generate Cucumber HTML reports on failure

I have created a project framework using Typescript and Cucumber BDD approach. The executions within the project are working and the cucumber html reports are also getting generated when executions are getting passed, but when the things are failing due to some reason(whether assertion reason in my case) the reports are not getting generated within the specified folder.

Below are some key points to look upon;

  • I am using package.json test module perform my executions.

{
  "name": "sampleprojectplaywright",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    
    "test": "cucumber-js features/**/*.feature --require-module ts-node/register --require test.setup.ts --require step-definitions/**/*.ts --parallel 1 -f json:report/report.json && node report.js && type report/report.json"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "@cucumber/cucumber": "^7.3.2",
    "@playwright/test": "^1.19.1",
    "@types/mkdirp": "^1.0.2",
    "@types/node": "^17.0.18",
    "cucumber-html-reporter": "^5.3.0",
    "cucumber-junit": "^1.7.1",
    "cucumberjs-junitxml": "^1.0.0",
    "fs-extra": "^3.0.1",
    "mkdirp": "^0.5.1",
    "mkdirp-promise": "^5.0.1",
    "multiple-cucumber-html-reporter": "^1.19.0",
    "playwright": "^1.19.1",
    "sanitize-filename": "^1.6.1",
    "ts-node": "^10.5.0",
    "typescript": "^4.5.5"
  }
}

  • Below is the code snippet for report.js file(that is generating the reports in the mentioned folders over there)

const reporter = require("cucumber-html-reporter");
const options = {
  theme: "bootstrap",
  jsonFile: "report/report.json",
  output: "report/cucumber-html-report.html",
  reportSuiteAsScenarios: true,
  launchReport: false,
};
reporter.generate(options);

A point to consider is that report.json is getting created in case of failure also but only html report isn't getting created on failure.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

In order to generate html reports in failure please try to add below code in your cucumber.js file.

In common add "--require report.js", This helps in creating in both passed and failed cases

For reference

const common = --require runner/hooks.js --require features/support/steps.js --require report.js;

module.exports = {
default: ${common} features/**/*.feature
};
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda