Clear Acceptance Criteria for User Stories with Examples

  • 1111512 views
  • 9 min
  • Jan 07, 2020
Maryna Z.

Maryna Z.

Copywriter

Dmitriy G.

Dmitriy G.

Head of BA Office

Share

In a perfect world, people would understand each other at a glance and nothing could create confusion among them. But in the real world we have to come up with ways to communicate our ideas clearly so that our peers don’t misunderstand us.

In software development, acceptance criteria help to properly set a client’s expectations for a product. Criteria for an app such as “I want my app to be awesome and popular with as many people as possible” don’t really tell us much; we eliminate misunderstandings between a client and a development team by referring to clearly defined acceptance criteria for user stories.

In this post we’ll talk about acceptance criteria in Agile methodologies (like Scrum and Kanban) and provide you with a few examples of well-written acceptance criteria.

Scrum, User Stories, and Acceptance Criteria Aren’t Just Buzzwords

We’ve mentioned Scrum for a good reason. Scrum is an Agile framework that helps software development teams deliver products of any complexity. At RubyGarage, we prefer to work according to the Scrum methodology, and recently we even released our own app for Scrum poker - Scrummer.

With Scrum (just like with any Agile approach), we operate with such terms as “user stories” and “acceptance criteria” to ensure clear descriptions of how end-users will use an app and how a team should fulfill each task.

When we start to build a product, we cooperate with our clients to define user stories. User stories are written in the following format: “

As a (type of user), I want to (perform some action) so that I (can achieve some goal/result/value).”

The purpose of user stories is to explain the roles of users in a system, their desired activities, and what they intend to accomplish by successfully completing a user story. For Agile teams, user stories are the primary method of identifying user needs.

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.
Clear and unclear acceptance criteria
Clearly written acceptance criteria efficiently save development time

Examples of Acceptance Criteria

In this section we’ll take a look at examples of acceptance criteria written for common features present on most websites. We’ll define user stories upfront because acceptance criteria are written after we’ve specified all functionality through user stories.

Example #1

Our first user story describes the webpage search feature:

As a website user
I want to able to search on the webpage
So that I can find necessary information

According to the Given/When/Then template, the acceptance criteria would be the following:

Scenario: User searches for an item by its name
“Given that I’m in a role of registered or guest user
When I open the “Products” page
Then the system shows me the list of all products
And the system shows the “Search” section in the right top corner of the screen
When I fill in the “Search” field with the name of existing item in the product list
And I click the “Apply” button OR press the Enter key on keyboard
Then the system shows products in the Search Results section with product names matching entered product name
And the system shows the number of search results in the top of the Search Results section”

Example #2

The next example represents the acceptance criteria for a Feedback Form page. The user story would be the following:

As a website user
I want to able to submit feedback
So that the website owners can consider my opinion or concern during future website updates

Acceptance criteria for this piece of functionality would be:

Scenario: User submits feedback form with the valid data
“Given I’m in a role of logged-in or guest user
When I open the Feedback page
Then the system shows me the Submit Feedback form containing “Email”,“Name” and “Comment” fields which are required
When I fill in the “Email” field with a valid email address
And I fill in the “Name” field with my name
And I fill in the “Comment” field with my comment
And I click the “Submit Feedback” button
Then the system submits my feedback
And the system shows the “You’ve successfully submitted your feedback” flash message
And the system clears the fields of the Submit Feedback form”

Example #3

Finally, let’s specify the user story and acceptance criteria for commenting functionality on a blog. Only signed-in users are able to add comments. The user story for an “add a comment” feature would be:

As a signed-in user
I want to able to comment on a blog post
So that I can get feedback on issues

The acceptance criteria for this piece of functionality would be:

Scenario: Signed-in user leaves a comment on a blog post
“Given I’m in a role of signed-in user
When I open the page with a specific blog post
Then the system shows the “Comments” section below the blog post with the list of comments added by other users
And the system shows the “Add a Comment” field in the top of the “Comments” section
When I fill in the “Add a Comment” field with my comment
And I click the “Submit” button
Then the system saves my comment
And the system shows my comment in the top of the “Comments” section
And the system shows my username and profile picture on the left side from my comment
And the system shows “Remove” and “Edit” icons opposite my comment”

Wrapping Up

As you can see, writing acceptance criteria is truly a win-win activity for both clients and development teams: not only does it help the team know exactly what they have to do, but it keeps the client abreast of development process and lets them check that developed software meets actual business requirements.

Don’t let user stories and acceptance criteria scare you off ‒ the time you invest in describing and specifying all the features will eventually pay off. Acceptance criteria serve as a basis for use cases and test cases that ensure you achieve business goals and produce bug-free apps.

