User Story Acceptance Criteria

About user stories

The User Story is an effective way to document the actions and needs from the customer viewpoint. The story in it's conciseness explains the role of the user, what their goal is and provides a motivation which links stories to each other. The motivation also helps the reader to see how this story relates to the overall business process.

What is the Acceptance Criteria for?

To be able to work on a story, the team members need to understand what is the expected outcome. The expected outcome varies for each story and the product owner needs to make sure that everybody knows what it is in each case. This is where the acceptance criteria steps in. It is a tool for verbalising what distinguishes a done story from work in progress.

Optimally the acceptance criteria is defined exclusively by the customer, but they may require help from the product owner or even the team in identifying and formulating a practical criteria. If the criteria comes solely from the team, it may lack objectivity and user perspective.

Acceptance is not the only stage which needs a criteria. In addition to user story acceptance criteria, there are also criteria which is consistent with all stories the team delivers. This criteria is decided by the team and recorded in the Definition of Done (DoD). At the end of each sprint, stories are subjected to both the Acceptance Criteria and the DoD and only the deliverables which meet all criteria can be released to the customer. The remaining stories return to the backlog and generally are prime candidates for the next sprint.

Should I write a user story acceptance criteria? What if I don't? There are quite a lot of professionals who don't use a written acceptance criteria. In some cases it's not a big problem, since some features are quite intuitive. Testing engineers are often able to deduct and use their intuition to form the criteria in their heads. Make no mistake, where there is testing, there is an acceptance criteria. It's just made up by one or more testing engineers with or without consulting a developer, the product owner or someone else. You cannot avoid having an acceptance criteria. But you are free to decide if you want to contribute to it.

How to write a good Acceptance Criteria?

Imagine you're going somewhere. How do you know you've arrived to your destination? Let's say the destination is a restaurant. When your navigation app takes you near the address, you start looking for the sign that says the name of the restaurant. If there is no sign to be found, you might go in and ask if they know where the restaurant is. You might check the address from one or more alternative sources.

A number of things can go wrong in the above example, and that's what the testing engineer would be figuring out if this were a product test case. But the example shows you a criteria which is easily understood in the same way by anyone who reads it. You could verbalise the above criteria like this:

After navigating to the address of the restaurant, the diner sees the restaurant sign on the building.

We can see from the criteria that there are quite a few options available in an acceptance criteria. Do we want the sign to be anywhere on the building, above the door, near it (how near?), just visible enough (how to estimate this?), etc. Is the sign visible if it's dark outside or if the sign is not lit? These are the kind of details the testing engineer may need to be able to cover all the cases.

We need absolute, binary (yes/no) acceptance criteria which is easy to test against. The story either passes the criteria or it doesn't. All team members should be able to evaluate the story exactly the same way against its acceptance criteria without interaction with other team members. If it becomes obvious that the criteria has a flaw, it can be discussed and iterated further. But the necessity is that the criteria needs to show us if the story is done or not.

When to write the Acceptance Criteria?

It's good to have an acceptance criteria when developers start designing the implementation. Having an acceptance criteria makes it easier to explain what the story is about. It's also a good tool for questioning the requirement. When you get the team involved, you're going to get great input and ideas both on the implementation but also the requirement itself. You should embrace any feedback.

The acceptance criteria should not be considered sacred. If it has room for improvement, it can improve through input from the team. If the acceptance criteria was "given from above" and you can't touch it, the customer may or may not end up happy. Often test engineers provide the best comments and ideas for the criteria.

It is true that stories should not be altered during the sprint, but if the team considers an acceptance criteria to be lacking in some way, it should be improved, even in the middle of a sprint.

Good and Bad Examples of an Acceptance Criteria

Acceptance Criteria Analysis
The user is able to use the browser's "back" button. So, what happens when the user does that?
When the user presses "back", the view is restored using the session cookie or the query string. Depending on the case, technical specifics are not always an optimal way to describe an outcome. The user perspective should generally be present in some way in the acceptance criteria. Also, avoid providing options, since the best criteria is binary.
The user is able to click the browser "back" button and then continue using the application without any errors caused by the back button. Ok, this is better, but you should note what the scope of the test is. This sounds like it can be applied to any or all views in the application. We should assume the scope of the test is the story at hand.

Acceptance Criteria on different levels

Many of the examples are about unit testing, but the concept of an acceptance criteria works on many levels. You can use it for business requirements as well as epics and other items you use to describe a goal.

For a higher level business requirement, also the acceptance criteria needs to be on a higher level.

For example:

The user is able to log in to our web application using their social media accounts.

This acceptance criteria doesn't say anything about buttons, accessibility, interfaces or any other technical detail, since its content is more of a strategic importance. But it implies questions like "which social media accounts need to be supported?" and "does the user still need an account in our application or is the authentication enough?". This is an example of a good business requirement, which leaves room for the product owner to do some research and document the need on the story level.

Given - when - then

One of the formal ways of writing acceptance criteria is the given-when-then -notation. It consist of 1) a starting state, 2) an event or action, and 3) the result.

A

GIVEN

The starting state

"I'm out of milk"

B

WHEN

Event/action

"I go to the crocery
store to buy it"
C

THEN

The result

"I have milk"

Here are some further examples of the given-when-then -notation:

Given When Then
The user has filled out all the contact information correctly except for the email address The user inputs an email address which is missing the @-sign The user gets an error message saying that the email address is not in the correct format
The scrum master has created three consecutive 2-week sprints using Agile Maximum The scrum master extends the first sprint to 3 weeks The latter sprints move one week forward while their lengths remain at 2 weeks and the holiday list is updated for each sprint

This notation is also used by some testing tools such as Selenium. The given-when-then -notation, just like any proper acceptance criteria, serves both the implementation and the testing of a story.

Summary

1

Clarity Keep the acceptance criteria simple and binary so that there is no room for interpretation

2

Level State the needs on a high enough level and let others fill in the gaps

3

Flexibility If the acceptance criteria proves lacking, you should improve it before or during the sprint

4

User perspective Avoid technical criteria where possible

BACK TO AGILE MAXIMUM