A quality test case
A quality test case is one that a stranger can run and reach the same conclusion. The steps are concrete and atomic, the data is named, the expected result consists of verifiable facts, and the case is self-contained, independent of other cases and linked to a requirement. This is checked by a review through a stranger's eyes before the case is ever run.
QA Fundamentals · Test documentation
Two testers read the same case and record different results. How do you check a case before it runs?
A “Login” case seems clear to whoever wrote it. Another person reads “enter data”, types anything and gets a Pass. The quality of a test case is not about elegance but about whether a stranger can run it and reach the same conclusion. Below: criteria to review a case against, typical “smells” and a rewrite example.
How it works and why. A case is a work product and can be reviewed like code: this is static testing of test documentation, for example a pair review. It helps to read a case through a stranger’s eyes and ask six questions. These criteria grew from what breaks most often: non-reproducibility, order dependence, a vague result and costly maintenance.
A criterion and the review question
Worked example: rewriting a weak case. The original:
Title: Login
Steps: 1. Open the page
2. Enter data
3. Click the button
Expected: Works correctly
It breaks almost every criterion: the title does not say what is checked, the steps name neither fields nor values, the expected result measures nothing, there is no link to a requirement. After the review:
ID: TC-AUTH-007
Title: Login with a wrong password shows an error
Preconditions: An active user test.user@example.test exists
with the password Valid-Pass1; no active session
Steps:
1. Open /login
2. Enter test.user@example.test in the Email field
3. Enter Wrong-Pass9 in the Password field
4. Click "Sign in"
Expected: The error "Wrong email or password" is shown;
the user stays on /login; no session is created
Priority: High Requirement: REQ-AUTH-02
Now the title describes the scenario, the steps are atomic and concrete (“enter test.user@example.test in the Email field”), and the result consists of verifiable facts: the error text, the page address, the absence of a session. These facts can be matched, and none depends on other cases.
| Smell | Fix |
|---|---|
| “Enter data” | name the field and the value |
| “Works correctly” | what exactly the user sees and what is in the database |
| Several independent outcomes | split into cases |
| Coordinates and colour of a button | a logical element name |
| A case with no requirement | add a link or delete it |
A dependent or an independent case
“Run after TC-11”
The case uses the user created in TC-11. If TC-11 is removed or skipped, this one fails without a defect. The run order becomes part of the case.
Preconditions create what is needed
The case itself demands an active user with a given password. It can be run alone, in any order and in parallel.
Limits and alternatives. “Quality” depends on context: for an experienced team a high-level case without numbers is enough, for regulatory scenarios concrete values and postconditions are needed. A too-detailed case is a problem itself: every design change breaks its text, so interface trivia is better moved into a checklist or an automation element library. Reviewing cases has a cost too, so we focus on risky scenarios. For automated tests the same criteria apply to the test name and assertions.
Common mistakes.
- Writing a case “for yourself”: the author fills gaps from memory, the executor cannot.
- Stating the result as “correctly”, “normally”, “as needed”: that is not a result but a judgement.
- Several unrelated checks in one case: when it fails it is unknown what broke.
- Not updating a case after a requirement change: it still “passes” but already checks the wrong thing.
Check yourself
The expected result in a case is “the user sees an error”. Is that enough?
Answer
No. It does not say which error, where, whether the user stays on the page and whether a session was created. Each executor will understand it differently. The text, the page address and the system state that can be matched must be given.
A case starts with “first run TC-11”. What happens when TC-11 is changed or deleted, and how to fix it?
Answer
The case will fail without a defect because it depends on someone else’s state. The fix: write the needed state into the preconditions and create it independently so the case can run alone.