Black-box versus white-box testing

Black-box testing is a way to develop tests by examining the object under test with no knowledge of its internal structure. Only inputs and outputs are examined.

The drawback of this type of testing is that it is difficult to be sure that all pathways have been tested. However, for large, complex systems, the tendency is to do black-box testing to simplify things.

White-box testing, on the other hand, aims to develop tests for an object with full knowledge of its inner workings. It allows the tester to select the test inputs in such a manner that all (or the most important) pathways can be tested. Paths can be constructed from control structures and data access. Code coverage tools are used to automatically find paths and report how well they were tested; for details, perform an Internet search with the "code coverage tools" key word.

Since white-box tests reflect the inner workings of an object, they require updating when the method under test changes. Black-box tests need only be changed when the method signature or semantic changes.