Branch Coverage
ELI5 — The Vibe Check
Branch Coverage measures whether your tests cover both the 'if' AND the 'else' of every decision in your code. Statement coverage says 'did I run this line?' Branch coverage says 'did I test both paths?' It's a more honest metric that catches untested edge cases.
Real Talk
Branch coverage measures the percentage of conditional branches (if/else, switch cases, ternary operators) executed by tests. Unlike statement coverage, it ensures both true and false paths are tested. A subset of path coverage, which considers all possible execution paths.
When You'll Hear This
"We require 80% branch coverage — it catches more bugs than statement coverage alone." / "The error handling path had 0% branch coverage — no test ever triggered the catch block."
Related Terms
Code Coverage
Code coverage is the report card for your tests. It shows you a map of your code and highlights which lines got tested (green) and which didn't (red).
Mutation Score
Mutation Score tells you how good your tests REALLY are — not just coverage, but whether they actually catch bugs.
Statement Coverage
Statement Coverage is the simplest coverage metric: what percentage of your code lines were actually executed during tests?