Code Coverage & Quality Gates Language
5 exercises — master the vocabulary of code coverage types, mutation testing, quality gates, and test flakiness in professional engineering discussions.
0 / 5 completed
Code coverage vocabulary quick reference
- Line (statement) coverage — every executable line executed at least once
- Branch coverage — both true/false outcomes of every conditional executed
- Path coverage — every possible execution sequence covered; exponentially complex
- Mutation testing — injects deliberate faults to measure test effectiveness; kill rate = % of mutants detected
- Quality gate — automated pass/fail conditions required before merge or deployment
- Flaky test — passes and fails non-deterministically without code changes
- Flakiness rate — % of CI builds containing at least one non-deterministic failure
1 / 5
A QA engineer explains the testing strategy to the team: "We measure line coverage, branch coverage, and path coverage." What is the correct definition of each and how do they differ in thoroughness?
Understanding the three coverage levels is fundamental to discussing test quality in engineering teams.
Why the distinction matters:
High line coverage is easy to achieve but misleading — a test can execute both branches of an
Real-world application:
• CI quality gates typically enforce branch coverage (not just line coverage)
• Path coverage is used in safety-critical contexts (avionics: DO-178C, automotive: ISO 26262) where regulatory standards require MC/DC (Modified Condition/Decision Coverage), a practical approximation of path coverage
Key vocabulary:
• Branch coverage — verifies both outcomes of every conditional are tested
• Path coverage — verifies every possible execution sequence is covered; theoretically complete
• MC/DC — Modified Condition/Decision Coverage; a practical path-coverage approximation for safety-critical systems
| Type | What must be executed | Practical ceiling |
|---|---|---|
| Line (statement) | Every executable line at least once | Achievable; common CI threshold |
| Branch | Both true/false paths of every conditional | Achievable; 80% is SonarQube default |
| Path | Every possible combination of branch sequences | Exponential growth — impractical for real code |
Why the distinction matters:
High line coverage is easy to achieve but misleading — a test can execute both branches of an
if statement in one test without asserting anything about the different outcomes. Branch coverage demands both outcomes are explicitly exercised, and is the minimum standard for safety-critical code.Real-world application:
• CI quality gates typically enforce branch coverage (not just line coverage)
• Path coverage is used in safety-critical contexts (avionics: DO-178C, automotive: ISO 26262) where regulatory standards require MC/DC (Modified Condition/Decision Coverage), a practical approximation of path coverage
Key vocabulary:
• Branch coverage — verifies both outcomes of every conditional are tested
• Path coverage — verifies every possible execution sequence is covered; theoretically complete
• MC/DC — Modified Condition/Decision Coverage; a practical path-coverage approximation for safety-critical systems