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

gurkencheck A linter for Gherkin feature files.

keywords-in-logical-order

Keeps Given, When and Then in that order.

What it does

A scenario reads as a small story: first the situation (Given), then the action (When), then the result (Then). Going backwards usually means two scenarios have been squashed into one.

Turning it on

Add this to your .gurkencheckrc:

{
  "keywords-in-logical-order": "on"
}

Settings

This rule has no settings. Switch it on with "keywords-in-logical-order": "on".

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
    Given I am a known user
    Then I see my dashboard
    When I log in

gurkencheck reports: Step "When I log in" should not appear after step using keyword then