BDD template

A practical Given/When/Then template

Given/When/Then is a compact way to describe a behavior in context. It is especially helpful when a story needs a shared, testable understanding across product, engineering and QA.

The template

Scenario: [brief behavior name]
Given [the starting state or precondition]
And [another relevant condition]
When [the user or system takes an action]
Then [the observable result]
And [another expected result or side effect]

How to fill it in

PartWhat it should sayExample
GivenThe context before the behavior starts.A customer has an active subscription.
WhenOne action or event that triggers the behavior.They cancel it from account settings.
ThenA result a person or system can observe.Renewal is turned off and the end date is shown.
AndAn additional result that belongs to the same scenario.A confirmation email is sent.

Examples to adapt

Required-field validation

Scenario: Prevent an incomplete profile from being saved
Given a signed-in user is editing their profile
When they leave the display name blank and select Save
Then the display name field shows that it is required
And no profile changes are saved

Access control

Scenario: Restrict an invoice to authorised users
Given a user does not have billing permission
When they open an invoice link
Then they see an access-denied message
And invoice details are not displayed

Common mistakes

Turn a requirement into BDD scenarios

Describe the feature in ordinary language and use CriteriaPilot to create a first draft you can refine with your team.

Create a BDD draft