What is white-box vs black-box testing?
Answer
Black-box testing: testing without knowledge of the internal implementation. The tester only knows inputs and expected outputs — treating the system as a "black box." Tests are derived from requirements/specifications. Techniques: equivalence partitioning, boundary value analysis, decision table testing. Types: functional testing, acceptance testing, E2E testing. White-box testing (clear-box, glass-box): testing with full knowledge of the internal implementation. Tests are designed to exercise specific code paths, branches, loops, and internal logic. Techniques: statement coverage, branch coverage, path coverage. Types: unit testing (developer writing tests for their own code). Grey-box testing: partial knowledge — the tester knows some of the internal structure (database schema, API contracts) but not necessarily the full implementation. Integration testing is often grey-box. Best practice: use both — black-box tests verify requirements from the user's perspective; white-box tests ensure internal correctness and coverage.