简体   繁体   English

机器人框架标记测试为预期失败或 XFAIL

[英]Robot Framework Marking Test as Expected Failure or XFAIL

Is there a way to mark a test as XFAIL in robot framework?有没有办法在机器人框架中将测试标记为 XFAIL? I would like to execute the tests and if they have a defect tag associated with them I would like to mark them as XFAIL.我想执行这些测试,如果它们有与它们关联的缺陷标签,我想将它们标记为 XFAIL。

Is it possible to implement this using ResultWriter or any other module.是否可以使用 ResultWriter 或任何其他模块来实现这一点。

I found this as a workaround that seems to be acceptable: Add this to your test case:我发现这是一种似乎可以接受的解决方法:将其添加到您的测试用例中:

# REMOVE WHEN FIXED!
Pass execution
...  This test fails and is a known bug! (add bug ref here)
...  Known Bugs

This way known bugs are forced to pass but are tagged as "Known Bugs" and are visible in the run log.通过这种方式,已知错误被强制通过,但被标记为“已知错误”并且在运行日志中可见。

If having support for multiple test case statuses is important, have a look at the Robot Framework plugin for generating XML files that are compatible with the Allure reports.如果支持多个测试用例状态很重要,请查看Robot Framework 插件以生成与 Allure 报告兼容的 XML 文件。 Have a look here for an example report .在这里查看示例报告

In the Allure reporting there are 5 statuses (Failed, Broken, Cancelled, Pending and Passed) in addition to 5 severity statuses (Blocker, Critical, Normal, Minor & Trivial).在 Allure 报告中,除了 5 种严重性状态(阻塞、严重、正常、轻微和普通)之外,还有 5 种状态(失败、损坏、取消、待处理和通过)。 As Robot doesn't support these statuses a lookup is done on the set tags and based on those it determines the Allure Status and Severity.由于 Robot 不支持这些状态,因此会在设置的标签上进行查找,并根据这些标签确定 Allure 状态和严重性。

In case Allure Report plugin doesn't work for you, perhaps you can use it's approach to generate a log file of your own through Robot Listener functionality .如果 Allure Report 插件对您不起作用,也许您可​​以使用它的方法通过Robot Listener 功能生成您自己的日志文件。 This is a set of predefined events that you can create a class for.这是一组可以为其创建类的预定义事件 Log Message and Message being two of particular interest to you. Log Message 和 Message 是您特别感兴趣的两个。

The other one is a recently released project Robot Background logger that extends the standard logger class of Robotframework.另一个是最近发布的项目Robot Background logger ,它扩展了 Robotframework 的标准记录器类。 This should provide some control over the formatting of the message.这应该提供对消息格式的一些控制。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM