Acceptance criteria
Last updated
A story says what someone wants; it doesn't say when it's finished. Acceptance criteria do: a short list of things that must be true for everyone to agree the story is done. In this lesson you'll write them in the Given–When–Then form, find the edge cases nobody mentioned, and see what happens to a demo when three people each have their own idea of “done”.
By the end of this lesson you can
- Explain what acceptance criteria are for
- Write acceptance criteria in the Given–When–Then form
- Find edge cases a story's criteria must cover
Three pictures of “done”
Take the story "As a patient without a smartphone, I want a queue number by text message, so that I can wait at home." Ask three people what "done" looks like:
| Who | Pictures “done” as… |
|---|---|
| Marco, who builds it | A text comes back with a number. Works on his phone. |
| Ate Cora, who asked for it | Patients also learn roughly how long they’ll wait, and it never gives out more than 60 numbers. |
| Rina, who tests it | It handles the 61st text, texts after closing, and a family texting twice from one phone. |
None of them is wrong. They just haven't agreed. Acceptance criteria are the list of things that must all be true for the story to count as done, agreed before it's built. They're the "confirmation" in lesson 3.3's card, conversation, confirmation.
Given, when, then
A widely used form for criteria comes from Dan North's work on behaviour-driven development (2006):
- Given the situation before: "Given 60 numbers are already out today"
- When someone does something: "when a patient texts PILA"
- Then what should happen: "then they're told the centre is full and when to try again"
Each criterion is one example of the behaviour, concrete enough that anyone could try it and see whether it passes. Plain checklists work too ("Never more than 60 numbers a day"); the point is that each line can be checked. Lesson 6.5 turns these lines into automated tests almost word for word.
Write the criteria, and the edge cases
The usual case is the easy part. Bugs live in the edge cases: the full day, the closed centre, the phone that's off, the family texting twice. Ask "what if…?" about every number and every time in the story.
- At least three criteria (not yet)
- Each uses Given, when and then (not yet)
- Rina’s test 1 is covered: the 61st text of the day (not yet)
- Rina’s test 2 is covered: a text at 5:10 p.m. (not yet)
- Rina’s test 3 is covered: a phone that already holds a number (not yet)
- Says what the patient is told, not how the code works (done)
Two weeks, with and without
- Monday The story goes on the board: “a queue number by text message”. Everyone nods.
- Wednesday Marco gets a number back on his phone. He moves the card to Done.
- Thursday Rina sends 61 texts. Number 61 is given out; so are 62 and 63.
- Friday Demo for Kap. Ernesto. Ate Cora asks where the waiting time is. A text at 5:10 p.m. gets a number for a closed centre.
- Week 2 The story goes back to Doing. Three people each say they were clear.
Without acceptance criteria: Everyone agreed on the story and nobody agreed on done. The demo showed that, in front of the captain.
Switch to the other side to compare.
Spot the trap: “works correctly”
The criteria for the priority-lane story say: “The priority lane works correctly and is user-friendly.”
What happens if…
Check what you learned
Sources
Every claim on this page comes from these sources: the standard, the founding text of a method, a study, or the official record of a project, from the body that publishes it. Industry reports are labelled as such.
- Dan North, “Introducing BDD” (2006): where the Given–When–Then form comes from
- Martin Fowler: GivenWhenThen: the form explained, and how it maps to tests
- Ron Jeffries, “Essential XP: Card, Conversation, Confirmation” (2001): confirmation: the tests that show a story is done