How to write a user story a tester can check

How to write a user story backwards: name who would notice it going wrong and what they would see, then write the As a, I want, so that sentence last.

Three clear glass slabs lean in a row against an upright smoked glass block whose top edge glows orange

To write a user story, begin with the check and finish with the sentence. Name who would notice if the change were wrong and what they would see, settle the open points in conversation, then write “As a [role], I want [capability], so that [benefit].” A story is finished when someone can check it, so the card comes last.

The sentence is the smallest part of a user story

The usual guide to the user story teaches one sentence. Mike Cohn, who advocates the three-part template, traces it to Rachel Davies at Connextra, a UK company, in the early 2000s, and names its parts who, what and why. That sentence is worth learning, and it is a third of the job.

Ron Jeffries set out the other two thirds in 2001. In Card, Conversation, Confirmation he gives a user story three aspects. The card is “a token representing the requirement” and “does not contain all the information that makes up the requirement.” The requirement itself travels “through conversation,” and the confirmation is the acceptance test, in which the customer tells the programmers “how she will confirm that they’ve done what is needed.”

A team that writes in that order can stop at the card, because the card looks finished. Write in reverse and start from the confirmation, the only one of the three that a build can fail. Worked criteria in each format are collected in acceptance criteria examples. What follows is how a story comes to have any.

A story starts with who would notice it going wrong

Take a rough request: “Let patients reschedule their appointments online.” A clinic’s practice manager wrote it, and a developer could start on it today. Nobody could check it, because it names no person and no result.

Before touching the template, put two questions to the request. Who would notice if this shipped wrong? What would they see? Each answer is a check in rough form.

Who would noticeWhat they would see if it were wrongThe check it becomes
The patientThey arrive at the new time and the clinic expects them at the old oneAfter a move, the patient’s booking page, the confirmation message and the clinic calendar show the same new time
The receptionistThe old slot still looks taken, so nobody else can book itThe old slot is open to other patients as soon as the move is confirmed
The practice managerA move made shortly before the appointment leaves a gap nobody can fillInside the clinic’s cutoff, the page offers the phone number and no move

That is three ways to be wrong before the template has been used, and INVEST ends in Testable. In his 2003 article INVEST in Good Stories, and SMART Tasks, Bill Wake says that writing a story card “carries an implicit promise,” which he words as “I understand what I want well enough that I could write a test for it.” Writing the checks first is one plain way to keep that promise.

Wording each check so that a build can fail it is a separate skill, argued in how to write acceptance criteria.

The conversation settles what the checks leave open

The table raised questions the request never answered. How close to the appointment may a patient still move it? May they move to a different practitioner? The practice manager has to answer these. A question nobody asks gets answered anyway, by whoever is writing the code that day.

This is the conversation in Jeffries’ three, and the checks give it an agenda. He writes: “When the conversation about a card gets down to the details of the acceptance test, the customer and programmer settle the final details of what needs to be done.”

Each question ends in one of three ways. A small answer becomes a check: the manager sets the cutoff, and the last row gets a real boundary. A large answer becomes its own story, so moving to another practitioner gets a card of its own and this story stays small enough to build and test in one go. An unknown stays a question with a name beside it.

There is a limit. Wake calls a good story negotiable: “It is not an explicit contract for features; rather, details will be co-created by the customer and programmer during development.” A handful of checks agreed before the build is a starting position. Screen layouts and field lists go further than a story should, and Jeffries says of window sketches and multi-page documents that he has “almost never found this kind of document to be ideal.”

The three-part sentence is written last

Now the template is easy, because every part of it already exists.

Part of the sentenceWhere it comes fromIn the clinic story
As a [role]The first person in the who-would-notice listAs a patient with a booked appointment
I want [capability]What changes for that person, with no interface in itI want to move it to another open slot myself
so that [benefit]The reason the request was madeso that I do not have to phone the clinic during opening hours

The finished story reads:

As a patient with a booked appointment, I want to move it to another open slot myself, so that I do not have to phone the clinic during opening hours.

