如何向 Cucumber 报告添加选项以删除具有特定标签的场景 [英] How to add an option to Cucumber report to remove scenarios that have a certain tag

查看:10
本文介绍了如何向 Cucumber 报告添加选项以删除具有特定标签的场景的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在黄瓜报告上有一个选项,以从结果和数字中静音/隐藏带有给定标签的场景.

I want to have an option on the cucumber report to mute/hide scenarios with a given tag from the results and numbers.

我们有一个竹子版本来运行我们的空手道功能和场景存储库.最后它会生成漂亮的黄瓜 html 报告.在overview-features.html"上我想在右上角添加一个选项,其中包括功能"、标签"、步骤".和失败",即排除失败";或类似的东西.单击时提供与 overview-features.html 相同的确切信息,除了标记有特殊标记的任何场景,例如 @bug=abc-12345,将从报告中删除并从数字中排除.

We have a bamboo build that runs our karate repository of features and scenarios. At the end it produces nice cucumber html reports. On the "overview-features.html" I would like to have an option added to the top right, which includes "Features", "Tags", "Steps" and "Failures", that says "Excluded Fails" or something like that. That when clicked provides the same exact information that the overview-features.html does, except that any scenario that's tagged with a special tag, for example @bug=abc-12345, is removed from the report and excluded from the numbers.

为什么我需要这个.我们有一些失败的现有场景.它们因我们自己的软件中的缺陷而失败,这些缺陷可能在 6 个月到一年内无法修复.我们用指定的标签@bug=abc-12345"标记了它们.我希望它们从空手道竹子构建结束时生成的黄瓜报告中静音/排除,这样我就可以快速查看通过的功能/场景的数量,看看它是否为 100%.如果是,那构建很好.如果没有,我需要进一步研究它,因为我们似乎有一些回归.如果没有这些预期会失败的场景,并且会继续失败直到它们被解决,那么查看所有单独的功能文件报告并查看失败的场景然后寻找原因是非常乏味和耗时的.我不希望它们完全删除,因为我需要知道它们何时开始通过,以便我可以返回并从场景中删除标签.

Why I need this. We have some existing scenarios that fail. They fail due to defects in our own software, that might not get fixed for 6 months to a year. We've tagged them with a specified tag, "@bug=abc-12345". I want them muted/excluded from the cucumber report that's produced at the end of the bamboo build for karate so I can quickly look at the number of passed features/scenarios and see if it's 100% or not. If it is, great that build is good. If not, I need to look into it further as we appear to have some regression. Without these scenarios that are expected to fail, and continue to fail until they're resolved, it is very tedious and time consuming to go through all the individual feature file reports and look at the failing scenarios and then look into why. I don't want them removed completely as when they start to pass I need to know so I can go back and remove the tag from the scenario.

关于如何实现这一点的任何想法?

Any ideas on how to accomplish this?

推荐答案

空手道 1.0 对报告系统进行了大修,主要变化如下.

Karate 1.0 has overhauled the reporting system with the following key changes.

  • Runner 完成后,您可以调整结果,甚至重新尝试一些测试
  • 您可以注入自定义 HTML 报告渲染器
  • after the Runner completes you can massage the results and even re-try some tests
  • you can inject a custom HTML report renderer

这将要求您深入了解细节(其中一些尚未记录)并编写一些 Java 代码.如果这不是一个选项,您必须考虑到空手道不支持您的要求.

This will require you to get into the details (some of this is not documented yet) and write some Java code. If that is not an option, you have to consider that what you are asking for is not supported by Karate.

如果您愿意走这条路,这里是您需要开始的链接.

If you are willing to go down that path, here are the links you need to get started.

a) 如何后处理"的示例呈现报告之前的结果数据:RetryTest.java 并参见 https:///stackoverflow.com/a/67971681/143475

a) Example of how to "post process" result-data before rendering a report: RetryTest.java and also see https://stackoverflow.com/a/67971681/143475

b) 负责可插拔"的代码.报告,您可以在其中实现一个新的 SuiteReports 理论上.在 Runner 中有一个 suiteReports() 方法,您可以调用它来提供您的实现.

b) The code responsible for "pluggable" reports, where you can implement a new SuiteReports in theory. And in the Runner, there is a suiteReports() method you can call to provide your implementation.

另见:https://twitter.com/KarateDSL/status/1427638609578967047

这篇关于如何向 Cucumber 报告添加选项以删除具有特定标签的场景的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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