tldr: Sanity testing is a quick, narrow check that a specific fix or change works and did not obviously break the area around it. It is the fast gate you run before committing to a full regression pass. People confuse it with smoke testing; the two are not the same.
What sanity testing is
Sanity testing is a focused verification after a small change. A bug was fixed or a feature tweaked, and you check that the change behaves and the immediate surrounding flow still holds together.
It is deliberately shallow and quick. The goal is a fast yes or no on whether deeper testing is even worth starting.
Sanity vs smoke vs regression
These three get muddled constantly. The clean distinction:
- Smoke testing checks that a new build is stable enough to test at all. Broad and shallow, run on every build.
- Sanity testing checks that a specific change works. Narrow and shallow, run after that change.
- Regression testing checks that nothing else broke. Broad and deep, run before release.
Smoke asks "is this build alive?" Sanity asks "did this change do its job?" Regression asks "did anything else break?"
When to run it
Run sanity checks right after receiving a fix or a minor change, before investing in a full regression cycle. If the sanity check fails, you reject the build and save the cost of running everything else.
It is a triage step. It keeps a broken build from consuming a full test pass.
A concrete example
A team ships a fix for a coupon code that was not applying at checkout. The sanity check is narrow: add a valid coupon, confirm the discount applies, confirm the order total updates.
It does not re-test the entire checkout. If the coupon works, the build earns a full regression pass. If it does not, the build goes back without wasting more time.
FAQs
Is sanity testing the same as smoke testing?
No. Smoke testing checks overall build stability across many areas. Sanity testing checks one specific change in depth-of-one.
Is sanity testing automated or manual?
Either. It is often a quick manual check, but a small automated subset works just as well as a gate before full regression.
When do you skip straight to regression?
When there is no targeted change to verify, such as a scheduled release of an already-validated build. Sanity testing exists for the narrow, change-driven case.
Does sanity testing replace regression?
No. It is a fast pre-check. A passing sanity test earns a full regression run, it does not substitute for one.
