Search code examples
rubycucumberbddgherkin

How to ignore particular example in cucumber


As a test automation engineer. I'd like to exclude some examples in runtime. For example:

Scenario: Some simple scenario
 Given I logged in as <local> user
 When  I visit home page
 Then  I should see <local> logo

Examples: User
 |local|
 |UK   |
#ignore 'Spain'
 |Spain|

Solution

  • A possible approach I'd suggest is to use tags:

    Scenario Outline: Some simple scenario
      Given I logged in as <local> user
      When  I visit home page
      Then  I should see <local> logo
    
      Examples:
        | local |
        | UK    |
    
      @wip
      Examples:
        | local |
        | Spain |
    

    This will, by default, skip the "work in progress" tests. There are also other approaches you could take, to run the tests as "expected failures".