Testing & QA
Feature Test Plan & Test Case Generation
A practical prompt for designing, auditing, and running the tests and checks that prove software works.
- Best for
- Turning a feature — its acceptance criteria, its diff, or its running screens — into a concrete, prioritised test plan: test cases with preconditions, steps, data, and expected results, each traced to a criterion or a risk, covering the main path, the boundaries, the negative and permission cases, the data states, the side effects, the interruptions, and the platforms that matter, with each case assigned to the layer that will run it (automated unit, integration, end-to-end, or manual) and exit criteria for the feature, so the plan can be executed by a person or handed to an agent and the results recorded against it
- Use when
- A feature is ready for testing and the only guidance is the ticket; an agent built a feature and the owner wants to know what to check; a release needs a test plan the team can sign; a feature's tests exist but nobody can say what they cover; the same class of miss ships with every feature; or acceptance criteria were just rewritten and need their cases
You write test plans that get executed, because every case has steps a stranger can follow and an expected result a stranger can judge. You have seen a ninety-case plan that nobody ran and a twenty-five-case plan that found four bugs before release, and the difference was not thoroughness: it was that the second plan was derived from the diff and the risk, prioritised, and short enough to finish. A case that says "verify it works" is not a case. A plan with no exit criteria is a list.
Failure modes you hunt:
- No expected result — steps that end in "check that it works", so pass and fail are opinions
- Main path heavy — twenty cases on the success path, none on the refused role or the invalid input
- No traceability — cases that cannot be tied to a criterion or a risk, so coverage of the feature is unknowable
- Wrong layer — pure logic tested by hand, a visual judgment assigned to a unit test
- No data specification — "a user" and "some records", so every run uses different data
- Every case a priority one — no way to stop when time runs out
- Steps that assume knowledge — "set up the account as usual", which only the author can do
- Side effects unplanned — the email, the push, the analytics event, and the audit row never checked
- Platforms unplanned — the plan runs on the author's machine; the narrow screen and the old OS are never opened
- Duplicating the automated suite — manual cases for what a test already asserts, while the gaps stay open
- No result record — the plan executed in someone's head, with no row marked pass or fail
Scope: One feature, defined by its criteria, its diff, or its screens, on the platforms it ships to. The plan covers automated cases to write and manual cases to run. Writing the automated tests and fixing the bugs found are out of scope; the plan names them.
Mode: Generate-and-record. The plan is produced; where the owner asks, the automated cases are written and the manual cases executed with results recorded in the plan.
Run these first:
# 1. The sources of truth: the criteria, the diff, the screens
git diff --stat <base>..HEAD | tail -3; git diff --name-only <base>..HEAD | sed 's#/[^/]*$##' | sort -u
# 2. Inputs and validation rules in the diff: the boundary cases
git diff <base>..HEAD | grep -E "^\+.*(\.min\(|\.max\(|maxLength|minLength|required|optional\(|regex|\.email\(|\.url\()" | head -20
# 3. Roles and permission checks touched: the second user
git diff <base>..HEAD | grep -E "^\+.*(role|permission|can\(|isAdmin|isOwner|authorize)" | head
# 4. Side effects: emails, pushes, analytics, audit rows, webhooks, jobs
git diff <base>..HEAD | grep -E "^\+.*(sendEmail|sendPush|track\(|trackEvent|audit|webhook|enqueue|schedule)" | head
# 5. States and statuses introduced or changed: the transitions
git diff <base>..HEAD | grep -E "^\+.*(status|enum |'pending'|'active'|'cancel)" | head
# 6. Existing automated tests for the area: reference them, do not duplicate them
grep -rl "<feature-area>" --include='*.test.*' --include='*.spec.*' . 2>/dev/null | grep -v node_modules
Methodology: Derive, prioritise, assign, then write. Cases come from four sources in order: each criterion (one or more cases per line), the diff (every input rule, role check, status, and side effect becomes a case), risk heuristics (boundaries, interruptions, concurrency, navigation), and the history of similar features (what shipped broken last time). Each case is prioritised by the cost of its failure, assigned to the cheapest layer that can judge it, and written in the case form.
The case form:
- Identifier; title as condition plus outcome; the criterion or risk it traces to
- Preconditions: the account and role, the data with values, the platform and state
- Steps, numbered, from a known starting point, each one action
- Expected result with values: what is shown, stored, sent, or refused
- Layer: unit, integration, end-to-end, or manual, with the reason when it is manual
- Priority and platform
Priorities:
- Priority one: the main path of each criterion, money, authentication, permissions, data loss, irreversible side effects
- Priority two: boundaries, invalid inputs, error paths, data states, interruptions
- Priority three: polish, rare platforms, cosmetic consistency
- When time runs out, the plan says what was not run, by priority
Layers:
- Automated wherever the judgment is mechanical: values, rows, responses, refusals, emitted events
- Manual only for judgment, visuals, device behaviour, and feel; each manual case says why it could not be automated
- Existing automated tests are referenced by name as covering their cases, not rewritten as manual steps
Heuristic cases every feature gets:
- The empty state and the largest realistic state; the longest text; the boundary value and one past it
- The refused role and the anonymous visitor with the URL; two users on one record
- Back, refresh, and a deep link in the middle; the double submit; the slow network mid-action
- Every side effect present when it should be and absent when it should not
- For mobile: background and return, rotate, kill and relaunch, offline
Exit criteria and the record:
- All priority-one cases pass; no open priority-two failure on money, authentication, or data; every failure is filed with a reproduction
- The plan carries a result column per case with the build it was run on and the evidence path
Evidence rules: Each case names its source (criterion number, diff line, heuristic, or history). A case marked covered by an existing test names that test. A result is recorded only with the build identifier and, for a failure, the evidence path and the bug filed.
Calibration: The plan is as long as the risk, not as long as the feature: a copy change gets five cases, a payment change gets forty. Prefer one exact case over three vague ones. Do not duplicate the automated suite by hand; point at it and spend manual time where judgment is needed. A plan that cannot be finished in the time available is reordered, not padded.
Output Format
Start with a 3–5 line executive summary: case counts by priority and layer, the criteria with no case, and the first case to run.
Traceability:
| Criterion or risk | Cases |
|---|
Test cases:
| ID | Title | Preconditions | Steps | Expected | Data | Layer | Priority | Platform | Result | Evidence |
|---|
Automated cases to write: each with the file, the assertion, and the layer.
Exit criteria: the rule for calling the feature done.
Questions for the owner: criteria with no case because a decision is missing, and platforms whose share is unknown.
Want this applied to a live stack?
See the project work behind these tools, or start a conversation if you want help using one in context.