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.
Anatomy
Section titled “Anatomy”To structure a Feature file, you can use the following parts:
Scenario— to illustrate a concrete example of a behaviourScenario Outline— to run a scenario template with variableExamplesBackground— to define sharedGivensteps that run before eachScenarioRule— to group scenarii under a single business rule- Steps — to describe actions with
Given,When,Then,And,But Tags— to annotate and filter scenariiDocStrings— to pass multi-line text arguments to stepsDataTables— 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.
Testing
Section titled “Testing”Before unit tests run
Section titled “Before unit tests run”To validate your feature file, call loadFeature. vitest-cucumber parses your file and checks that:
- You have
Examplesin yourScenario Outline - You use
Examplesvariables in yourScenario Outlinesteps
Since 3.3.2 you can use Example, Scenarios and Scenario Template synonyms.
After unit tests run
Section titled “After unit tests run”To ensure full coverage, vitest-cucumber checks after all unit tests:
- non tested
Scenarioand/orScenario Outline - non tested
Scenarioand/orScenario Outlinesteps - non tested
Feature - non tested
Rule