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

标签 javascript cucumber mocha.js karma-jasmine cypress

我正在使用 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/

相关文章:

javascript - 使用 javascript 在 span 元素上获取自定义字段值

java - Cucumber:初始化然后在步骤定义之间传递数据?

java - cucumber 测试用例没有失败的插入步骤显示为通过

javascript - Phantomjs无法通过aspx从HTML网站获取刷新内容

javascript - 如何通过网络浏览器更改系统上的注册表设置

node.js - 所有未全局安装的npm包都不能直接执行

requirejs - Karma 正在使用 RequireJS 加载测试,但实际规范并未运行

javascript - Zombie.js pressButton如何访问post-ajax版本的浏览器?

javascript - 紫藤背景视频

java - cucumber Java : Features File Mapping to Step Definitions