Updated: May 5, 2021
Types of software testing
Pre-requisite - Types of testing, how they are related?
Software testing is an integral and most critical part of the software development life cycle (SDLC). In today's age, there is software for every possible human need. It is important for software professionals to understand what are the different ways to test software.
Three software testing types -
White Box Testing
White box testing is the technique that tests the
code structure, and
of the software application.
This technique is also called structural testing, clear box testing, open box testing, and transparent box testing. The goal of testing is to improve architecture design and optimize the code and data structure of the software. It also helps strengthen the security of the software. This technique is called ‘white box’ or ‘open box’ as testers have a clear view of the application code. The person performing the white box testing should have the ability to read and understand the code, code flow, data structures, and the architecture of the application. Hence this role, in general, is played by developers. The tester will interact with the software by providing input to the code and compare the output with the expected output.
Ways to do white-box testing -
White-box can be performed using below testing methods -
1. Statement Coverage testing -
Ensures testing coverage by running all the statements of the source code at least once. One of the widely used white-box software testing techniques, it is checked for true conditions only and validates all possible paths, statements, and lines in source code. It also helps in deriving scenarios of test cases based upon the structure of the code. Using this process we can ensure each line of code is working as expected. Statement coverage is calculated as -
Statement Coverage = Number of Executed Statements/ Total Number of Statements x 100
2. Branch Coverage Testing-
Branch Coverage tests every possible branch of conditional logic. It is used to test the possible results from each conditional flow. It ensures that no branch leads to abnormal behavior of the application. Branch Coverage can be calculated by:
Branch Coverage = Number of executed branches/ Total number of branches * 100
3. Path Coverage - the aim of this is to validate that all the possible linearly independent code path flows are working as expected. This is performed by running the code and providing the input which will test a linearly independent code path. Tests are performed for all other code paths.
Path Coverage = number of linearly independent paths tested / T Number of linearly independent path x 100
4. Loop Coverage - Loops are the basic building blocks of the software application. In this test, programming loops like for, while, do-while are tested for inbound and out of bound conditions.
Loop Coverage = Number of Loop tested / Total Number of Loop x 100
Advantages of white-box testing -
White Box Testing has a thorough nature that provides a clear structure to code.
White Box Testing speeds up the testing process significantly. Many times, the developer can see the bug and immediately have a general idea about what is to be done to fix the issues.
It allows the code to be optimized by removing hidden errors which may not be detected during backbox testing.
In this testing technique, the code goes through section by section and allows developers to remove superfluous sections of code.
Understanding the internals of the application allows unit tests.
Disadvantages of white-box testing -
The major disadvantages of white-box testing include rapidly changing code, its cost, and missed cases.
Since white box testing is thorough, it is very expensive to conduct. In order to create a full range of inputs to test each path the white box testing method is time-consuming.
An initial investment must be done to carry the unit tests.
It only verifies the test cases that are currently present. White Box Testing does not pick errors if a feature is only partially implemented or something is missing.
It does not favor exhaustive testing if the application is of large size.
Best Suited applications for white-box testing-
Considering the return of running white box testing, more suited applications for white-box testing are applications that are non-ui based, holding just business logic or algorithms.
With the black box, testing proved as an easier way to test the software application, white box testing is of lesser importance as validating the end-to-end functional flows provides a faster, easier, and economically viable way to find defects. That black-box testing is not a substitute for white-box testing as it cannot uncover logic abnormally or give substantial results to optimize the code, but it has served the business purpose as the industry is focusing more on black-box testing. To overcome the difficulty and execution challenges of white box testing there are automated tools in the market now that run the code and provide white box testing stats.
Learn Advance - How to write a Test Plan?