You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

BDD测试后Multiple Cucumber报告显示异常问题求助

Multiple Cucumber报告显示异常问题
  • 问题现象:运行BDD的feature文件后,生成的Multiple Cucumber报告详情显示异常,内容以base64编码格式呈现,无法正常阅读。
  • 历史情况:上个月报告显示完全正常,可直接查看测试详情,近期出现该异常。

以下是当前项目的package.json内容:

{
  "version": "1.0.0",
  "main": "runFeature.sh",
  "scripts": {
    "test": "cucumber-js -f json:report/cucumber_report.json"
  },
  "keywords": [],
  "dependencies": {
    "@azure/event-hubs": "^5.11.2",
    "@azure/eventhubs-checkpointstore-blob": "^1.0.1",
    "@cucumber/cucumber": "^10.0.1",
    "@ln-maf/api": "^2.0.5",
    "@ln-maf/core": "^2.0.2",
    "@ln-maf/mysql": "^2.0.2",
    "@ln-maf/validations": "^2.0.4",
    "chai": "^4.3.10",
    "eslint-config-airbnb-base": "^15.0.0",
    "eslint-plugin-import": "^2.29.0",
    "flat-object-keys": "^1.1.0",
    "lodash": "^4.17.21",
    "multiple-cucumber-html-reporter": "^3.5.0",
    "pako": "^2.1.0",
    "utf8": "^3.0.0",
    "uuid-validate": "^0.0.3"
  }
}

排查及解决建议

1. 检查报告生成配置

确认multiple-cucumber-html-reporter的生成脚本是否存在异常编码逻辑。如果报告内容被base64编码,需在生成环节添加解码处理,示例配置如下:

const reporter = require('multiple-cucumber-html-reporter');

reporter.generate({
  jsonDir: './report',
  reportPath: './report/html',
  displayDuration: true,
  // 若存在编码逻辑,需调整为解码后再生成报告
  customData: {
    title: 'Run Info',
    data: [
      { label: 'Project', value: 'Your Project' },
      { label: 'Env', value: 'Test' }
    ]
  }
});

2. 回退依赖版本

从依赖版本看,@cucumber/cucumber(v10.0.1)和multiple-cucumber-html-reporter(v3.5.0)可能存在兼容性问题。尝试回退到上个月正常运行时的版本:

  • 查看npm历史记录,找到当时的依赖版本号
  • 执行类似命令回退:npm install multiple-cucumber-html-reporter@3.4.0(版本号需根据实际情况调整)
  • 重新运行测试生成报告

3. 检查原始JSON报告

打开report/cucumber_report.json文件,确认其中的测试内容是否已被base64编码。如果JSON文件本身异常,需排查测试代码或依赖库是否新增了编码逻辑。

4. 清理并重装依赖

执行以下命令清理缓存并重新安装依赖,排除依赖损坏问题:

npm cache clean --force
rm -rf node_modules package-lock.json
npm install

内容的提问来源于stack exchange,提问作者Jin

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.06 00:01:04