Sanity Testing
Lightweight verification of critical functions after small changes to ensure basic system stability.
Classification
- ComplexityLow
- Impact areaTechnical
- Decision typeDesign
- Organizational maturityIntermediate
Technical context
Principles & goals
Use cases & scenarios
Compromises
- Relying on sanity tests instead of full regression can leave defects undetected.
- Flaky or poorly maintained tests cause unnecessary rollbacks and delays.
- Insufficient coverage of critical areas may give a false sense of safety.
- Limit tests to truly critical functionality.
- Integrate sanity tests early in the pipeline (pre-merge or post-build).
- Automate evaluation and escalation on failures.
I/O & resources
- Build artifact / container image
- Minimal set of test data
- Automated test scripts or checklists
- Pass/fail status
- Error logs and initial diagnostic hints
- Decision recommendation (rollback, release, debug)
Description
Sanity Testing is a lightweight verification practice executed after small code or environment changes to quickly confirm core functionality. It prevents wasting effort on deep regression runs when basic failures exist. Sanity tests are focused, fast, often automatable and typically integrated into CI pipelines to provide rapid feedback to developers and delivery processes.
✔Benefits
- Fast detection of critical issues immediately after changes.
- Reduction of wasted time on long-running regression tests.
- Simpler basis for rollback or release decisions.
✖Limitations
- No full quality guarantee; deeper tests remain necessary.
- Can cause false positives if test data or environments are inconsistent.
- Not suitable to comprehensively check performance or scalability issues.
Trade-offs
Metrics
- Sanity suite execution time
Measures average time required to run the sanity tests.
- Failure rate per build
Share of builds where sanity tests fail.
- Time to first feedback
Time between build start and availability of sanity test results.
Examples & implementations
Web API: health and auth checks
Sanity suite checks the health endpoint, basic authentication and DB connectivity after deployment.
Microservice: startup smoke
After container start, core APIs and configuration values are validated to detect startup failures early.
Frontend: basic UI workflows
Automated sanity tests verify that login, navigation and core dialogs are reachable.
Implementation steps
Identify critical paths and minimal test cases.
Implement automated sanity scripts and integrate them into CI jobs.
Define clear thresholds and notification processes for failures.
Monitor and maintain the suite regularly to reduce flakiness.
⚠️ Technical debt & bottlenecks
Technical debt
- Outdated test scripts without refactoring.
- Missing parameterization of test data.
- Monolithic sanity suites instead of modular checks.
Known bottlenecks
Misuse examples
- Using sanity tests as the sole release gate.
- Bloating the suite with non-critical checks.
- Manual sanity checks in CI processes instead of automation.
Typical traps
- Too broad scope defeats the goal of speed.
- Lack of maintenance leads to growing brittleness.
- Unclear ownership for maintenance and response.
Required skills
Architectural drivers
Constraints
- • Limited time budget for quick checks
- • Availability of stable test environments
- • Requirement for deterministic test data