Skip to content
BENIBIX Learn

Black-Box Testing vs White-Box Testing

Black-box testing checks what a program does from the outside, with no look at its code. White-box testing reads the code and tests each path through it. Most teams use both, for different jobs.

Development🧪 Testing & Quality

Black-Box Testing

Testing what a program does. You do not look at its code.

Black-box testing checks what a program does without looking at its code. The tester gives it inputs and checks the outputs. They compare the results with what the spec says should happen. They do not need to know how it works inside. Most acceptance tests and manual tests work this way.

Example
Lucy tests a login form. She tries a right password, a wrong one and an empty one, and checks each answer.
Why it matters
It tests the app the way users meet it, and it does not break when the code inside changes.
Full entry
Development🧪 Testing & Quality

White-Box Testing

Testing a program while you read its code. Each path gets a test.

White-box testing checks a program while looking at its code. The tester reads the code and writes tests for each path through it. If there is an if, they test the yes branch and the no branch. Unit tests are usually written this way. Test coverage tools show which lines the tests reached.

Example
Jack sees a discount rule with three branches. He writes three tests, one for each, and coverage shows all three run.
Why it matters
It finds bugs on paths that users rarely reach but still matter.
Full entry

In one line

Black-Box Testing
Testing what a program does. You do not look at its code.
White-Box Testing
Testing a program while you read its code. Each path gets a test.