是否有适用于黄瓜框架的量角器报告工具? [英] Is there a Protractor Reporting Tool that works with a cucumber framework?

查看:131
本文介绍了是否有适用于黄瓜框架的量角器报告工具?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

将量角器与黄瓜配合使用,并需要一个插件或工具(如果可能,则免费),它将创建用户友好的测试报告或至少一个可生成测试报告的文件.谢谢!

Using protractor with cucumber and need a plug in or tool (free if possible) that will create a user friendly test report or at least a file that a test report can be generated from. Thank you!

推荐答案

最简单的方法是使用免费的开源

The easiest thing to do is to compliment your current setup with the free and open-source Serenity/JS.

Serenity/JS是下一代验收测试库,但是在最基本的情况下,它也可以充当Protractor和Cucumber之间的集成层.

Serenity/JS is a next generation acceptance testing library, but in the most basic scenario, it can also act as an integration layer between Protractor and Cucumber.

这使您能够:

  • Run your tests in parallel and still get the aggregated, user-friendly test reports.
  • Enhance your test reports with screenshots of your app's UI without any additional plugins.
  • Fix some common problems related to Cucumber/WebDriver ControlFlow synchronisation and inaccurate reporting with just a single config change.
  • Try the Screenplay Pattern in some part of your project while keeping your other tests working as they used to. This way you minimise the risk of disrupting the work of your team while improving your tool set.

手册和报告中详细解释了以下设置说明您将获得如下所示:

The below setup instructions are explained in detail in the manual, and the reports you'll get will look like this:

从npm安装 serenity-js 模块并将其保存为开发依赖项:

Install the serenity-js module from the npm and save it as a development dependency:

npm install serenity-js --save-dev

在安装了serenity-js模块之后,您可以更新您的量角器配置文件,使其包括:

With the serenity-js module installed, you can update your Protractor configuration file to include:

exports.config = {
    framework: 'custom',
    frameworkPath: require.resolve('serenity-js'), 
    // ...
}

如果您当前正在使用protractor-cucumber-framework,则只需将其替换为serenity-js.

If you're currently using the protractor-cucumber-framework, you can simply replace it with serenity-js.

Serenity/JS生成json格式的测试执行报告,并将其转换为html,您需要serenity-cli(这是一个围绕

Serenity/JS produces test execution reports in json format and to convert them to html you'll need serenity-cli (which is a node.js wrapper around the Serenity BDD CLI, which in turn is a Java program and you'll need the Java Runtime Environment 7 or newer to run it).

安装serenity-cli并将其另存为开发依赖项:

Install serenity-cli and save it as a development dependency:

npm install serenity-cli --save-dev

接下来,将以下 npm脚本添加到您的package.json文件:

Next, add the following npm scripts to your package.json file:

 "scripts": {
    "prereport": "serenity update",
    "report":  "serenity run",

    // other scripts ...
  },

完成上述设置后,您的量角器测试将以json格式生成测试报告,并在target/site/serenity下生成屏幕截图,运行npm run report将处理这些中间报告并生成用户友好的HTML版本.以后.

With the above setup complete running your protractor tests will produce test reports in the json format together with screenshots under target/site/serenity, and running npm run report will process those intermediary reports and produce the user-friendly HTML version you're after.

希望这会有所帮助,

Jan

这篇关于是否有适用于黄瓜框架的量角器报告工具?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