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 recognising. 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 also4
Hand-picked in the note itself — the neighbours worth reading next.
Code Coverage
The proportion of code executed by a test suite — a map of what is untested, not a measure of quality.
Testing & Verification12 connections
Unreachable Code
Code no input can execute — usually a guard against a state the surrounding invariants forbid.
Testing & Verification10 connections
Instrumentation
Adding measurement to code so its execution can be observed, and the distortions that introduces.
Testing & Verification12 connections
Coverage Gate
A build check that fails when coverage falls below a threshold, and what that pressure produces.
Testing & Verification14 connections
Related5
Nearby in the graph rather than deliberately chosen. Looser, sometimes surprising.
Linked from5
Notes elsewhere in the wiki that reach for this one.
- 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.
- Unreachable CodeTesting & Verification
Code no input can execute — usually a guard against a state the surrounding invariants forbid.