
Definition: White Box Testing is a technique where the tester has full knowledge of the internal code, structure, and logic of the program.
Definition: White Box Testing is a technique where the tester has full knowledge of the internal code, structure, and logic of the program.
π Simple meaning: You test how the program works internally (code logic).
Requires programming knowledge
Tests internal structure
Also called:
Input β Code Logic β Output
β
Tested here
π Focus is on code execution paths
Ensures that every line (statement) of code is executed at least once.
if (x > 0)
print("Positive");
π Test case:
Statement Coverage = (Executed Statements / Total Statements) Γ 100%
Ensures that each decision (true/false branch) is executed.
if (x > 0)
print("Positive");
else
print("Negative");
π Test cases:
Branch Coverage = (Executed Branches / Total Branches) Γ 100%
π π₯ Frequently asked!
Ensures that all possible execution paths in the program are tested.
if (x > 0)
print("Positive");
if (y > 0)
print("Y Positive");
π Possible paths:
π π₯ Very important for exams!
Tests the correctness of loops (for, while, do-while).
for(i=0; i<n; i++)
print(i);
π Test with:
Focuses on how variables are defined, used, and modified in the program.
int x = 5; // define
print(x); // use
Finds errors like:
Tests each individual condition in a decision.
if (x > 0 && y > 0)
π Conditions:
Test cases:
Statement < Branch < Condition < Path
π Path coverage is strongest.
β Define White Box Testing β Statement vs Branch Coverage β Path Coverage explanation β Loop testing cases β Coverage formulas β Coverage hierarchy
| Technique | What it Tests | Key Idea |
|---|---|---|
| Statement Coverage | All lines | Each statement executed |
| Branch Coverage | Decisions | True/False paths |
| Path Coverage | All paths | Complete execution |
| Loop Testing | Loops | Iterations |
| Data Flow Testing | Variables | Define & use |
| Condition Coverage | Conditions | Each condition |
White Box Testing focuses on internal code logic
Requires programming knowledge
Key techniques:
Branch & Path coverage are most important for exams
Open this section to view and download past papers
Click on Show Past Papers to load available exam papers.