gpt4 book ai didi

javascript - 如何将 cucumber 报告添加到 Cypress

转载 作者:行者123 更新时间:2023-11-30 19:33:57 27 4
gpt4 key购买 nike

我正在使用 cypress-cucumber-preprocessor 创建一些带有 cypress 的 cucumber 测试。问题是我只知道如何创建 JSON 或 JUnit 格式的报告。但我需要它们采用 cucumber 格式。就像在 Java 中完成的一样。

我找到了这个链接 https://github.com/TheBrainFamily/cypress-cucumber-preprocessor/issues/79但没有人提出解决方案。

有人有自定义报告器可以创建类似 cucumber 的报告吗?或者知道何时会实现此功能?

最佳答案

按照步骤配置报告:

  1. package.json 中导入库:

    • ma​​rge(用于合并 mocha 生成的文件)
    • mocha(为模式 mocha 生成 json)
    • mochawesome(为模式 mocha 生成 json)
    • shelljs(它将用于 Node JS 能够与终端交互)
  2. cypress.json中配置:

...
"screenshotsFolder": "screenshots",
"reporter": "mochawesome",
"reporterOptions": {
"overwrite": false,
"html": false,
"json": true
}
...
  1. 在文件夹 report/ 中用 code 创建文件 index.js .

  2. 运行测试并执行命令 node report/index.js

按照教程配置截图:https://github.com/cypress-io/cypress/issues/3654

index.js 代码是基于 Google 的其他脚本(查看引用),这个 Github 脚本是我为 friend 做的。

引用资料:

对不起,我不会说英语...

关于javascript - 如何将 cucumber 报告添加到 Cypress ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56145586/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com