Preserve the behavior behind a bug fix
When a shipping threshold defect is fixed, add a check at the exact boundary that failed. The unit test becomes regression protection for that rule. Name it after the condition and expected result rather than only an issue number, so future maintainers understand the behavior without opening historical discussion.
Confirm that the check fails against the faulty behavior before relying on it. This distinguishes a useful regression test from an example that happens to pass both versions. If the defect only occurs through serialization or persistence, the correct regression check may need the relevant integration boundary rather than an isolated function.
Use the cheapest sufficient layer
A wrong calculation often belongs in a fast unit check with controlled inputs. A missing database constraint belongs in an integration test using the relevant database behavior. A broken navigation path may need a browser journey. The regression label does not require every defect to create another slow end-to-end scenario.
Keep data fixtures minimal and document why the selected values matter. Large copied production records can introduce unrelated details and sensitive information. A small synthetic example that reproduces the failure gives maintainers a clearer explanation and makes the check easier to run in ordinary development and continuous integration environments.
Maintain a credible regression suite
Review old checks when requirements intentionally change. Update the expected result through the same product decision process used for the application. Do not preserve obsolete behavior merely because a regression test encodes it, and do not delete a failing check without determining whether the failure represents a defect or an approved change.
Track flaky checks separately and repair them promptly. A suite that repeatedly fails for unrelated timing or shared-data reasons can obscure real regressions. Keep critical checks deterministic and readable so engineers can treat a new failure as actionable evidence rather than another background problem to ignore during release preparation.
Working sheet
| Original defect | Likely boundary | Regression input |
|---|---|---|
| Threshold comparison | Unit | Exact equality value |
| Wrong database mapping | Integration | Minimal persisted record |
| Missing route link | Browser journey | Authorized user path |
| Response field mismatch | API contract | Representative response shape |
Questions about unit testing vs regression testing: understand their overlap
Are regression tests separate from unit tests?
They can overlap. Regression describes the purpose; unit describes the execution boundary.
Must every bug get an end-to-end test?
No. Choose the smallest reliable boundary that reproduces and detects the defect.
How should I use the working sheet?
Download the CSV and replace the sample rows with evidence from your repository. Record a clear acceptance check and an owner for each item. Keep unresolved assumptions visible rather than treating the example as a completed assessment.
Sources and further reading
Examples are illustrative. They are not customer results, security guarantees, or a substitute for checking the documentation for your installed version.
