Lecture24 - Testing Part 3
Lecture24 - Testing Part 3
e = {1, 2, 3}
cout << count; // incorrect output
Reachability? yes
Infection? yes
Propagation? Yes
Revealability? Yes
Introduction to Software Testing (Ch 1), www.introsoftwaretesting.com © Ammann & Offutt 4
int count = 0;
…
if (e.hasMoreElements()){ // should be while(e.hasMoreElements())
… e.nextElement();…
count++;
}
e = {1}
cout << count; // incorrect output
Reachability? Yes
Infection? No
Propagation? No
Revealability? No
Introduction to Software Testing (Ch 1), www.introsoftwaretesting.com © Ammann & Offutt 5
int count = 0; boolean bNonZero = false;
…
if (e.hasMoreElements()){ // should be while(e.hasMoreElements())
… e.nextElement();…
count++;
} e = {1, 2, 3}
Reachability? yes
Infection? yes
Propagation? No
Revealability? No
if (count > 0) bNonZero = true; → nullified the propagation
cout << bNonZero; // correct output
main Class P
Class A Class B
main Class P
Class A Class B
main Class P
Class A Class B
Integration testing:
method mA1() method mB1() Test how modules
interact with each
other (testing the subsystem
method mA2() method mB2() design)
main Class P
Class A Class B
Integration testing:
method mA1() method mB1() Test how modules
interact with each
other (testing the subsystem
method mA2() method mB2() design)
Module testing: Test
each class, file, module
or component (testing the
detailed design)
2 6
1 5 7
3 Node (Statement)
Cover every node
This graph may represent • 12567
• statements & branches 4
• 1343567
• methods & calls
• states and transitions
2 6
1 5 7
3 Node
Edge (Statement)
(Branch)
Cover
Coverevery
everynode
edge
This graph may represent •• 12567
12567
• statements & branches 4
•• 1343567
1343567
• methods & calls
• 1357
• states and transitions
2 6
1 5 7
3 Node
Path(Statement)
Edge (Branch)
Cover
Coverevery
Cover everynode
every edge
path
This graph may represent •••12567
12567
12567
• statements & branches 4
•••1343567
1343567
1257
• methods & calls
•• 1357
13567
• states and transitions
• 1357
• 1343567
Introduction to Software Testing (Ch 1), www.introsoftwaretesting.com © Ammann & Offutt
• 134357 … 18
2. Logical Expressions
Unit level
– Parameters F (int X, int Y)
– Possible values X: { <0, 0, 1, 2, >2 }, Y : { 10, 20, 30 }
– Tests
• F (-5, 10), F (0, 20), F (1, 30), F (2, 10), F (5, 20)