Skip to main content

White box and black box testing

Short answer

White-box testing uses internal code knowledge to test statements, branches, and paths; performed by developers. Black-box testing checks against specification through inputs/outputs, using equivalence partitioning and boundary analysis, without looking at code. White-box finds logic errors, black-box finds missing functions and interface issues.

Write about White box testing and Black box testing.

White-box testing

White-box (structural, glass-box) testing tests the internal structure and logic of the code. The tester knows the source code and designs test cases to exercise statements, branches, paths and loops.

  • Techniques: statement coverage, branch/decision coverage, condition coverage, path coverage, loop testing, data-flow testing.
  • Done mostly by developers at the unit level. Finds logic errors, unreachable code and hidden paths.
  • Needs programming knowledge; costly for large programs.

Black-box testing

Black-box (functional, behavioural) testing tests the software only through its inputs and outputs against the specification, without knowledge of the internal code.

  • Techniques: equivalence partitioning, boundary value analysis, decision tables, state transition and error guessing.
  • Done by testers at system and acceptance levels. Finds missing functions, interface and requirement errors.
  • It cannot check internal code paths, so some bugs can remain.
AspectWhite boxBlack box
Knowledge of codeRequiredNot required
Based onCode structureSpecification
Done byDeveloperTester/user

✓ Answer checked by Claude Sonnet 5.5

All Instrumentation II chapter 9 questions →