Skip to main content

Published

Acceptance Test Examples: Login, Checkout and More (2026)

Short answer

An acceptance test checks that a feature meets the acceptance criteria agreed for its user story, from the user's point of view. Write each one as a scenario (Given a starting state, When an action, Then an outcome) or as a checklist rule, with positive and negative cases. The examples below cover login, password reset, checkout and search.

Last updated: 2026-11-11

What is an acceptance test?​

An acceptance test verifies that a piece of work satisfies its acceptance criteria. Acceptance criteria are the conditions a product must meet to be accepted by a user, customer or other stakeholder (the Cucumber glossary's wording). The test is the check; the criteria are the thing being checked.

The ISTQB foundation syllabus names two formats for criteria, as quoted by Autemos in its guide: scenario-oriented (Given/When/Then, as used in behavior-driven development) and rule-oriented (a bullet verification list, or a table mapping inputs to outputs). Use scenarios for flows with several steps and rules for lists of conditions or many input combinations. TechTarget advises against switching between the two within one story, since it makes the criteria harder to follow.

Acceptance criteria belong to one story. A definition of done applies to every story, for example "code reviewed and tests pass".

What does a scenario-style acceptance test look like?​

The Gherkin keywords are Feature, Scenario, Given, When, Then, And and But. Cucumber describes Given as putting the system in a known state, When as the event, and Then as the expected outcome.

Example 1: login​

Feature: Login

Scenario: Successful login
Given a registered user on the login page
When they enter their correct email and password
Then they land on the dashboard
And their name appears in the header

Scenario: Wrong password
Given a registered user on the login page
When they enter their email and an incorrect password
Then they stay on the login page
And they see "Incorrect email or password"
And the message does not say which of the two was wrong

Example 2: password reset​

Scenario: Expired reset link
Given a user with a reset link older than 30 minutes
When they open the link
Then they see a message that the link has expired
And a button to request a new link

Scenario: Unknown email
Given a visitor on the reset page
When they submit an email with no account
Then they see the same confirmation message a registered user sees

The second scenario is a negative case. It checks that the form does not reveal which emails have accounts.

Example 3: checkout with a discount code​

Scenario Outline: Discount codes
Given a cart totaling $100
When the shopper applies the code "<code>"
Then the order total is <total>

Examples:
| code | total |
| SAVE10 | $90 |
| EXPIRED1 | $100 |
| BOGUS | $100 |

A Scenario Outline with an Examples table runs the same steps against several rows, which suits input-output rules.

What does a rule-style acceptance test look like?​

For a search feature, a checklist reads more naturally than scenarios:

#CriterionCheck
1Search matches product names, case-insensitiveSearch "SHOE" and see products named "Shoe"
2Results show at most 20 items per pageSearch a term with 50 matches
3An empty query shows a prompt, not all productsSubmit an empty box
4A query with no matches shows "No results" and a way to clearSearch "zzzzqq"
5Results appear within 2 seconds on the test environmentTime the request

Atlassian advises quantifying expectations so each criterion has a definite pass or fail. Item 5 does that. A phrase like "search is fast" does not.

How do I turn acceptance tests into automated tests?​

Each scenario maps to setup, action and assertion. Here is Example 2 in Playwright:

tests/password-reset.spec.ts
import { test, expect } from '@playwright/test';

test('expired reset link offers a new link', async ({ page }) => {
const url = await createResetLink({ ageMinutes: 31 }); // Given
await page.goto(url); // When
await expect(page.getByText(/link has expired/i)).toBeVisible(); // Then
await expect(page.getByRole('button', { name: /request a new link/i })).toBeVisible();
});

Keep the scenario text in a comment or a linked file so a reviewer can compare test and criterion. Cucumber can execute Gherkin directly if you prefer that route.

What makes a good acceptance test?​

  • Write criteria before building. Criteria written during review describe what was built, not what was needed.
  • Describe outcomes, not implementation. "The user sees an expiry message" survives a redesign; "a modal fades in over 400ms" does not.
  • Include negative cases. Wrong password, expired link, blocked account and empty input carry much of the risk.
  • Use concrete values. "$100 cart, code SAVE10, total $90" is checkable. "A discount is applied" is not.
  • Keep each criterion independently testable, so a failure points to one thing.

How do I know every acceptance criterion has a test?​

Give each criterion or scenario an ID and tag the test that checks it. Then list IDs with no test. When coding agents write many of the tests, this matters more, because an agent covers the criteria it noticed and says nothing about the rest.

TestChimp keeps scenarios as Markdown in your repo, links Playwright tests to them with a scenario annotation, and shows which scenarios have no test. See spec-driven testing for the workflow, and how to trust AI-written tests for reviewing what the agent wrote.

Frequently asked questions

What is an example of an acceptance test?

Given a registered user on the login page, when they enter the correct email and password, then they land on the dashboard. Each acceptance test checks one agreed criterion for a user story, from the user point of view.

What is the difference between acceptance criteria and acceptance tests?

Acceptance criteria are the conditions a story must meet. Acceptance tests are the checks, manual or automated, that confirm those conditions hold.

What are the two formats for acceptance criteria?

Scenario-oriented, using Given/When/Then, and rule-oriented, using a checklist or a table of inputs and outputs. The ISTQB foundation syllabus names both.

Are acceptance tests the same as UAT?

User acceptance testing is acceptance testing performed by users or business stakeholders. Acceptance tests can also be automated and run by the team in CI before UAT.

How many acceptance criteria should a user story have?

Enough to define done for that story, usually a handful. If a story needs many, consider splitting it. Each criterion should be independently testable.

Can I automate acceptance tests with Playwright?

Yes. Map Given to setup, When to the user action and Then to expect assertions. Link each test to its criterion ID so you can report criteria with no test.

Know which criteria have no test

Link Playwright tests to scenarios in your repo and see the gaps. 14-day free trial, no credit card.

Start a 14-day free trial · Book a demo