White-Box Testing
Testing based on knowledge of internal code structure — verifying code paths, branches, and logic.
Full definition
White-box testing (also called structural testing or glass-box testing) uses knowledge of the internal code structure to design tests. The tester can see inside the 'box' and tests specific code paths, branches, and conditions.
White-box techniques:
- Statement coverage: Every line of code is executed at least once
- Branch/Decision coverage: Every branch (if/else) is tested both ways
- Condition coverage: Every boolean sub-expression is tested true and false
- Path coverage: Every possible path through the code is tested (often impractical)
- MC/DC coverage: Modified Condition/Decision Coverage — each condition independently affects the decision
Coverage hierarchy (weakest to strongest): Statement < Branch < Condition < MC/DC < Path
In practice, most teams aim for 80%+ statement coverage and 70%+ branch coverage. 100% coverage doesn't mean zero bugs — it means all code was executed, not that all scenarios were tested.
White-box testing is primarily done by developers through unit tests. QA engineers should understand these concepts for ISTQB and for communicating with development teams.