White-box testing (or clear box testing, glass box testing, transparent box testing, or structural testing) is a method of testing software that tests internal structures or workings of an application, as opposed to its functionality (i.e. black-box testing). In white-box testing an internal perspective of the system, as well as programming skills, are required and used to design test cases. The tester chooses inputs to exercise paths through the code and determine the appropriate outputs. This is analogous to testing nodes in a circuit, e.g. in-circuit testing (ICT).
While white-box testing can be applied at the unit, integration and system levels of the software testing process, it is usually done at the unit level. It can test paths within a unit, paths between units during integration, and between subsystems during a system level test. Though this method of test design can uncover many errors or problems, it might not detect unimplemented parts of the specification or missing requirements.
White-box test design techniques include:
- Control flow testing
- Data flow testing
- Branch testing
- Path testing
White box testing is when the tester has access to the internal data structures and algorithms including the code that implement these.
White box testing is the type of testing which testing is carried out based on the knowledge of the internal architecture of the application. In white-box testing, the tester analyzes the quality of source code on different parameters like code optimization, code coverage, code reusability etc.
It is applicable for lower levels of testing types – unit testing and integration testing where we have to deal with individual modules of the application and their interfacing.
White box testing techniques
The different types of white box testing techniques are-
- Statement testing – In statement testing, the test scripts are designed to execute the code and the coverage is measured by the line of code or statements executed by test scripts.
- Decision testing/branch testing – In decision testing we measure of the percentage of decision points(e.g. if-else conditions) executed out of the total decision points in the application.
- Condition testing – Condition testing involves testing the individual conditions for both the outcomes -TRUE and FALSE. So, getting 100% condition coverage requires exercising each condition for both TRUE and FALSE results(for n conditions, we will have 2n test scripts).
- Multiple condition testing – Testing the different combinations of condition outcomes. Hence for 100% coverage we will have 2^n test scripts. This is very exhaustive and very difficult to achieve 100% coverage.
- Condition determination testing – It is an optimized way of multiple condition testing in which the combinations which doesn’t affect the outcomes are discarded.
- Path testing – Path testing involves testing carried out by covering the independent paths in the system where paths are executable statements from entry to exit points.