gurkencheck A linter for Gherkin feature files.

no-examples-in-scenarios

Reminds you that Examples belong to a Scenario Outline.

What it does#

Current versions of Gherkin treat Scenario and Scenario Outline alike, so the rows of an Examples table under a plain Scenario do run, one scenario each. The keyword still tells a reader what they are looking at: a Scenario reads as one example, and the placeholders in it look like literal text. Older tools, and some other implementations, ignore the table altogether. Writing Scenario Outline says it is a template, and runs the same everywhere.

Turning it on#

Add this to your .gurkencheckrc:

{
  "no-examples-in-scenarios": "on"
}

Settings#

This rule has no settings. Switch it on with "no-examples-in-scenarios": "on".

Examples#

Passes
Feature: Logging in

  Scenario Outline: Logging in as <role>
    Given I am a <role>
    When I log in

    Examples:
      | role  |
      | admin |
      | guest |
Fails
Feature: Logging in

  Scenario: Logging in as <role>
    Given I am a <role>
    When I log in

    Examples:
      | role  |
      | admin |
      | guest |

gurkencheck reports: Cannot use "Examples" in a "Scenario", use a "Scenario Outline" instead