The document discusses black-box and white-box testing techniques. For black-box testing, it describes equivalence class partitioning and boundary value analysis. For white-box testing, it covers statement coverage, branch coverage, path coverage, condition coverage, mutation testing, and data flow-based testing. It provides examples of how to apply equivalence class partitioning and test different types of code coverage.
1 of 23
Downloaded 29 times
More Related Content
Black box and White box examples
2. Black-box Testing
0 Two main approaches to design black box test cases:
0 Equivalence class partitioning
0 Boundary value analysis
Gurbakash Phonsa
3. Example
In a computer store, the computer item can have
a quantity between -500 to +500.
Define equivalence classes for above scenario?
Gurbakash Phonsa
13. Example
0 int f1(int x, int y){
0 1 while (x != y){
0 2 if (x>y) then
0 3 x=x-y;
0 4 else y=y-x;
0 5 }
0 6 return x; }
Gurbakash Phonsa
14. Statement testing:: Test cases
0By choosing the test set
{(x=3,y=3),(x=4,y=3), (x=3,y=4)}
0All statements are executed at least
once.
Gurbakash Phonsa
15. Branch Coverage
0Test cases are designed such
that:
0Different branch conditions
0Given true and false values in
turn.
Gurbakash Phonsa
16. Branch Coverage
0Branch testing guarantees
statement coverage:
0A stronger testing compared to
the statement coverage-based
testing.
Gurbakash Phonsa
17. Example
int f1(int x,int y){
1 while (x != y){
2 if (x>y) then
3 x=x-y;
4 else y=y-x;
5 }
6 return x; }
Gurbakash Phonsa
18. Example
0 Test cases for branch coverage can
be:
{(x=3,y=3),(x=3,y=2), (x=4,y=3),
(x=3,y=4)}
Gurbakash Phonsa
19. Condition Coverage
0 Test cases are designed such that:
0Each component of a composite
conditional expression
0Given both true and false values.
Gurbakash Phonsa
20. Example
0 Consider the conditional
expression
0((c1.and.c2).or.c3):
0 Each of c1, c2, and c3 are
exercised at least once,
0i.e. given true and false values.
Gurbakash Phonsa