Branch Coverage
The proportion of conditional outcomes exercised — the strictest ordinary coverage metric, and the most informative.
Branch coverage measures whether both outcomes of every conditional have been exercised. It is stricter than line coverage, because a line containing a conditional can be fully "covered" while only one side of it has ever been taken.
That strictness is what makes it useful as a design signal. An uncoverable branch is usually telling you something: the guard is unreachable given the surrounding invariants, the two optional fields always travel together so the mixed case cannot occur, or a defensive default exists for a value that is never absent. The right response is nearly always to remove the branch, not to write a contrived test for it. See Unreachable Code and Defensive Default.
Several code shapes generate branches that are easy to miss: a null-coalescing operator, a conditional spread, a default parameter value, an optional chain, and a type-narrowing guard each add one. A refactor that converts strict optional handling into conditional spreads can double a file's branch count in a single pass.
There is also a measurement artifact worth recognizing. When two runners instrument the same file, some record types merge cleanly across them and some do not — so a branch exercised in only one runner can appear uncovered in the merged report. The signature is a file reporting complete statements alongside an uncovered function, which is arithmetically impossible for a single record set.
See also8
Code Coverage
The proportion of code executed by a test suite — a map of what is untested, not a measure of quality.
Testing & Verification16 connections
Instrumentation
Adding measurement to code so its execution can be observed, and the distortions that introduces.
Testing & Verification19 connections
Coverage Gate
A build check that fails when coverage falls below a threshold, and what that pressure produces.
Testing & Verification16 connections
Chesterton's Fence
Do not remove something whose purpose you cannot explain.
Method23 connections
Vacuous Truth
A statement that holds only because its subject set is empty — a green result that measured nothing.
Method26 connections
Fail Fast
Crash at the point of misconfiguration rather than degrading quietly into a wrong state.
Method27 connections
Silent Failure
A failure that produces no signal, so the absence of an error reads as success.
Method73 connections
Goodhart's Law
When a measure becomes a target, it stops being a good measure.
Method51 connections
Linked from7
- Binary SearchComputation & Algorithms
Finding a value in a sorted range by repeatedly discarding half of it.
- Code CoverageTesting & Verification
The proportion of code executed by a test suite — a map of what is untested, not a measure of quality.
- Coverage GateTesting & Verification
A build check that fails when coverage falls below a threshold, and what that pressure produces.
- Defensive DefaultMethod
A substituted value that papers over a missing input and hides the misconfiguration that produced it.
- InstrumentationTesting & Verification
Adding measurement to code so its execution can be observed, and the distortions that introduces.
- Mutation TestingTesting & Verification
A test-of-tests that injects small bugs into code and checks whether the existing suite catches them, exposing tests that assert nothing.
- Unreachable CodeTesting & Verification
Code no input can execute — usually a guard against a state the surrounding invariants forbid.