gpt4 book ai didi

cucumber - 如何跳过 cucumber 步骤?

转载 作者:行者123 更新时间:2023-12-04 13:14:04 29 4
gpt4 key购买 nike

我有这样的场景:

  • 鉴于我去这个页面
  • 当我输入 cucumber 时
  • 然后我点击
  • 然后我应该看到文字
  • 我不应该看到这条线

  • 如果我运行这个场景,它将执行所有 5 个步骤。但是我想跳过第4步(然后我应该看到文字)并执行第5步。

    请给我你的建议。提前致谢。 :)

    最佳答案

    TL; DR - 不要这样做 - 你(可能)弄错了。你不能(很容易)做到这一点。正如 Aslak 所写(Cucumber 的主要创作者之一):

    A step can have the following results:

    • undefined (no matching stepdef)
    • pending (a matching stepdef that throws PendingException)
    • passed (a matching stepdef that doesn't throw anything)
    • failed (a matching stepdef that throws an exception that isn't PendingException)
    • skipped (a step following a step that threw any exception (undefined, pending or failed))

    What you're asking for is a new kind of result - ignored. It could be implemented by throwing an IgnoredException. This would mean that skipped would have to be changed to: (a step following a step that threw any exception (undefined, pending or failed) - unless the exception was IgnoredException)

    I'm not sure I like this. It sounds like more complicated than it needs to be. You already have the necessary information that something is amiss - your step will either fail or be pending. I don't see the value in continuing to execute the following steps. You still have to implement the failing/pending step.

    As long as you're reminded that "there is work to be done here" I don't think it's wortwhile complicating Cucumber to tell you what kind of work needs to be done...

    Aslak



    整个讨论在这里: http://comments.gmane.org/gmane.comp.programming.tools.cucumber/10146

    关于cucumber - 如何跳过 cucumber 步骤?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13988125/

    29 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com