« Back to Index

[Cucumber Gherkin Template Feature File]

View original Gist on GitHub

Tags: #gherkin #cucumber #userstory #story #feature #scenario

1. Template.feature

Feature: <title>
  
  In order to <do something>
  As a <user>
  I want to <achieve some goal>

  Scenario: <title>
  
    <additional description>
  
    Given <some state>
    When <some action>
    Then <some expectation> with <some_name> # where <some_name> is actual Gherkin syntax for a table lookup!

    Examples:
      | some_name |
      | A         |
      | B         |
      | C         |
      | ...etc    |

  Tasks: # non-standard syntax, but useful for most 'project planning' purposes

    - What: ...
      Why: ...
      Impact: ...

2. Example.feature

Feature: Resilience

  In order to provide content to our users
  As an organisation
  We want our websites/apps and their dependencies to be available

  Scenario: Fastly Unavailable

    Fastly is our CDN provider, and is effectively the 'front door' to the
    majority of our publicly consumed content.

    Given Fastly is unavailable
    When a user requests a public buzzfeed resource (e.g. www.buzzfeed.com)
    Then we expect the resource to be provided

  Tasks:

    - What: Investigation of 'stale rendering' vs 'multi-region infrastructure'
      Why: Understand the risk/cost implications of each approach.
      Impact: We'll be able to proceed with the approach which provides the most value.

    - What: Migration of CDN logic to Perimeter.
      Why: We want to reduce the amount of unfamilar code.
      Impact: Will make migrating to an alternative CDN provider easier as there is less logic coupling.

3. Advanced Table Lookup.feature

Feature: Restaurant

  Scenario Outline: eating

    Given there are <start> cucumbers
    When I eat <eat> cucumbers
    Then I should have <left> cucumbers

    Examples:
      | start | eat | left |
      |    12 |   5 |    7 |
      |    20 |   5 |   15 |