White Box Testing is a software testing method in which the internal structure/ design/ implementation of the item being tested is known to the tester.
The tester chooses inputs to exercise paths through the code and determines the appropriate outputs. Programming know-how and the implementation knowledge is essential. White box testing is testing beyond the user interface and into the nitty-gritty of a system.
ISTQB Definition : White-box testing: Testing based on an analysis of the internal structure of the component or system.
Whitebox Testing techniques
In the programming language, a statement is nothing but the line of code or instruction for the computer to understand and act accordingly. A statement becomes an executable statement when it gets compiled and converted into the object code and performs the action when the program is in running mode.
Hence “Statement Coverage”, as the name suggests, is the method of validating that each and every line of code is executed at least once.
“Branch” in the programming language is like the “IF statements”. If a statement has two branches: true and false.
So in Branch coverage (also called Decision coverage), we validate that each branch is executed at least once.
In case of an “IF statement”, there will be two test conditions:
- One to validate the true branch and
- Other to validate the false branch
Hence, in theory, Branch Coverage is a testing method which when executed ensures that each branch from each decision point is executed.
Path coverage tests all the paths of the program. This is a comprehensive technique which ensures that all the paths of the program are traversed at least once. Path Coverage is even more powerful that Branch coverage. This technique is useful for testing the complex programs.
Advantage of Whitebox Testing
Testing is more thorough, with the possibility of covering most paths.
Testing can be commenced at an earlier stage. One need not wait for the GUI to be available.
Disadvantage of Whitebox Testing
Since tests can be very complex, highly skilled resources are required, with the thorough knowledge of programming and implementation.
Test script maintenance can be a burden if the implementation changes too frequently.
Since this method of testing it closely tied with the application being testing, tools to cater to every kind of implementation/platform may not be readily available.