是否有适用于黄瓜框架的量角器报告工具? [英] Is there a Protractor Reporting Tool that works with a cucumber framework?
问题描述
将量角器与黄瓜配合使用,并需要一个插件或工具(如果可能,则免费),它将创建用户友好的测试报告或至少一个可生成测试报告的文件.谢谢!
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.
这使您能够:
- 并行运行测试,仍然可以获得汇总的,用户友好的测试报告.
- 使用应用程序UI的屏幕截图增强测试报告,而无需任何其他插件.
- 仅通过一次配置更改即可解决与Cucumber/WebDriver ControlFlow同步和报告不准确有关的一些常见问题.
- 在项目的某些部分中尝试使用编剧模式,同时保持您的其他测试照常进行.这样,您可以在改善工具集的同时最大程度地减少破坏团队工作的风险.
- 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
(这是一个围绕 Java Runtime Environment 7 或更高版本来运行它).
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屋!