QA Foundations
Unit testing
Also known as: unit test
Unit testing verifies a single piece of code — usually one function or class — in isolation from its dependencies, which makes unit tests the fastest and most stable layer of a suite.
Isolation is what buys the speed and the stability. A unit test that touches no network, no filesystem and no clock has very few ways to be non-deterministic, which is why unit tests flake far less than higher layers. Google measured this directly across roughly 4.2 million tests: 0.5% of small tests were flaky in a given week against 14% of large ones.
The usual failure mode is not writing too few but asserting too little — tests that pin the implementation rather than the behaviour, and so faithfully protect a bug. Coverage percentage measures which lines ran, not whether anything meaningful was checked.
- Fastest and least flaky layer, because isolation removes most sources of non-determinism.
- Google measured 0.5% flakiness in small tests against 14% in large ones.
- Coverage tells you what ran, not what was verified.
Related terms
See it in your own test results
Qualflare detects flaky tests, clusters failures by root cause, and scores release risk from the test results you already produce in CI. Start free.
Start free with Qualflare← Back to the testing & observability glossary.
Last reviewed September 9, 2026