branch coverage
A measurement of whether each decision in the code, such as an if statement, was taken both ways during the tests.
In more detail
Line coverage can report an if statement as covered even when only its true side ever ran. Branch coverage records which way each decision went, so it finds the path that was never taken. coverage.py measures it with the branch option.
Related terms
- line coverage — The share of lines or statements in your code that the tests executed at least once.
- code coverage — A measurement of which parts of your code ran while the tests ran.
- guard clause — A check at the top of a function that handles an awkward or invalid case and returns or throws immediately, so the main logic stays unindented.
Taught in
- Three Families Of Test Technique — ISTQB Certified Tester Foundation Level (CTFL v4.0) Exam Prep
- State Transition Testing — ISTQB Certified Tester Foundation Level (CTFL v4.0) Exam Prep
- Statement And Branch Coverage — ISTQB Certified Tester Foundation Level (CTFL v4.0) Exam Prep
- Error Guessing, Exploratory And Checklist-Based Testing — ISTQB Certified Tester Foundation Level (CTFL v4.0) Exam Prep
- Acceptance Test-Driven Development — ISTQB Certified Tester Foundation Level (CTFL v4.0) Exam Prep
- The Mock And Your Review Plan — ISTQB Certified Tester Foundation Level (CTFL v4.0) Exam Prep
- Coverage: Diagnostic, Not Target — Automated Testing, TDD & Quality Engineering
References
- ISTQB Glossary: branch coverage
- ISTQB CTFL Syllabus v4.0.1, section 4.3.2
- Coverage.py: branch coverage measurement