如何有条件地跳过黄瓜中的方案?

编程入门 行业动态 更新时间:2024-10-26 05:21:20
本文介绍了如何有条件地跳过黄瓜中的方案?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我如何有条件地跳过方案?

How do I conditionally skip a scenario?

例如,我希望仅在满足某些条件时才继续方案,但我不希望其注册

For example, I wish to continue a scenario only if certain conditions are met, but I do not want it to register as a failure if it's not present.

推荐答案

这是我遇到的一个问题。我编写的测试是针对具有不断变化的BE数据库的UI进行的,而我目前无法在其中输入静态数据。这意味着有时可能没有用于测试的数据。 不是通过也不是失败,只是无法运行。

This is an issue I had. The tests I write are against a UI that has a constantly changing BE database that I am currently unable to have static data in. This means that some times it is possible that there is no data for the test. Not a pass not a fail, just unable to run.

我发现最有效的方法是调用未决的黄瓜。

The way that I found to work best was to invoke a cucumber pending.

示例测试:

Scenario: Test the application Given my application has data When I test something Then I get a result

示例步骤def:

Given /^my application has data$/ do pending unless application.has_data? end

这些是我可以看到的结果:

These are the kind of results I can see:

201 scenarios (15 pending, 186 passed) 1151 steps (15 pending, 1136 passed)

值得注意的是,我进行了额外的调试,并对这些测试进行了标记,以便随时可以再次运行这些挂起的测试。

It's worth noting that I have extra debugging and have these tests tagged so that at any time I can run these pending tests again.

希望这会有所帮助, Ben。

Hope this helps, Ben.

更多推荐

如何有条件地跳过黄瓜中的方案?

本文发布于:2023-11-25 03:55:38,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1628218.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:有条件   黄瓜   跳过   方案

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!