Defect Detection White Box Test Case Design Through Control Flow Graph
Defect Detection White Box Test Case Design Through Control Flow Graph
by
Dr. Rizwan
White Box Testing
White box testing is also know as Glass Testing or Open box
testing is detailed examination of internal structure and logic
of code.
This examination is demonstrated through test cases creation
by looking at the code to detect any potential failure
scenarios.
Disadvantages of White Box Testing
Numbered statements:
Represent nodes of the flow graph
int abs(int x ) {
if ( x ≥ 0 )
x = 0 - x;
return x;
}
Statement Coverage
Exercise all statements at
least once
/* x is valid if 0 ≤ x ≤ 100 */
return TRUE;
Path Condition
1, 2, 3, 8, 9 Bottom< top && found == false elemArray[mid] == key
1, 2, 3, 4, 6, 7, 2 Bottom< top && found == false elemArray[mid] == key
20. else {
21. cout<<" Invalid entry for maximum "<<endl;
22. }
23. if (number1 < number2 && number1 < number3) {
24. cout<<"Number 01 is minimum…"<<endl;
25. }
26. else if (number2 < number1 && number2 < number3) {
27. cout<<"Number 02 is minimum…"<<endl;
28. }
29. else if (number3 < number1 && number3 < number2) {
30. cout<<"Number 03 is minimum…"<<endl;
31. }
32. else {
33. cout<<" Invalid entry for minimum "<<endl;
34. }
35. return 0;
36. }
How to Design Test Case Through White Box
Make Control Flow Graph
Make Data Flow/Initialize
Choice of WBT Technique
How to Design Test Case Through White Box
1 2 5 3 Number 3 is Max
Number 1 is Mini
How to Design Test Case Through White Box
2 9 5 2 Number 1 is Max
Number 3 is Mini
How to Design Test Case Through White Box
3 3 7 6 Number 2 is Max
Number 1 is Mini
How to Design Test Case Through White Box
3 3 8 2 9 Number 3 is Max
Number 2 is Mini
Assignment 6
1) main ( ) {
2) int num student, marks, subject total ;
3) float average ;
4) num_student = 1;
5) while (num_student < = 40) {
6) total = 0 ;
7) subject = 1;
8) while (subject < = 5) {
9) Scanf ("Enter marks : % d”, & marks);
10) total = total + marks ;
11) subject ++;
12) }
13) average = total/5 ;
14) if (average > = 50)
15) printf ("Pass... Average marks = % f", average);
16) else
17) print ("FAIL ... Average marks are % f”, average) ;
18) num_student ++;
19) }
20) printf ("end of program") ;
21) }