White-Box
Updated 2026-08-13
Summary
Testing with knowledge of the internal structure, so test cases are designed to cover specific code paths rather than only observed inputs and outputs.
Definition
White-box testing designs test cases with visibility into the implementation, targeting branches, paths, and conditions rather than treating the system as opaque. Its complement is black-box testing, which derives cases from requirements and observable behavior alone. The qualification is that path coverage does not imply correctness: code can be fully exercised and still fail the requirement, so coverage measures testing effort rather than product quality. Its strength is locating the specific logic that produces a failure.
Introduction
How to use
- Coverage targeting: choose test cases that exercise the branches and paths not yet executed. - Failure localization: use internal visibility to trace exactly which logic produced an observed failure. - Coverage audit: identify the paths no test currently reaches and judge whether that matters.
Mechanism
Because the tester can see the implementation, test cases can be selected to reach specific decision branches, which makes uncovered logic directly identifiable. That visibility converts testing from sampling behavior into systematic exploration of the code, so defects concentrated in rare branches become reachable rather than remaining hidden behind the paths normal usage happens to take.
Practice
In progress 0/1Practice this model in one real situation:
Cases
- Unit tests that assert on every branch of a function are a standard form of white-box testing.
- Debugging a rare failure is faster when the tester can trace the exact branch that produced it.
Common pitfalls
- Testing only code paths while ignoring whether the requirements themselves are met.
- Treating a high coverage number as proof of quality when covered code can still be wrong.
Sources
Source support: Explicit
References currently contain only Wikipedia links; primary sources still need review.
- en.wikipedia.orghttps://en.wikipedia.org/wiki/White-box_testingverified
account_treeGenealogyexpand_more
PRIVATE NOTES · Only visible to you
SAVED Q&A
ENTRY Q&A · Private saving available
Ask with a clear boundary
thinkingmodels answers from published entry context only.
Your question is sent to thinkingmodels. The answer uses public entry context only.
RELATED MODELS