What is White Box Testing?
White box testing (WBT) is also called Structural or Glass box testing.
White box testing involves looking at the structure of the code. When you know the internal structure of a product, tests can be conducted to ensure that the internal operations performed according to the specification. And all internal components have been adequately exercised.
White Box Testing is coverage of the specification in the code.
Code coverage:
Segment coverage:
Ensure that each code statement is executed once.
Branch Coverage or Node Testing:
Coverage of each code branch in from all possible was.
Compound Condition Coverage:
For multiple condition test each condition with multiple paths and combination of different path to reach that condition.
Basis Path Testing:
Each independent path in the code is taken for testing.
Data Flow Testing (DFT):
In this approach you track the specific variables through each possible calculation, thus defining the set of intermediate paths through the code.DFT tends to reflect dependencies but it is mainly through sequences of data manipulation. In short each data variable is tracked and its use is verified.
This approach tends to uncover bugs like variables used but not initialize, or declared but not used, and so on.
Path Testing:
Path testing is where all possible paths through the code are defined and covered. Its a time consuming task.
Loop Testing:
These strategies relate to testing single loops, concatenated loops, and nested loops. Independent and dependent code loops and values are tested by this approach.
Why we do White Box Testing?
To ensure:
- That all independent paths within a module have been exercised at least once.
- All logical decisions verified on their true and false values.
- All loops executed at their boundaries and within their operational bounds internal data structures validity.
Need of White Box Testing?
To discover the following types of bugs:
- Logical error tend to creep into our work when we design and implement functions, conditions or controls that are out of the program
- The design errors due to difference between logical flow of the program and the actual implementation
- Typographical errors and syntax checking
Skills Required:
We need to write test cases that ensure the complete coverage of the program logic.
For this we need to know the program well i.e. We should know the specification and the code to be tested. Knowledge of programming languages and logic.
Limitations of WBT:
Not possible for testing each and every path of the loops in program. This means exhaustive testing is impossible for large systems.
This does not mean that WBT is not effective. By selecting important logical paths and data structure for testing is practically possible and effective.
Reference- http://www.softrel.org/stgb.html
Comment out your queries on white box testing below. Meantime I will cover Black box testing in detail.



23 comments ↓
At what depth should we know programming languages? Is WBT done by dev’s?
[…] ← White box testing: Need, Skill required and Limitations […]
automation tools used for white box testing?????
some of the tools available in white box testing???
@ Nikhil- If you have basic idea of programming language then also you can do WBT. Just you need to learn on the fly each time on your project and need to get clear idea of the application working flow.
It would be simple for you if you use any source code analysis tool if you have basic knowledge of the language in which your application is written.
Source code understanding is most important for every white box test case as you modify the code to execute the test cases.
White box testing can also be efficient just by seeing the source code of the application. When you know some weak points where you can think this code can break simply apply those cases manually as black box testing. This concept is referred as gray box testing.
@ Shweta and Selvi: You can see a comprehensive list of testing tools listed on this page:
http://www.aptest.com/resources.html
The source code generally written by developers,but if a tester performs this WBT then :
(i)How much in depth knowledge a tester should have abt a progg languge?
(ii)If a another developer perform WBT for that module,will that be a better option?
What should be done exactly??
Hi friends,
There are tools like nUnit,JUnit for white box testing.
White box testing is done mainly by Developers , But If tester haves the required programing language knowledge then he can also perform white box testing.Tester should know the basics, like how to call function, pass parameters to function , store the values in database or text files… etc..
As a manual tester in a product based company is it necessary to do white box testing??
not necessary that we should have white box knowledge to work in product based company… It depends on your role and type of testing…
Could u please explain how to test a smart card application manually? what are the different types of testing we should keep in mind before starting…
im a fresher in testing field. nw I’m testing a smart card application. i want to know what all procedures( in WBT & BBT) I hav to do for a successful test.
can you tell me the types of errors
[…] typically used in unit and integration testing. Do read a good post on White box testing here - What is white box testing? Need and limitations of White box or glass box testing __________________ -The Big K- Founder & Administrator ? The Big K?s Superblog? ? About CE ? […]
How to write test cases in White Box Testing??..
Swetha…firstly devide the testing into positive and negative testing.
Determine the unit which is to be tested, then decide the positive test case input values, which includes the border inputs as well. Then set the expected results. And finally test them against the actual results.
Same TBD with negative test cases.
Diffrence between White-box Testing & Block-box Testing
Iam a fresher in testing field. nw I’m testing a web based application. i want to know what all procedures( in WBT & BBT) I hav to do for a successful test.
Kindly can someone list out the tools used for White Box Testing?
Hi,
Kindly can someone tell me the differences between Nunit and Junit plz?
It would be of great help as I am doing my assignments..
Thanks,
Poornima
What are manual WBT types??? Do we have to write SQL queries for WBT???? Plz give any live case eg.
Thanks
Ashish
Can any1 answer dis question wid reason???
Considering the following pseudo-code, calculate the MINIMUM number of test cases for statement coverage, and the MINIMUM number of test cases for decision coverage respectively.
READ A
READ B
READ C
IF C>A THEN
IF C>B THEN
PRINT “C must be smaller than at least one number”
ELSE
PRINT “Proceed to next stage”
ENDIF
ELSE
PRINT “B can be smaller than C”
ENDIF
A 3, 3.
B 2, 3.
C 2, 4.
D 3, 2.
as there are 3 read statments(Read a,Read b,Read c) so we need 3 statment coverage
consider C=3 B=2 and A=1,so if both IF condition satisfies than “PRINT “C must be smaller than at least one number” and “PRINT “B can be smaller than C”
will be executed , and next if both IF condition fails than
“PRINT “Proceed to next stage”
ENDIF
ELSE
PRINT “B can be smaller than C”
will be executed .so we need min 2 branch coverage.
so answer is D..
let me know if m wrong….
i think shiv you are wrong in explaining statement coverage. it means all executable codes should be executed atleast once.
Leave a Comment