带有量角器的黄瓜 HTML 报告 [英] Cucumber HTML report with Protractor

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

问题描述

我正在使用带有 Cucumber (js) 的量角器.我想像 Cucumber-JVM 版本一样生成报告文件.我在 Jasmine 中使用 Protractor 时看到过示例,但在 Cucumber 中几乎没有.

I am using Protractor with Cucumber (js). I would like to generate report files just like with the Cucumber-JVM version. I have seen examples when using Protractor with Jasmine, but practically nothing with Cucumber.

使用此配置时如何生成报告?

How do you generate reports when using this configuration?

最终目标是在 Jenkins 或其他任何地方发布此报告(如果它们是直接以 HTML 生成的).

The final goal is to publish this report in Jenkins, or anywhere else if they are directly generated in HTML.

谢谢!

推荐答案

使用最新版本的量角器(从版本 1.5.0 开始),您现在可以生成 JSON 报告.大约 7 个月前,当我问这个问题时,该功能不存在.

With the latest version of protractor (from version 1.5.0), you can now generate a JSON report. When I asked this question about 7 months ago that feature was not there.

您需要做的就是将其添加到您的 protractor-config.json 文件中.

All you need to do is add this to your protractor-config.json file.

resultJsonOutputFile: 'report.json'

report.json 是输出文件的位置.

Where report.json is the location of the output file.

一旦你有了它,你就可以使用 protractor-cucumber-junit (https://www.npmjs.com/package/protractor-cucumber-junit), cucumberjs-junitxml (https://github.com/sonyschan/cucumberjs-junitxml) 或类似的东西将 JSON 文件转换为 Jenkins 可以显示的有效 XML 文件.

Once you have that, you can use protractor-cucumber-junit (https://www.npmjs.com/package/protractor-cucumber-junit), cucumberjs-junitxml (https://github.com/sonyschan/cucumberjs-junitxml) or something similar to transform the JSON file into a valid XML file that Jenkins can display.

$ cat report.json | ./node_modules/.bin/cucumber-junit > report.xml

希望这会有所帮助.

这篇关于带有量角器的黄瓜 HTML 报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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