Skip to content

Features and roles

The product side of the spec: features with scenarios written as Given, When, Then, and the roles of the people and systems that use it.

Features

A feature is a capability described from the outside, with a title, an intent ("so that customers never pay for items we cannot ship"), a description and scenarios. Each scenario has a title and steps with the keywords Given, When, Then, And and But.

Scenarios of the feature Reserve stock at checkoutGherkin
Scenario: Every line item gets a reservation
  Given a Customer has a cart with 2 "Trail mug" and 1 "Canvas tote"
  When the Customer starts checkout
  Then a reservation holds 2 "Trail mug" for the order
  And a reservation holds 1 "Canvas tote" for the order
  And the Catalog shows 3 units of "Trail mug" available

Scenario: Checkout stops when a line item cannot be reserved
  Given a Customer has a cart with 2 "Canvas tote"
  When the Customer starts checkout
  Then no reservation is created for the order
  And the Customer is told that only 1 "Canvas tote" is left
  And payment is not requested

Features are the acceptance examples of the spec. They are published as YAML with the rest; see Spec files in your repository.

Use cases that realise a feature

A feature, and each of its scenarios, lists the use cases that realise it, in use-cases. Add them under Realised by on the feature, or in the chip row of a scenario. A use case that realises the feature as a whole goes on the feature; one that realises one scenario goes on that scenario. The Features list shows how many use cases realise each feature.

  • A feature with scenarios and no use case that realises it gets a warning: "No use case realises this feature yet."
  • These links are what the Build page rolls up per feature and per scenario, and what a feature brings into a milestone.

Roles

A role is someone or something that uses the system: Customer, Warehouse picker, Payment provider. It has a summary, a type and optional sections: description, responsibilities, and a Persona with needs and pain points.

TypeUse it for
Person (the default)People who use the system. The Persona section, with needs and pain points, is offered for people.
External systemAnother system that calls yours, such as a payment provider. It has responsibilities; needs and pain points on it get a warning.

Add a section when you have something to say; an empty section can be removed again. Use cases name the roles that call them, people or external systems. The Roles list has a Type column and filter.

Writing good scenarios

  • One behaviour per scenario, named after the outcome: "Checkout stops when a line item cannot be reserved".
  • Use the words of the glossary.
  • Keep each step to its job: Given to the state that matters, When to one action, Then to what can be observed.

Next steps