Definition

The Given-When-Then is a template with the goal of providing guidance when writing acceptance tests for a User Story:

  • (Given) some context. In this step we define the start data.
  • (When) some action is carried out. In this step we define a key action.
  • (Then) a particular set of observable consequences. In this step we certificate everything.

Tools such as JBehave or Cucumber encourage the use of this template.

 

Origins

It was first introduced in a blog post by Dan North. You can see it here: Introducing BDD.