How to Write Test Cases (With Templates and Examples)
A test case is a set of conditions and steps that checks one specific behaviour of the software. Good test cases are clear enough that anyone on the team can run them and get the same result, and focused enough that a failure points straight at the problem.
When to write test cases (and when not to)
Detailed test cases are worth the effort when:
The flow is business-critical (payments, sign-up, data export)
The test will be run many times (regression) or automated later
You need evidence for audits or compliance
Someone new will run the tests
For fast-moving features, a checklist or an exploratory charter is often a better use of time. Don't write 40 detailed cases for a page that will change next sprint.
The fields that matter
Field
Purpose
ID
A unique reference, e.g. LOGIN-004
Title
What is being verified, in one line
Preconditions
State before the test: user exists, cart is empty, feature flag on
Test data
The exact inputs
Steps
Numbered actions
Expected result
The observable outcome that means "pass"
Priority
How important this case is in a regression run
Optional fields (requirement link, automation status, component) help at scale but aren't essential.
Template
**ID:** AREA-000
**Title:** Verify that …
**Preconditions:**
**Test data:**
**Steps:**
1.
2.
**Expected result:**
**Priority:** High | Medium | Low
Steps: Submit a wrong password 10 times within one minute
Expected: Further attempts are blocked for a period, with a clear message
Priority: Medium
Notice that each case checks one behaviour, with specific data and a verifiable expected result.
Writing tips
Start titles with "Verify that…" or state the behaviour. It forces you to name what's being checked.
One expected outcome per case. If you write "and also…", consider splitting it.
Make expected results observable. "Works correctly" can't be checked; "the order appears in Order history with status Paid" can.
Keep steps at the user's level. Use "Add the mug to the cart", not "Click div.product-card:nth-child(3) button".
Separate data from steps. Then the same case can run with several data sets.
Cover negative paths. For every "it accepts X", ask "what does it do with not-X?"
Using design techniques to choose cases
Don't write test cases at random. Use techniques like boundary value analysis and equivalence partitioning for inputs, decision tables for combinations of rules, and state transitions for flows like orders and bookings. The technique tells you which cases you need; the template tells you how to write them down.
Keeping a suite healthy
Review and prune it every few releases; delete cases for removed features
Tag cases by area and priority so you can run a focused regression
Automate the stable, high-value, repetitive cases first
When a bug escapes to production, add the missing case
Practise test design
Writing test cases is easier once you've seen where real bugs hide. Try a QAUnlocked Practice Lab, then write the test cases that would have caught every planted defect. It's a great portfolio piece, too.
What the ISTQB Certified Tester Foundation Level covers, who benefits from it, what the exam looks like, and a four-week study plan that builds real skill alongside the certificate.
A practical accessibility testing checklist based on WCAG 2.2, covering keyboard, focus, screen readers, forms, colour, zoom and motion, plus the automated tools to use and their limits.
We use cookies
We use cookies to keep you signed in and to understand how our site is used.
Be the first to comment.