Académique Documents
Professionnel Documents
Culture Documents
ThoughtWorks, 2007
Objective
What is White box testing
ThoughtWorks, 2007
What is it?
Testing the internal structure of the software Understand the code and the code will set you free! White-box testing is testing that takes into account the internal mechanism of a system or component
Its also known as Structural testing, clear box testing and glass box testing
ThoughtWorks, 2007
Techniques
Statement coverage
Loop testing
Path testing Branch testing
ThoughtWorks, 2007
Statement Coverage
Statement coverage: All statements in a method are executed. void foo (int a, b, c, d, e) { if (a == 0) { return; int x = 0; if ((a==b) OR ((c==d) AND bug(a) )) { x =1; e = 1/x; } } }
ThoughtWorks, 2007
Loop testing
Test the for and while loops in the code. Look for exceptions of infinite loop. Cause execution of loop to be skipped. Loop to be executed exactly once. Loop to be executed more than once
ThoughtWorks, 2007
Path testing
Make sure all the paths are covered. Determine the paths Construct a logic flow chart
ThoughtWorks, 2007
} /* Compute the mean and print the result */ 7 if (NumberOfScores > 0) { Mean = SumOfScores / NumberOfScores; printf( The mean score is %f\n, Mean); } else printf (No scores found in file\n); 9 }
ThoughtWorks, 2007
ThoughtWorks, 2007
Branch testing
Also known as Conditional Testing
Make sure that each possible outcome from a condition is tested at least once.
if (i=true)
printf (I am true)
else printf (I am false)
ThoughtWorks, 2007
ThoughtWorks, 2007