【问题标题】:How do I make cucumber exit a scenario?如何让黄瓜退出一个场景?
【发布时间】:2017-09-14 03:18:07
【问题描述】:

我有一个场景大纲。对于某些场景,我想跳过某些步骤。我使用了 Cucumber.wants_to_quit 但它似乎不起作用。此方法之后提到的步骤无论如何都会在所有方案中运行。 我正在使用 Ruby、硒、黄瓜。

【问题讨论】:

    标签: ruby google-chrome selenium cucumber


    【解决方案1】:

    这是一个示例Directly from the Docs,说明如何创建允许您跳过的功能:

    给定一个名为“feature/test.feature”的文件

    Feature: test
      Scenario: test
        Given this step says to skip
        And this step passes
    

    使用标准步骤定义和诸如“features/step_definitions/skippy.rb”之类的文件:

    Given /skip/ do
      skip_this_scenario
    end
    

    如果你运行cucmber -q 那么前一个将传递为:

    Feature: test
    
      Scenario: test
        Given this step says to skip
        And this step passes
    
    1 scenario (1 skipped)
    2 steps (2 skipped)
    0m0.012s
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-12-15
      • 1970-01-01
      • 1970-01-01
      • 2020-07-11
      相关资源
      最近更新 更多