黄瓜HTML报告与量角器 [英] Cucumber HTML report with Protractor

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

问题描述

我使用量角器与黄瓜(js)。我想生成报告文件就像Cucumber-JVM版本。

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.

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

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天全站免登陆