![Page 1: Black-Box Boundary Testing (PowerPoint Slides)](https://reader036.vdocuments.net/reader036/viewer/2022062407/55d6eef8bb61eb7f2d8b4604/html5/thumbnails/1.jpg)
CIS 4932Software Testing
Boundary Testing Approach
![Page 2: Black-Box Boundary Testing (PowerPoint Slides)](https://reader036.vdocuments.net/reader036/viewer/2022062407/55d6eef8bb61eb7f2d8b4604/html5/thumbnails/2.jpg)
2/2000 Unit Test Concepts 2
BOUNDARY TESTING DESIGN METHODOLOGY
• Specification
• Identify elementary boundary conditions
• Identify boundary points
• Generate boundary test cases
• Update test script (add boundary cases).
![Page 3: Black-Box Boundary Testing (PowerPoint Slides)](https://reader036.vdocuments.net/reader036/viewer/2022062407/55d6eef8bb61eb7f2d8b4604/html5/thumbnails/3.jpg)
2/2000 Unit Test Concepts 3
(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
![Page 4: Black-Box Boundary Testing (PowerPoint Slides)](https://reader036.vdocuments.net/reader036/viewer/2022062407/55d6eef8bb61eb7f2d8b4604/html5/thumbnails/4.jpg)
2/2000 Unit Test Concepts 4
(2) Identify Boundary Conditions
• Condition 1 (bc1): Hours <= 40
• Observations:• Condition taken directly from decision table
![Page 5: Black-Box Boundary Testing (PowerPoint Slides)](https://reader036.vdocuments.net/reader036/viewer/2022062407/55d6eef8bb61eb7f2d8b4604/html5/thumbnails/5.jpg)
2/2000 Unit Test Concepts 5
(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
![Page 6: Black-Box Boundary Testing (PowerPoint Slides)](https://reader036.vdocuments.net/reader036/viewer/2022062407/55d6eef8bb61eb7f2d8b4604/html5/thumbnails/6.jpg)
2/2000 Unit Test Concepts 6
(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
![Page 7: Black-Box Boundary Testing (PowerPoint Slides)](https://reader036.vdocuments.net/reader036/viewer/2022062407/55d6eef8bb61eb7f2d8b4604/html5/thumbnails/7.jpg)
2/2000 Unit Test Concepts 7
(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
![Page 8: Black-Box Boundary Testing (PowerPoint Slides)](https://reader036.vdocuments.net/reader036/viewer/2022062407/55d6eef8bb61eb7f2d8b4604/html5/thumbnails/8.jpg)
2/2000 Unit Test Concepts 8
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:
![Page 9: Black-Box Boundary Testing (PowerPoint Slides)](https://reader036.vdocuments.net/reader036/viewer/2022062407/55d6eef8bb61eb7f2d8b4604/html5/thumbnails/9.jpg)
2/2000 Unit Test Concepts 9
Your Turn (2-3) Boundary Conditions/Points
Boundary Condition Boundary Point (BP)AT IN
bc1:
OUT
bc2:
bc3:
bc4:
bc5:
![Page 10: Black-Box Boundary Testing (PowerPoint Slides)](https://reader036.vdocuments.net/reader036/viewer/2022062407/55d6eef8bb61eb7f2d8b4604/html5/thumbnails/10.jpg)
2/2000 Unit Test Concepts 10
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.
![Page 11: Black-Box Boundary Testing (PowerPoint Slides)](https://reader036.vdocuments.net/reader036/viewer/2022062407/55d6eef8bb61eb7f2d8b4604/html5/thumbnails/11.jpg)
2/2000 Unit Test Concepts 11
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
![Page 12: Black-Box Boundary Testing (PowerPoint Slides)](https://reader036.vdocuments.net/reader036/viewer/2022062407/55d6eef8bb61eb7f2d8b4604/html5/thumbnails/12.jpg)
2/2000 Unit Test Concepts 12
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
![Page 13: Black-Box Boundary Testing (PowerPoint Slides)](https://reader036.vdocuments.net/reader036/viewer/2022062407/55d6eef8bb61eb7f2d8b4604/html5/thumbnails/13.jpg)
2/2000 Unit Test Concepts 13
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!
![Page 14: Black-Box Boundary Testing (PowerPoint Slides)](https://reader036.vdocuments.net/reader036/viewer/2022062407/55d6eef8bb61eb7f2d8b4604/html5/thumbnails/14.jpg)
2/2000 Unit Test Concepts 14
BOUNDARIES EXIST FOR
• Optional fields: (present, missing).
• Variable length data: null string, max length
• Database tables: empty
• Searching: first/last position
• File: closed, empty
![Page 15: Black-Box Boundary Testing (PowerPoint Slides)](https://reader036.vdocuments.net/reader036/viewer/2022062407/55d6eef8bb61eb7f2d8b4604/html5/thumbnails/15.jpg)
2/2000 Unit Test Concepts 15
RANDOM TESTING
• Beyond scope of this course
• Generally used to bombard software with inputs
• No effort to identify expected results
• Appropriate for automated load testing, where concern is for capacity/volume.
![Page 16: Black-Box Boundary Testing (PowerPoint Slides)](https://reader036.vdocuments.net/reader036/viewer/2022062407/55d6eef8bb61eb7f2d8b4604/html5/thumbnails/16.jpg)
2/2000 Unit Test Concepts 16
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
![Page 17: Black-Box Boundary Testing (PowerPoint Slides)](https://reader036.vdocuments.net/reader036/viewer/2022062407/55d6eef8bb61eb7f2d8b4604/html5/thumbnails/17.jpg)
2/2000 Unit Test Concepts 17
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
![Page 18: Black-Box Boundary Testing (PowerPoint Slides)](https://reader036.vdocuments.net/reader036/viewer/2022062407/55d6eef8bb61eb7f2d8b4604/html5/thumbnails/18.jpg)
2/2000 Unit Test Concepts 18
PUTTING IT ALL TOGETHER
• It's okay to ask "What happens when …?
• Look for test design patterns • Expect certain type units to be tested in a
similar way• A way to identify best practices• Efficiency without cutting corners
• View test design as a "design product", not just a test product!!
![Page 19: Black-Box Boundary Testing (PowerPoint Slides)](https://reader036.vdocuments.net/reader036/viewer/2022062407/55d6eef8bb61eb7f2d8b4604/html5/thumbnails/19.jpg)
2/2000 Unit Test Concepts 19
SOLUTIONS TO EXERCISES
![Page 20: Black-Box Boundary Testing (PowerPoint Slides)](https://reader036.vdocuments.net/reader036/viewer/2022062407/55d6eef8bb61eb7f2d8b4604/html5/thumbnails/20.jpg)
2/2000 Unit Test Concepts 20
Your Turn (Dosage Problem)(2a) Identify Behaviors
CaseExpected
Stimulus Description #Pills
1
2
3
4
5
6
Any Age, Weight>300
Age > 80, any Weight
Age <= 12, Weight <= 300
Age > 65, Weight <= 300
Age 13-65, Weight 120-300
Age 13-65, Weight < 120
0
0
1
2
2+(W-120)/502
![Page 21: Black-Box Boundary Testing (PowerPoint Slides)](https://reader036.vdocuments.net/reader036/viewer/2022062407/55d6eef8bb61eb7f2d8b4604/html5/thumbnails/21.jpg)
2/2000 Unit Test Concepts 21
Your Turn(2b) Decision Table #1
c1: Age <= 12 | Y Y N N N
c2: Age > 65 | Y Y N N N
c3: Age > 80 | Y Y
c4: Weight > 300 | N Y N Y N Y N N Y
c5: Weight > 120 | N Y
a1: Pills = 0 | X X X X X
a2: Pills = 1 | X
a3: Pills = 2 | X X
a4: Pills = 2+(W-120)/50 | X
![Page 22: Black-Box Boundary Testing (PowerPoint Slides)](https://reader036.vdocuments.net/reader036/viewer/2022062407/55d6eef8bb61eb7f2d8b4604/html5/thumbnails/22.jpg)
2/2000 Unit Test Concepts 22
Your Turn (2b) Decision Table #2
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
![Page 23: Black-Box Boundary Testing (PowerPoint Slides)](https://reader036.vdocuments.net/reader036/viewer/2022062407/55d6eef8bb61eb7f2d8b4604/html5/thumbnails/23.jpg)
2/2000 Unit Test Concepts 23
Your Turn(3a) Create Test Cases (testset1)
Case 1 2 3 4 5 6 7 8 9
Age 8 12 67 67 81 85 15 28 28
Weight 40 305 180 360 120 315 100 220 320
Pills 1 0 2 0 0 0 2 4 0
•Is more better?
•Every combination of stimuli is tested.
•Each column specifies at least one condition per variable
![Page 24: Black-Box Boundary Testing (PowerPoint Slides)](https://reader036.vdocuments.net/reader036/viewer/2022062407/55d6eef8bb61eb7f2d8b4604/html5/thumbnails/24.jpg)
2/2000 Unit Test Concepts 24
Your Turn(3b) Create Test Cases (testset2)
Case 1 2 3 4 5 6
Age 20 10 70 83 13 30
Weight 310 70 160 150 115 220
Pills 0 1 2 0 2 4
•Is fewer better?
•Not every combination of stimuli is tested. •Test case generation easier when each column specifies
at least one condition per variable
![Page 25: Black-Box Boundary Testing (PowerPoint Slides)](https://reader036.vdocuments.net/reader036/viewer/2022062407/55d6eef8bb61eb7f2d8b4604/html5/thumbnails/25.jpg)
2/2000 Unit Test Concepts 25
Your Turn(4) Write Test Script (testset1)
StepStimuli Pills=
Age
1
2
3
4
5
6
Weight StepStimuli Pills= Age
7
8
9
10
12
Weight
11
8
12
67
81
85
67
28
28
15
315
120360
180
305
40 100
220
320 0
4
2 1
0
2
0
0
0
![Page 26: Black-Box Boundary Testing (PowerPoint Slides)](https://reader036.vdocuments.net/reader036/viewer/2022062407/55d6eef8bb61eb7f2d8b4604/html5/thumbnails/26.jpg)
2/2000 Unit Test Concepts 26
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
![Page 27: Black-Box Boundary Testing (PowerPoint Slides)](https://reader036.vdocuments.net/reader036/viewer/2022062407/55d6eef8bb61eb7f2d8b4604/html5/thumbnails/27.jpg)
2/2000 Unit Test Concepts 27
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
![Page 28: Black-Box Boundary Testing (PowerPoint Slides)](https://reader036.vdocuments.net/reader036/viewer/2022062407/55d6eef8bb61eb7f2d8b4604/html5/thumbnails/28.jpg)
2/2000 Unit Test Concepts 28
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
![Page 29: Black-Box Boundary Testing (PowerPoint Slides)](https://reader036.vdocuments.net/reader036/viewer/2022062407/55d6eef8bb61eb7f2d8b4604/html5/thumbnails/29.jpg)
2/2000 Unit Test Concepts 29
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
![Page 30: Black-Box Boundary Testing (PowerPoint Slides)](https://reader036.vdocuments.net/reader036/viewer/2022062407/55d6eef8bb61eb7f2d8b4604/html5/thumbnails/30.jpg)
2/2000 Unit Test Concepts 30
Your Turn -- White-Box Testing(1) Construct Decision Table
pills=0;if (Age < 80 && Weight <300){ pills=1; if (Age >= 65) pills=2; else if (Age > 12) pills=2+(Weight-120)/50;}return pills;
| Age < 80 | N - Y Y Y
| Weight<300 | - N Y Y Y
| Age >= 65 | N Y N
| Age > 12 | N - Y| Pills = | 0 0 1 2 C--------------
Note: C: 2+(Weight/120)/50
![Page 31: Black-Box Boundary Testing (PowerPoint Slides)](https://reader036.vdocuments.net/reader036/viewer/2022062407/55d6eef8bb61eb7f2d8b4604/html5/thumbnails/31.jpg)
2/2000 Unit Test Concepts 31
Your Turn(2) Derive White-Box Test Cases
Case 1 2 3 4 5
Age 83 24 11 68 35
Weight 97 310 85 225 108
Pills 0 0 1 2 2
| Age < 80 | N - Y Y Y
| Weight<300 | - N Y Y Y
| Age >= 65 | N Y N
| Age > 12 | N Y YPills = | 0 0 1 2 C