White Box Testing
White Box Testing
The white box testing which also known as glass box is testing, structural
testing, clear box testing, open box testing and transparent box testing.
The primary goal of white box testing is to focus on the flow of inputs and
outputs through the software and strengthening the security of the software.
Developers do white box testing. In this, the developer will test every line of the
code of the program. The developers perform the White-box testing and then
send the application or the software to the testing team, where they will perform
the black box testing and verify the application along with the requirements and identify the bugs
and sends it to the developer.
The developer fixes the bugs and does one round of white box testing and sends
it to the testing team. Here, fixing the bugs implies that the bug is deleted, and
the particular feature is working fine on the application.
The white box testing contains various tests, which are as follows:
o Path testing
o Loop testing
o Condition testing
Path testing
In the path testing, we will write the flow graphs and test all independent paths.
Here writing the flow graph implies that flow graphs are representing the flow of
the program and also show how every program is added with one another as we
can see in the below image:
And test all the independent paths implies that suppose a path from main() to
function G, first set the parameters and test if the program is correct in that
particular path, and in the same way test all other paths and fix the bugs.
Loop testing
In the loop testing, we will test the loops such as while, for, and do-while, etc. and
also check for ending condition if working correctly and if the size of the
conditions is enough.
For example: we have one program where the developers have given about
50,000 loops.
1. {
2. while(50,000)
3. ……
4. ……
5. }
We cannot test this program manually for all the 50,000 loops cycle. So we write
a small program that helps for all 50,000 cycles, as we can see in the below
program, that test P is written in the similar language as the source code
program, and this is known as a Unit test. And it is written by the developers only.
1. Test P
2. {
3. ……
4. …… }
As we can see in the below image that, we have various requirements such as 1,
2, 3, 4. And then, the developer writes the programs such as program 1,2,3,4 for
the parallel conditions. Here the application contains the 100s line of codes.
The developer will do the white box testing, and they will test all the five
programs line by line of code to find the bug. If they found any bug in any of the
programs, they will correct it. And they again have to test the system then this
process contains lots of time and effort and slows down the product release time.
Now, suppose we have another case, where the clients want to modify the
requirements, then the developer will do the required changes and test all four
program again, which take lots of time and efforts.
In this, we will write test for a similar program where the developer writes these
test code in the related language as the source code. Then they execute these
test code, which is also known as unit test programs. These test programs
linked to the main program and implemented as programs.
Therefore, if there is any requirement of modification or bug in the code, then the
developer makes the adjustment both in the main program and the test program
and then executes the test program.
Condition testing
In this, we will test all logical conditions for both true and false values; that is,
we will verify for both if and else condition.
For example:
1. if(condition) - true
2. {
3. …..
4. ……
5. ……
6. }
7. else - false
8. {
9. …..
10. ……
11. ……
12. }
The above program will work fine for both the conditions, which means that if the
condition is accurate, and then else should be false and conversely.
Test cases for white box testing are derived from the design phase of the
software development lifecycle. Data flow testing, control flow testing, path
testing, branch testing, statement and decision coverage all these techniques
used by white box testing as a guideline to create an error-free software.
The developers can perform white box testing. The test engineers perform the
black box testing.
In this, the developer should know about the In this, there is no need to know
internal design of the code. about the internal design of the
code.