Software Testing

Beginner path · lesson 15 of 35

BeginnerTest design4 min readPublished November 12, 2026

Acceptance criteria and BDD: writing testable requirements

Acceptance criteria say when a user story is done. Written as concrete examples, in the Given/When/Then style of BDD, they become shared understanding, test cases and, often, automated tests, all at once.

On this page

Key takeaways

  • Acceptance criteria are the conditions a user story must meet to be accepted. Good ones are clear, testable and about outcomes, not implementation.
  • BDD (behaviour-driven development) writes them as concrete examples in the format Given / When / Then, agreed by business, development and testing together.
  • Testers are key in BDD: they ask the "what if?" questions that turn vague stories into examples that can be tested.

User stories need acceptance criteria

Agile teams often describe work as user stories:

As a returning customer, I want to reorder a previous order, so that I don't have to search for the same products again.

The story says what and why. It doesn't say when it's done. Does it reorder out-of-stock items? At the old price or the new one? That's what acceptance criteria are for.

What good acceptance criteria look like

WeakBetter
Reordering should work properlyReorder adds all items from the selected order to the cart, at current prices
Handle out-of-stock itemsOut-of-stock items aren't added; a message lists them by name
It should be fastThe cart appears within 2 seconds

Good acceptance criteria are:

  • Testable: someone can check them with a clear yes or no.
  • Specific: numbers, names, exact behaviour.
  • About outcomes: what the user sees or gets, not how the code works.
  • Agreed: the product owner, developers and testers understand them the same way.

BDD: examples instead of descriptions

Behaviour-driven development (BDD) was introduced by Dan North in the mid-2000s. Its core idea: teams understand requirements best through concrete examples, written in a shared language before any code is written.

Examples are usually written in Given / When / Then form:

  • Given: the starting situation.
  • When: what the user does.
  • Then: the expected outcome.
Scenario: Reorder adds available items at current prices
  Given Ana has a previous order with 2 coffee bags at 30.00 each
  And the coffee price is now 32.00
  When she reorders that order
  Then her cart contains 2 coffee bags at 32.00 each

Scenario: Out-of-stock items are left out with a message
  Given Ana's previous order contains coffee and a mug
  And the mug is out of stock
  When she reorders that order
  Then her cart contains only the coffee
  And she sees "1 item is out of stock: Mug"

This format is called Gherkin. Tools like Cucumber, SpecFlow/Reqnroll and Behave can run these scenarios as automated tests, linked to code that drives the application.

How testers contribute

Testers are at their best in BDD before development starts:

  1. Ask for examples. "Can you give me an example where that happens?"
  2. Look for edge cases. What if the order is very old? A product no longer sold? The cart already has items?
  3. Find hidden rules. Each answer like "then we use the new price" is a rule that needs its own example.
  4. Keep examples concrete. Real names, real numbers, real messages.
  5. Keep each scenario focused on one behaviour.

A popular workshop technique is example mapping, introduced by Matt Wynne: in about 25 minutes, the team writes the story, its rules, examples for each rule and questions nobody can answer yet, on cards of different colours.

Real-world exampleOne question, three new rules

A team discussed the "reorder" story in a three amigos session. The product owner thought it was simple.

The tester asked: "What happens if the product is still sold, but in a different size?" Nobody knew. Then: "What if the customer's old address is no longer valid?" And: "What if the old order used a discount code that has expired?"

The session produced three new rules, seven examples and two questions for the business. The developer said it changed the design: the reorder had to go through the normal cart validation, not a shortcut.

Lesson: the most valuable testing on that story happened before any code existed, through questions and examples.

Do

Write scenarios in business language: "When she reorders that order". They stay valid when the UI changes.

Don't

Write scenarios as UI scripts: "When she clicks the button with id reorder-btn". They break with every redesign and hide the business rule.

Check yourself

Rewrite this acceptance criterion as a Given/When/Then example: 'Users should not be able to use expired discount codes.'

Show answer

One possible version: Given a discount code "SUMMER10" that expired yesterday, And Ana has items worth 100.00 in her cart, When she applies "SUMMER10", Then the total stays 100.00, And she sees "This code expired on 31 August". Concrete data and an exact message make it testable.