Test Case Design
A well-written test case clearly describes what to test, how to test it, and what result to expect — turning testing from a vague activity into a repeatable, verifiable process.
Anatomy of a Test Case
A good test case is specific enough that anyone — not just its original author — could execute it and get a consistent, meaningful result.
- Test ID — a unique identifier for tracking.
- Title — a short, clear summary of what's being tested.
- Preconditions — what must be true before the test starts.
- Steps — the exact actions to perform, in order.
- Expected Result — precisely what should happen if the software is working correctly.
- Actual Result — recorded after execution, to compare against the expected result.
Equivalence Partitioning and Boundary Values
Two powerful techniques help design efficient test cases: equivalence partitioning groups inputs into classes that should behave the same way (testing one representative from each), and boundary value analysis specifically tests the edges of those classes, like a minimum or maximum allowed value, where bugs are disproportionately likely to hide.
Common Mistakes
- Writing vague test steps like "test the login" instead of precise, actionable steps and a specific expected result.
- Forgetting to test boundary values (the smallest and largest valid inputs, and values just outside that range), where off-by-one bugs commonly hide.
- Testing many inputs from the same equivalence class, wasting effort without meaningfully increasing coverage.
- Omitting preconditions, leaving ambiguity about the required starting state before the test can be run correctly.
Professional Tip
For any input with a valid range (like an age field accepting 1-120), always test the exact boundaries — 0, 1, 120, and 121 — rather than only "safe" values comfortably inside the range. Boundary bugs are among the most common defects in real software.
Your Turn
Write a formal test case (with ID, title, preconditions, steps, and expected result) for testing that a discount code field correctly rejects an expired code.
Mini Quiz
What is boundary value analysis primarily designed to catch?