Glass Box testing can also be called as white box testing, clear testing, transparent testing, Structural testing which is used to test the internal working of the system. Glass box testing is exactly opposite to the black box testing. Glass box testing is also known as the opaque testing because as the testing technique is transparent, test cases cannot be derived until the code is studied.
This testing technique is used to test the internal working / structure of the system. In glass box testing the application is tested at the level of source code.
Glass box testing includes some testing techniques as follows:
1. Statement coverage
2. Path coverage
3. Branch coverage
1. Statement coverage: In statement coverage all the statements in the program are tested.
The formula to calculate the statement coverage is:
statement coverage = (No. of statements exercised / Total no. of statements) x 100 %
2. Path coverage: Path coverage includes testing all the path which are included in the program which informs us that all the statements in the program are covered.
The formula to calculate the path coverage is:
Path coverage = (Number of paths exercised / Total no. of paths in the program) X 100 %
3. Branch coverage: Branch coverage ensures that all the branches included in the program are tested at least once.
The formula to calculate the branch coverage is:
Branch coverage =(No. of branch exercised / Total no. of branches in the program) X 100 %.
Advantages of glass box testing:
- Testing is done at the source code point of view.
- Glass box testing is easy to automate.
- Testing is more thorough which tests all the paths and branches included in the program
Disadvantages of glass box testing:
- Depth knowledge of programming language is necessary which brings the complexity to the testing.
- Using glass box testing missing functionality cannot be found.
- Test cases can be derived only if the code is understood.