You are reading the documentation for gurkencheck 0.0.5. Go to the latest version.

gurkencheck A linter for Gherkin feature files.

only-one-when

One action per scenario.

What it does#

A scenario should test one action. Two When steps usually means two scenarios have been joined together, which makes a failure harder to read. By default an And step following a When counts as another When, because it is another action. If your team writes one action across several And steps, turn countAnd off and only real When keywords are counted.

Turning it on#

Add this to your .gurkencheckrc:

{
  "only-one-when": ["on", {"countAnd": true}]
}

Settings#

SettingValueIf you leave it outWhat it does
countAnd true or false true Whether an And step following a When counts as another When. Set it to false to count only real When keywords.

Examples#

Passes
Feature: Logging in

  Scenario: A known user logs in
    Given I am a known user
    When I log in
    Then I see my dashboard
Fails
Feature: Logging in

  Scenario: A known user logs in and out
    Given I am a known user
    When I log in
    When I log out
    Then I see the front page

gurkencheck reports: Scenario "A known user logs in and out" contains 2 When statements (max 1)