Beneath it sit the three checks from the first table, with the manager’s cutoff filled in, and a note that changing practitioner is a separate story. Those lines are the story’s acceptance criteria, and they were written before the sentence was.

The benefit clause does real work here. The story exists to spare the patient a phone call, and the cutoff is the one check that sends them back to the phone, so the manager knows which rule to keep as narrow as the clinic can bear.

Cohn leaves room to bend the template. He does not treat the so-that clause as mandatory, “because sometimes it just doesn’t add any value.” A copyable version, with the checks laid out beneath the sentence, is the user story template.

Weak stories fail when someone tries to check them

The usual lists of user story mistakes read as style rules. Each mistake is easier to see as a check that cannot be written.

The failureWhat it looks likeWhat trying to check it shows
The role is “user”As a user, I want to rescheduleNobody in particular would notice it going wrong, so nobody can say what wrong looks like
The capability is a solutionI want a Reschedule button on the booking pageThe only check available is that the button exists
The benefit repeats the capabilityso that I can rescheduleThere is nothing to weigh the cutoff or any other trade against
The story is a taskAs a developer, I want the booking table indexedNo one outside the team could see it pass or fail, so it belongs inside a story
The story is an epicAs a patient, I want to manage my appointmentsThe who-would-notice list keeps growing, and each cluster of rows is a story of its own
The card stands aloneA sentence with nothing beneath itThe tester invents the checks during testing, and the first disagreement happens at the demo

The last row is the one a template cannot fix. A well-formed sentence with no confirmation looks complete in a backlog, and a story can reach a sprint that way with its hardest questions unasked.

Writing backwards also names who should look at the result. The receptionist who would notice a stuck slot is the right person to try the built page. With the Notarus widget on that page, the widget captures what they are looking at and gives them a pen to circle the slot, and the console logs, network activity, page URL, viewport and browser travel with the report as captured evidence. What arrives depends on capture settings and the browser, and whether the slot should have been free is still decided by the story.

A story written this way has one sentence on the card and the rest underneath, and the rest is what gets checked.

Common questions

How do you write a user story?

Write a user story in three passes. First, name who would notice if the change shipped wrong and what they would see. Second, settle the questions those checks raise with the person who asked for the change. Third, write one sentence, 'As a [role], I want [capability], so that [benefit]', and list the agreed checks beneath it.

What are the three parts of a user story?

The user story sentence has three parts, a role, a capability and a benefit, written as 'As a [role], I want [capability], so that [benefit]'. Ron Jeffries described the story as a whole in three other parts, the card, the conversation and the confirmation, and the sentence fills only the card.

What is an example of a good user story?

A good user story names a real person, a change and a reason, with checks beneath it. For example: 'As a patient with a booked appointment, I want to move it to another open slot myself, so that I do not have to phone the clinic during opening hours', followed by checks such as the old slot becoming bookable again once the move is confirmed.

What are common mistakes when writing a user story?

Common user story mistakes are a role of 'user' that names nobody, a capability that describes a button where it should describe a change, a benefit that repeats the capability, a developer task dressed as a story, and a sentence with no checks beneath it. Each one shows up when someone tries to write down how the story would be checked.

Is the 'so that' clause of a user story required?

The 'so that' clause is optional in Mike Cohn's account of the three-part template. Cohn writes that he does not consider it mandatory because sometimes it adds no value, although he includes it nearly all of the time. The clause earns its place when the reason would change what the team builds or how a trade-off is settled.

How much detail should a user story contain?

A user story should contain the sentence, the checks agreed in conversation and any decision that would otherwise be argued twice. Bill Wake's INVEST article calls a good story negotiable and says the details are co-created by the customer and programmer during development, so screen layouts and field lists stay out of the story until the build.

The Notarus team

The people who build Notarus. We write up the decisions behind the product when the reasoning is worth more than the changelog line.

Keep reading

Reports with the evidence attached.

Start free, one script tag.

<script src="…/widget.js" data-key="pb_pub_…">