CONTENTS

Authors:

Maryna Z.

Maryna Z.

Copywriter

Dmitriy G.

Dmitriy G.

Head of BA Office

Rate this article!

Nay
So-so
Not bad
Good
Wow
148 rating, average 4.64 out of 5

Share article with

Comments (6)
Dharmesh Barot
Dharmesh Barot about 6 years ago
Hi Maryna and Dmitriy, Thanks for your clarity on writing user stories with acceptance criteria. Would you mind elaborating if field validation, field type, etc. would be captured under the acceptance criteria or use a separate supporting document like a form spec? Also, what about negative scenarios where what happens when a form validation fails? I usually write a separate story for that. Do you add as a scenario or a separate story?
Reply
Dmitriy G.
Dmitriy G. about 6 years ago
Hi, Dharmesh! Thanks for your question. There is no need to write a separate user story or scenario to capture field validations. That could be captured in acceptance criteria. Let's say that you have some user story where in some scenario you need to fill in some form and that form consists of a set of fields. You can simply create a table where you can describe requirements to each of these fields and link that table to your scenario. So for each field you need to know the next parameters: - label (defines a label for an <input> element), - description, - type (HTML input type, for example, input type="text", input type =”number” etc), - validation (where you can indicate if it's required or optional, specify validation rules, for example, for input type=”number” that could be minimum value allowed, - maximum value allowed, default value etc), - error messages (here you can indicate what error message should be shown when validation fails, for example for input type=”email” that could be: “Email can't be blank” if input is empty, “The value is not a valid email address” if entered value failed regexp validation etc). That's easy to create and support, efficient, informative enough and will not increase specification too much. As the result, based on such specification, a QA specialist creates positive and negative test cases covering that scenario. Regards
Reply
Vinesh Singh
Vinesh Singh over 5 years ago Dmitriy G.
hi, I have a couple of questions which i hope you can assist. How would business rules and non-functional requirements be captured using GWT? Similar to field validations mentioned by Dharmesh, would these sit inside the acceptance criteria? Also, correct me if im wrong but can a user story include more than 1 scenario? Last question, will alternate paths be considered another scenario for a particular user story? Thanks in advance.
Reply
Dmitriy G.
Dmitriy G. over 5 years ago Dmitriy G.
Hi, Vinesh! User Story can have multiple scenarios which depend on the complexity of the business logic and the number of business rules. You're right while saying that alternative paths could be described as separate scenarios to the same user story. Alternative path usually considers having a different set of preconditions and outcomes. Let's say that we have some user story in an e-commerce application which is oriented on delivering orders to customers from some local market (for example, USA) but also allows to deliver orders to customers from other countries outside the local market. As a customer I want to fill in my shipping address so that sender knows where to deliver my order. In the business logic, there could be the next alternative paths: Customer fills in local shipping address during checkout AND Customer fills in international shipping address during checkout. There are several different scenarios since API of integrated shipping service returns different shipping methods for local based shipping and for international shipping (which is outside the local area). At the same time when you are working on decomposition of the epic into user stories, you should take into consideration not only activity which should be performed by some role in the application but also the purpose of the activity. That should help you understand if it should be another scenario of already described user story or an absolutely new user story. To be clear could you please share some particular examples of alternative paths you are talking about so that I could look at them? Gherkin is a good way to describe acceptance criteria. But NFRs must be satisfied by a number of stories unlike acceptance criteria which are defined on a per story basis. In that context, NFRs are more close to Definition of Done concept where each user story should be compliant with entire list of NFRs.
Reply
Martin Morrey
Martin Morrey almost 6 years ago
Hi. Interesting article. However, your multiple "when-then" pairs seem to break this "cardinal rule of BDD", https://automationpanda.com/2018/02/03/are-gherkin-scenarios-with-multiple-when-then-pairs-okay/. As a relative newcomer to Gherkin, I am now a bit confused about whether this is a good way to use it or not. Thanks, Martin
Reply
Баки Барнс
Баки Барнс over 3 years ago Martin Morrey
Test
Your comment will appear after the admin moderation
Vijay Ji
Vijay Ji almost 4 years ago Martin Morrey
Hi Madam, could you please send me Use case format with Acceptance Criteria is included [email protected]
Your comment will appear after the admin moderation
Maryna Z.
Maryna Z. almost 6 years ago Martin Morrey
Hi there! Thanks for your reply. We see your point here and we think it's a nice idea for article update :) Stay in touch with our news ;)
Reply

Subscribe via email and know it all first!