error path
The route through code taken when something goes wrong, such as invalid input, a timeout or a failed dependency.
In more detail
Error paths are the least tested code in most systems because the failure is hard to produce on demand. A test double that raises the error you need is the usual way to reach them, and a coverage report's missing lines often point straight at them.
Related terms
- happy path — The route through code when everything goes as intended, with valid input and no errors.
- test double — Any object that replaces a real dependency in a test: a stub returns canned data, a fake is a small working implementation, and a mock checks interactions.
- exception — An error object a program raises to stop normal flow and report that something went wrong.
- code coverage — A measurement of which parts of your code ran while the tests ran.
Taught in
- Coverage: Diagnostic, Not Target — Automated Testing, TDD & Quality Engineering
- What Test Doubles Are For — Automated Testing, TDD & Quality Engineering
- What To Look For In A Review — Automated Testing, TDD & Quality Engineering