White box testing is also referred to as structure-based testing, structural testing and glass box testing. In this technique, the knowledge of code or internal architecture of the system is required to carry out the testing.
What is White-box testing?
White box testing is the type of testing in which testing is carried out based on the knowledge of the internal architecture of the application.
The application’s design, structure, and the source code are required to be studied for this type of testing. Since developers already have knowledge of all these. Hence, mostly developers are required to do white-box testing techniques to test their own code.
It is applicable to 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 don’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.
Difference between White box and Black box testing
- In white-box testing, knowledge of application code and architecture is required. Whereas, the same is not required in black-box testing.
- White-box testing can help in finding bugs before black-box testing can be done. So, it can help in the early identification of bugs.
- Using white-box testing, we can test many granular aspects of the application. Whereas, using black-box testing, we test the end to end functionality of the application.
- White-box testing is generally performed by developers or QA with sound knowledge of programming and application architecture. Whereas, black-box testing is generally performed by an independent QA team.
- White-box testing is applicable for lower levels of testing – unit testing and integration testing where we have to deal with modules and their interfacing. Whereas, black-box testing is applicable to higher levels of testing – system testing and acceptance testing where we are required to test the application as a whole.
With this, we have come to the end of this article. If you have any questions, please ask in the comment section. Also, check out our complete software testing tutorial below–