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

gurkencheck A linter for Gherkin feature files.

up-to-one-background-per-file Always on

At most one Background per file.

What it does

A Background is the shared setup for the whole Feature, so there can only be one of them. A second Background stops the file being read.

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.
{
  "up-to-one-background-per-file": "on"
}

Settings

This rule has no settings. Switch it on with "up-to-one-background-per-file": "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

  Background:
    Given I am a known user

  Background:
    Given I am on the login page

  Scenario: Logging in works
    When I log in

gurkencheck reports: Multiple "Background" definitions in the same file are disallowed