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.
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.
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.
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.