Planning and requirements · lesson 4 of 10
Ideas in this lesson
AAcceptance criteriawhat must be true for a story to be done
BGiven, when, thenthe starting state, the action, the result
CEdge casethe unusual situation at the boundary
DUser storyfrom lesson 3.3

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:

One story, three pictures of done
WhoPictures “done” as…
Marco, who builds itA text comes back with a number. Works on his phone.
Ate Cora, who asked for itPatients also learn roughly how long they’ll wait, and it never gives out more than 60 numbers.
Rina, who tests itIt 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.

Acceptance criteriaKept in this browser only
  • 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)
Write each part until its checks pass.

Two weeks, with and without

  1. Monday The story goes on the board: “a queue number by text message”. Everyone nods.
  2. Wednesday Marco gets a number back on his phone. He moves the card to Done.
  3. Thursday Rina sends 61 texts. Number 61 is given out; so are 62 and 63.
  4. 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.
  5. 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”

Spot the trapBea

The criteria for the priority-lane story say: “The priority lane works correctly and is user-friendly.”

What happens if…

Check what you learned

What are acceptance criteria for?
In “Given 60 numbers are out today, when a patient texts PILA, then they’re told the centre is full”, which part is the action?
Which is an edge case for Pila’s text-message story?

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.

All sources for Simple Software Development