What is the difference between black-box, white-box, and gray-box testing?
- testing types
- black-box
- white-box
- gray-box
Answer it first, then compare. Nothing here is saved or scored.
Model answer
Black-box: test without knowledge of internal code, focus on inputs and outputs (functional testing, user perspective). White-box: test with full knowledge of code - focus on logic paths, branches, and internal state (unit testing, code review). Gray-box: partial knowledge - you understand the architecture and data flow but test through external interfaces (API testing with knowledge of the database schema). Most QA work is gray-box - you understand the system architecture but test through the UI or API rather than directly testing internal functions.
What interviewers listen for
- Risk-based prioritisationYou can defend skipping coverage on a path because the risk maths supports it.
- Test design fluencyYou apply equivalence partitioning and decision tables to concrete inputs in real time.
- Metric judgmentYou distinguish between metrics that drive learning and metrics that drive theatre.
- Strategy under constraintYou can produce a defensible plan when the team has half the time and twice the scope.