Writing User Stories

A user story represents a small piece of business value that a team can deliver in a Sprint iteration. While traditional requirements (like use cases) try to be as detailed as possible, a user story is defined incrementally, in three stages:

  • The brief description of the need

  • The conversations that happen during backlog refinement and iteration planning to solidify the details

  • The tests that confirm the story's satisfactory completion

Well-formed stories will meet the criteria of Bill Wake's INVEST acronym:

Independent

We want to be able to develop in any sequence.

Negotiable

Avoid too much detail; keep them flexible so the team can adjust how much of the story to implement.

Valuable

Users or customers get some value from the story.

Estimatable

The team must be able to use them for planning.

Small

Large stories are harder to estimate and plan. By the time of iteration planning, the story should be able to be designed, coded, and tested within the iteration.

Testable

Document acceptance criteria, or the definition of done for the story, which lead to test cases.

 

Why User Stories?

  • Keep yourself expressing business value

  • Avoid introducing detail too early that would prevent design options and inappropriately lock developers into one solution

  • Avoid the appearance of false completeness and clarity

  • Get to small enough chunks that invite negotiation and movement in the backlog

  • Leave the technical functions to the architect, developers, testers, and so on

How Do I Write User Stories?

When getting started with stories, a template can help ensure that you don't inadvertently start writing technical tasks:

As a <user type>, I want to <function> so that <benefit> .

Examples:

  • As a consumer, I want shopping cart functionality to easily purchase items online.

  • As an executive, I want to generate a report to understand which departments need to improve their productivity.

Try to avoid the generic role of User when writing user stories. User stories are about all of the role who interact with the system or who realize some value or benefit from the system. Not all actors are end users. For example, a role could be another system or someone who wants certain functionality in order to buy your product but will never actually use the product. It may be useful to create aggregate roles (such as consumer) and specialized roles (such as browser or frequent shopper).

What Size Should a User Story Be?

A story should be small enough to be coded and tested within an iteration—ideally just a few days. When a story is too large, it is called an epic. Backlog items tend to start as epics when they are lower priority. For release planning epics should be broken down into smaller chunks, but not so small that you have moved into detailed design.

How Detailed Should a User Story Be?

Too broad

  • A team member can view iteration status

Too detailed

  • A team member can view a table of stories with rank, name, size, package, owner, and status.

  • A team member can click a red button to expand the table to include detail, which lists all the tasks, with rank, name, estimate, owner, status.

Just right

  • A team member can view the iteration's stories and their status with main fields.

  • A team member can view the current burndown chart on the status page, and can click it for a larger view.

  • A team member can view or hide the tasks under the stories.

  • A team member can edit a task from the iteration status page.

When Do I Add Detail?

Acceptance criteria provide the Definition of Done for the story. As details about the story evolve, capture the critical ones as acceptance criteria. The product owner should list as many acceptance criteria as possible in order to clarify the intent of the story. Regardless of how detailed the acceptance criteria are, the team should have a conversation about them and adjust the acceptance criteria to capture the results of the discussion. Once an iteration has begun, testers can formalize acceptance criteria into acceptance tests.

Who Uses User Stories?

Creation: The customer, customer proxy, product owner, and anyone else who identifies a need for the product can contribute user stories.

Ownership and maintenance: The product owner owns the user stories and is responsible for writing, gathering, maintaining, and prioritizing.

Usage: Developers, testers, technical writers use user stories to be able to know what to implement and when they are done. Product owners track overall progress based on the status of the user stories. Management tends to track user stories rolled up to epics or features.

What Are the Top Mistakes That People Make?

  • Too formal or too much detail. Product owners with good intentions often try to write extremely detailed user stories.  If a team sees a story at iteration planning that looks like an IEEE requirements document, they often assume that all the details are there and will skip the detailed conversation.

  • Technical tasks masquerading as stories. Much of the power of Agile comes from having a working increment of software at the end of each iteration.  If your stories are really just technical tasks, you often do not end up with working software at the end of each iteration, and you lose flexibility in prioritization.

  • Skipping the conversation. Stories are intentionally vague before iteration planning.  If you skip the acceptance criteria conversation, you risk moving in the wrong direction, missing edge cases or overlooking customer needs.


How to Split User Stories

Working from a prioritized backlog of small user stories allows a team to get value and high-quality feedback on frequent intervals. Many teams struggle to split large user stories into small stories in a useful way. Instead of ending up with small vertical slices through their architecture, they get stories that look more like tasks or architectural components and fail to experience the value or feedback small stories should provide.

Fortunately, story splitting is a skill that can be learned in a relatively short time. Teams can go from struggling to fluently splitting stories with just a couple hours of practice and some simple tools. To help you learn story splitting,

Patterns for Splitting User Stories is my original article that outlines 9 kinds of functional complexity in large stories and approaches to split through each one. It has a cheat sheet of example stories for each pattern.

