Skip to content

Feature

To describe a capability of your application, use the Feature keyword. It is the top-level keyword in a Gherkin file and groups related scenarii under a single description.

To structure a Feature file, you can use the following parts:

  • Scenario — to illustrate a concrete example of a behaviour
  • Scenario Outline — to run a scenario template with variable Examples
  • Background — to define shared Given steps that run before each Scenario
  • Rule — to group scenarii under a single business rule
  • Steps — to describe actions with Given, When, Then, And, But
  • Tags — to annotate and filter scenarii
  • DocStrings — to pass multi-line text arguments to steps
  • DataTables — to pass tabular data arguments to steps
  • Step expressions — to match steps with parameters

To add a description to your Feature, write free-text lines between the Feature: keyword and the first Scenario, Background, or Rule. vitest-cucumber parses and preserves this description.

To validate your feature file, call loadFeature. vitest-cucumber parses your file and checks that:

  • You have Examples in your Scenario Outline
  • You use Examples variables in your Scenario Outline steps

Since 3.3.2 you can use Example, Scenarios and Scenario Template synonyms.

To ensure full coverage, vitest-cucumber checks after all unit tests:

  • non tested Scenario and/or Scenario Outline
  • non tested Scenario and/or Scenario Outline steps
  • non tested Feature
  • non tested Rule