You are reading the documentation for gurkencheck 0.0.8. Go to version 0.0.10.

gurkencheck A linter for Gherkin feature files.

background-before-scenarios Always on

A Background has to come before the Scenarios it applies to.

What it does#

A Background is the shared setup that runs before every Scenario in its Feature, so Gherkin expects it above them. Written underneath, the file cannot be read at all. The fix is to move it to the top, not to delete it.

Turning it on#

Add this to your .gurkencheckrc:

// Always on. Listing it is accepted and does nothing;
// asking for it to be off is an error.
{
  "background-before-scenarios": "on"
}

Settings#

This rule has no settings. Switch it on with "background-before-scenarios": "on".

Examples#

Passes
Feature: Logging in

  Background:
    Given I am a known user

  Scenario: Logging in works
    When I log in

  Scenario: Logging out works
    When I log out
Fails
Feature: Logging in

  Scenario: Logging in works
    When I log in

  Background:
    Given I am a known user

gurkencheck reports: A "Background" must come before the Scenarios it applies to