My How to Split a User Story poster walks through the questions Richard Lawrence uses when coaching a team to split their own stories.


Defining Acceptance Criteria

So how can we make sure that user stories are completed correctly and comply with a client’s demands? This is where acceptance criteria come into play. Acceptance criteria are a formalized list of requirements that ensure that all user stories are completed and all scenarios are taken into account. Put simply, acceptance criteria specify conditions under which a user story is fulfilled. Concisely written criteria help development teams avoid ambiguity about a client’s demands and prevent miscommunication.

Writing acceptance criteria is not only important for eliciting the vision of a product from your client, but for the development process as well. It’s natural that different people see the same problem from different angles. Clearly written criteria introduce a single solution to the functionality you intend to implement.

What are Acceptance Criteria Used For?

  • To define boundaries. Acceptance criteria help development teams define the boundaries of a user story. In other words, acceptance criteria help you confirm when the application functions as desired, meaning that a user story is completed.

  • To reach consensus. Having acceptance criteria synchronizes the development team with the client. The team knows exactly what conditions should be met, just as the client knows what to expect from the app.

  • To serve as a basis for tests. Last but not least, acceptance criteria are a cornerstone of positive and negative testing aimed at checking if a system works as expected.

  • To allow for accurate planning and estimation. Acceptance criteria scenarios allow for the correct division of user stories into tasks so user stories are correctly estimated and planned.

Who Writes Acceptance Criteria and When?

Either a client or a development team writes acceptance criteria. As a rule, criteria written by a product owner (the client) are reviewed by a member of the development team to make sure that the criteria are clearly specified and that there are no technical constraints or inconsistencies from the development perspective. Such flow is an excellent way to collaborate if a product owner has some experience in software development and is aware of how to write project documentation.

If you prefer to assign writing acceptance criteria to the development team, then a requirements analyst, project manager or QA specialist should deal with this task, since they know the technology stack and the feasibility of features.

Remember that acceptance criteria should be specified upfront and never after the development stage has started. Therefore, a team and a product owner should agree on minimum deliverables that will meet the product owner’s requirements.

How to Write Acceptance Criteria

There are several types of acceptance criteria. The most popular are rules-oriented (in the form of a list) and scenario-oriented (in the form of scenarios that illustrate each criterion). The scenario-oriented type is popular among Agile teams since it helps with getting across requirements, envisaging various use cases, and further using scenarios for manual and automated acceptance tests.

The common template for describing acceptance criteria using a scenario-oriented approach is the Given/When/Then format that is derived from behaviour-driven development (BDD). The Given/When/Then format is used for writing acceptance tests that ensure that all the specification requirements are met.

This format is convenient for humans (since it’s written in a familiar cause-and-effect manner) as well as for automated testing tools like Cucumber and RSpec. For example, when we build a website that has two types of users ‒ logged-in users and guests ‒ we’re likely to write the following acceptance criteria for a user story that defines the sign-in feature for a logged-out user:

As a logged-out user
I want to be able to sign in to a website
So that I can find acess my personal profile

Scenario: System user signs in with valid credentials
“Given I’m a logged-out system user
and I’m on the Sign-In page
When I fill in the “Username” and “Password” fields with my authentication credentials
and I click the Sign-In button
Then the system signs me in”

The Given/When/Then template helps you reduce the time spent on writing test cases since you describe the system’s behaviour upfront. We prefer writing acceptance criteria with the first-person “I” since it helps us talk from a user’s perspective and keep a user’s needs in mind.

Here are a few tips that’ll help you write great acceptance criteria:

  • Keep your criteria well-defined so any member of the project team understands the idea you’re trying to convey.

  • Keep the criteria realistic and achievable. Define the minimum piece of functionality you’re able to deliver and stick to it. On the other hand, don’t try to describe every detail since you risk cluttering up your backlog and getting buried under many small tasks.

  • Coordinate with all the stakeholders so your acceptance criteria are based on consensus.

  • Create measurable criteria that allow you to adequately estimate development time so you’re able to stay within budget and time constraints.

  • Consider providing checklists that enable you to see what user stories are covered with acceptance criteria.


Template

Below is a sample user story template.

Title

  • Enter story title

RTM-Team

  • Assign

Labels

  • If any

Description

As a <specific user> I want to <do a thing> so that <business value>.

Acceptance Criteria

Given <criterion>, when <something happens> then <this outcome results>.

Conditions

  • Include any business rules

  • Include any design specifications

  • Include any content specifications

  • Include any technical specifications

  • Include any analytic specifications

Exceptions

  • if any



Epic

  • If any

Effort

  • Story points

Sprint

  • Assign

Priority

  • C, H, M, L

Issue Links

  • If any

Component

  • If any

TIP: If User Story requires more than two or three Acceptance Criteria consider splitting it, unless it can be done in a single sprint.


Reference Material

Articles

Videos