cen 5070 – software v&v boundary testing © 2001-2008, dr. e.l. jones
TRANSCRIPT
CEN 5070 – Software V&V
BOUNDARY TESTING
© 2001-2008, Dr. E.L. Jones
2/2000 Unit Test Concepts 2
Agenda
• More on Boundary Points & Values
• Automated Test Data Generation
• Boundary Testing Approach
• Test Set Reduction Strategies
2/2000 Unit Test Concepts 3
BOUNDARY TESTING DESIGN METHODOLOGY
• Specification
• Identify elementary boundary conditions
• Identify boundary points
• Generate boundary test cases
• Update test script (add boundary cases).
2/2000 Unit Test Concepts 4
(1) Specification
• Compute pay for an hourly employee, given the number of hours worked and the hourly pay rate. Compute overtime at 1.5 times hourly rate for hours in excess of 40.
SoftwareunderTest
Hours Pay
Rate
2/2000 Unit Test Concepts 5
(2) Identify Boundary Conditions
• Condition 1 (bc1): Hours <= 40
• Observations:• Condition taken directly from decision table
2/2000 Unit Test Concepts 6
(3) Identify Boundary Points
• bc1 Boundary Points• Point 1: AT the boundary: Hours = 40
• Point 2: Just INside: Hours = 39
• Point 3: Just OUTside: Hours = 41
• Observations:• The Hours value must be paired with Rate
• Inclusive inequalities have 3 boundary points
2/2000 Unit Test Concepts 7
(4) Generate Test Cases
• Combine Hours boundary points with Rate• Case 1 (AT): Hours = 40, Rate = 10, Pay=400
• Case 2 (IN): Hours = 39, Rate = 10, Pay=390
• Case 3: (OUT): Hours = 41, Rate=10, Pay=415
• Observations:• Test each boundary point individually
• Then consider pair-wise boundary points
2/2000 Unit Test Concepts 8
(5) Update Test Script
StepStimuli Expected Response
Hours Rate Pay =
1
2
30
50 10
10 300
550
3 40 10 400
4 39 10 390
5 41 10 415
2/2000 Unit Test Concepts 9
Your TurnBoundary Testing
c1: Age <= 12 | Y N N
c2: Age > 65 | Y N N
c3: Age > 80 | Y
c4: Weight > 300 | Y N N N N
c5: Weight > 120 | N Y
a1: Pills = 0 | X X
a2: Pills = 1 | X
a3: Pills = 2 | X X
a4: Pills = 2+(W-120)/50 | X
Decision Table:
2/2000 Unit Test Concepts 10
Your Turn (2-3) Boundary Conditions/Points
Boundary Condition Boundary Point (BP)AT IN
bc1:
OUT
bc2:
bc3:
bc4:
bc5:
2/2000 Unit Test Concepts 11
Your Turn(4) Generate Boundary Test Cases
• To create a test case, you must pair an Age with a Weight• Weight boundary point + NOMINAL Age
• Age boundary point + NOMINAL Weight
• OUT Age + OUT Weight A nominal value is one that is not close to a boundary point. For simplicity, use the same nominal value in all test cases.
2/2000 Unit Test Concepts 12
Your Turn(4) Boundary-Nominal Test CasesCondition btc BC Weight Age Expect
Weight>300 1 IN 301 21 0
2 OUT 300 21
Age <= 12 3 IN 220 11
4 AT 12
5 OUT 13
Age > 65 6 IN
7 OUT
Age > 80 9 IN
10 OUT
Weight>120 11 IN
12 OUT
2/2000 Unit Test Concepts 13
Your Turn(4) Out-Out Boundary Test Cases
Condition OUT BP
Weight Age btc Weight Age Expect
>300 <=12 13
>65 14
>80 15
>120 <=12 16
>65 17
>80 18
2/2000 Unit Test Concepts 14
OBSERVATIONS
• Functional testing defines a minimal number of test cases
• Boundary testing adds a large number of test cases, but are EASY to create
• Boundary testing finds lots of errors!
2/2000 Unit Test Concepts 15
BOUNDARIES EXIST FOR
• Optional fields: (present, missing).
• Variable length data: null string, max length
• Database tables: empty
• Searching: first/last position
• File: closed, empty
2/2000 Unit Test Concepts 16
Agenda
• More on Boundary Points & Values
• Automated Test Data Generation
• Boundary Testing Approach
• Test Set Reduction Strategies
2/2000 Unit Test Concepts 17
Agenda
• More on Boundary Points & Values
• Automated Test Data Generation
• Boundary Testing Approach
• Test Set Reduction Strategies
2/2000 Unit Test Concepts 18
Tools for Boundary Testing
• Ref – MS thesis, Jermaine Stewart, 2006
• Versions: BTDgen.run, BTDgenGUI.run
• Unix invocation: % BTDgen
• BTDgen: specification Boundary Test Sets• Full cartesian product – high volume [btd_xxx.txt]
• Reduced set (nominal values) [bnc_xxx.txt]
• Specification: var declarations + boundary conditions.
2/2000 Unit Test Concepts 19
Agenda
• More on Boundary Points & Values
• Automated Test Data Generation
• Boundary Testing Approach
• Test Set Reduction Strategies
2/2000 Unit Test Concepts 20
Boundary Test Set Reduction
• Cartesian product yields exponential size
• Boundary-nominal yields linear size• By-passes “masking” problem
• Multiple boundaries not tested
• Combinatorial methods applied to each variable’s boundary value set.
2/2000 Unit Test Concepts 21
RANDOM TESTING
• Beyond scope of this lecture
• Used to bombard software with inputs (high volume testing)
• No effort to identify expected results
• Appropriate for automated load testing, where concern is for capacity/volume.
2/2000 Unit Test Concepts 22
MAIN POINTSBLACK-BOX TESTING
• Black-box = spec-based testing• Tests intentions• Key knowledge = stimuli and responses• Decision table organizes S/R conditions• Boundary testing flushes coding errors• Black-box test case design can drive
software design -- same issues addressed
2/2000 Unit Test Concepts 23
PUTTING IT ALL TOGETHER
• Test design is a systematic process • whether you use decision tables or not, you
must understand the factors influencing and influenced by the behavior of the unit
• The sooner you design test cases, the better• Test design is more crucial than running tests• Reveals assumptions, omissions and errors
• Use test cases during design and coding
2/2000 Unit Test Concepts 24
SOLUTIONS TO EXERCISES
2/2000 Unit Test Concepts 25
Your Turn(2) Identify Boundary Conditions
• Condition 1 (bc1): Age <= 12
• Condition 2 (bc2): Age > 65
• Condition 3 (bc3): Age > 80
• Condition 4 (bc4): Weight > 300
• Condition 5 (bc5): Weight > 120
2/2000 Unit Test Concepts 26
Your Turn(3) Identify Boundary Points
Boundary Condition Boundary PointAT IN
bc1: Age <= 12
OUT
bc2: Age > 65
bc3: Age > 80
bc4: Weight > 300
bc5: Weight > 120
12 11
66
81
301
121
13
65
80
300
120
2/2000 Unit Test Concepts 27
Your Turn(4) Boundary-Nominal Test Cases
Condition btc BC Weight Age Expect
Weight>300 1 IN 301 21 0
2 OUT 300 21 5
Weight>120 3 IN 121 21 2
4 OUT 120 21 2
Age <= 12 5 AT 220 12 1
6 IN 220 11 1
7 OUT 220 13 4
Age>65 8 IN 220 66 2
9 OUT 220 65 4
Age>80 10 IN 220 81 0
11 OUT 220 80 2
2/2000 Unit Test Concepts 28
Your Turn(4) Out-Out Boundary Test Cases
Condition OUT B-point
Weight Age btc Weight Age Expect
>300 <=12 12 300 13 5
>65 13 300 65 5
>80 14 300 80 5
>120 <=12 15 120 13 2
>65 16 120 65 2
>80 17 120 80 2