2.1 & 2.2 White-Box Testing & Logic Coverage Criteria
White-Box Testing (Glass-Box / Structural / Clear-Box Testing): A testing methodology where the internal logic, source code structure, control flow graphs, and data paths of an application are fully visible and examined by the tester.
Logic Coverage Hierarchy:
- Statement Coverage: Ensures every executable code statement is executed at least once: $$\text{Statement Coverage} = \frac{\text{Number of executed statements}}{\text{Total statements}} \times 100\%$$
- Branch / Decision Coverage: Ensures every decision point (e.g.,
if/else,switch) evaluates to bothTRUEandFALSEat least once. - Condition Coverage: Evaluates every individual boolean sub-condition in compound expressions (e.g., in
if (A && B), test $A=\text{T/F}$ and $B=\text{T/F}$). - Multiple Condition Coverage (MCC): Tests all $2^n$ possible truth-table combinations of boolean conditions.
- Path Coverage: Tests every independent executable path through the program from start to end (strongest coverage).