A1 Testing
A1 Testing
TB-1
Need for Testing
TB-2
Need for Testing – 2
TB-3
Testing Not Enough
TB-4
Test Strategy
» Input: -4
» Expected Output: Invalid input
» Actual Output: 1.99999 Uh oh! problem here
TB-6
Black Box Testing – Data Coverage
TB-7
Partition Testing
• Test cases
> just before boundary
> just after a boundary
> on a boundary
> one from the middle of an equivalence class
• Loops
» Zero times through the body
» Once through the body
» Many times through the body
TB-8
Partition Testing – 2
TB-9
Partition Testing – 3
TB-10
White Box Testing
TB-11
Statement Coverage
TB-13
Path Coverage
3 4
• Path coverage – 4 tests
» Execute 1 & 3 with a < b & a+b < a*b
a=2;b=5
» Execute 2 & 4 with a >= b & a*b >= a+b a = 5 ; b = 2
Add for path
» Execute 1 & 4 with a < b & a+b >= a*b a=0;b=1
» Execute 2 & 3 with a >= b & a*b < a+b a=1;b=0
TB-14
Path Coverage – 2
TB-15
Path Coverage – 3
TB-16
Path Coverage – 4
• The algorithm
» 1 Skip any leading spaces.
» 2 Determines what the sign of the number is.
» 3 Get the integer part of the number; determined by
scanning either the end of the number or a decimal
point.
» 4 Continue building the integer representation of the
input as if there was no decimal point, meanwhile
counting the number of decimal digits.
» 5 Compute the real number from the sign, integer
representation and count of decimal digits.
TB-17
Path Coverage – 5
TB-18
Path Coverage – 6
TB-19
Top Down Testing
TB-20
Bottom Up Testing
TB-21
Mixed Top & Bottom Testing
• Use scaffolding
» Have some stubs
» Have some special test drivers
» Like the scaffolding around a building while it is being
built or repaired
» Not a part of the final product but necessary to complete
the task
TB-22
Regressive Testing
TB-23
Minimal Output Testing
TB-24
Minimal Output Testing – 2
TB-26
Debug Flags – 2
• Example
if Debug.flag0 then
Block1
fi
if Debug.flag1 then
Block2
fi
if Debug.flag3 then
Block3
if Debug.flag4 then
Block4
fi
fi
TB-27
Assertions
TB-28
Inspections & Walkthroughs
TB-29
Inspections & Walkthroughs – 2
TB-30
OO Testing
TB-32
Testing Classes
TB-33
Integration Testing
TB-34