Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

287
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda