Skip to main content
Branch coverage measures whether each outcome of each decision point executed: the taken and not-taken arm of every if, each case of a switch, each short-circuit of &&/||. It is strictly stronger than line coverage — a one-line if x: return None reads 100% line-covered after a single truthy test, while its false arm (and whatever falls through) was never exercised. Testing folklore has carried this point since Myers: exercising every line is among the weakest adequacy criteria; exercising every decision outcome is the first one with teeth.

What mehen emits

Published on the file’s root space and, span-scoped, on every function and closure space. Absent when the report format measured no branches — a Go coverprofile, or an LCOV file produced without branch instrumentation (lcov’s branch coverage is off by default), publishes no coverage.branch keys at all, rather than a fabricated 0% or 100%.

The arm model — how formats fold in

Formats encode branch data with different vocabularies; mehen normalizes them all to flat arms — one countable outcome each: Two consequences worth knowing. First, condition vs branch granularity is format-defined: Clover counts each boolean condition’s two outcomes, while Cobertura’s fraction may aggregate a whole decision — mehen reports what the tool measured and does not attempt to reconstruct a finer criterion than the report contains. Second, arm identity is positional per line, so merging two reports max-matches arms in order — sound for re-runs of the same build, approximate across different instrumentations of the same file.

How to read it

For safety-critical calibration: DO-178C requires decision coverage at level B and MC/DC (modified condition/decision coverage) at level A — criteria stronger than anything a mainstream report format carries. SQLite famously maintains 100% MC/DC of its core; the point of citing it is proportion — that standard costs person-years and is not the implied target of a CI gate. coverage.branch is the practical middle ground: strictly better evidence than line coverage, available from the tools you already run.

Gating

See also

References

  • Myers, G. J., Sandler, C., & Badgett, T. (2011). The Art of Software Testing, 3rd ed. Wiley. (Coverage criteria hierarchy: statement < decision < condition variants.)
  • Chilenski, J. J., & Miller, S. P. (1994). Applicability of modified condition/decision coverage to software testing. Software Engineering Journal, 9(5).
  • RTCA DO-178C (2011). Software Considerations in Airborne Systems and Equipment Certification. (Structural-coverage objectives by criticality level.)
  • How SQLite is tested — 100% MC/DC in practice, and what it costs.
  • geninfo(1)BRDA record semantics.