Whitebox and Blackbox Testing
Whitebox and Blackbox Testing
““ Testing
Testing isis the
the process
process of
of
executing
executing aa program
program withwith the
the
intent
intent of
of finding
finding errors.”
errors.”
Glen
GlenMyers
Myers
WHY???
output
input
events
CANNOT BE
EXHAUSTIVE!!!
Selective Testing
12/08/21 CMPE 310 Winter 2001 13
Selective testing
a selected path Selective:
88 fixed_count --;
return;
(b) 1, 2, 4, 5, 7, 8 44 33
(c) 1, 2, 4, 6, 7, 8 55 66
Test cases: 77
(a) count 13 88
(b) count 8
(c) count 2
Why?
Suppose you embed your program in a
HW with a documented bug each time
44 is incremented to 45 ...
12/08/21 CMPE 310 Winter 2001 23
Not required for exams
Condition Testing
Condition testing is a test case design method
that is based on testing all possible conditions
in a program
A condition in a program may contain:
Boolean operators and variables
Parenthesis
All of them can fail!!!
Relational operators
Arithmetic expressions
Condition testing focus on testing
…. each condition in the program
12/08/21 CMPE 310 Winter 2001 24
Kinds of condition testing
Branch testing: for each condition C, the true and the
false branches resulting from it and every simple condition in C
need to be executed at least once
Domain testing: it uses information on the domain;
given a relational condition in the program such as a<b I have to
test it with with values of a and b a<b, a=b, a>b and a and be
VERY close
given a boolean condition with n variables, I have to test it for each
combination of the values (that is 2n cases)
There are other approaches, such as Branch and Relational
operator testing
int k;
for (k=0;k<10;k++)
k=0;k<10;k++
{
w();
if p(m) break;
}
for (;k<10;k++)
;k<10;k++ {
r();
}
12/08/21 CMPE 310 Winter 2001 32
How do we select the
strategy?
The requirements of reliability of the
system
The resources available
The kind of programs
functional languages do not have loops…
The tools available to support the
testing process
requirements
output
input
events
matter!
Graph-Based Testing
Complex Systems are hard to understand
They can be modeled as interacting objects
Test can be performed to ensure that all the
required relations are in place
Pressman, p. 472
bounding values
initiation values
output
user format
queries requests
output responses
domain to prompts
numerical
data