ソフトウェアテスト
[4] ブラックボックステス
ト
Software Testing
[4] Black Box Testing Techniques
あまん ひろひさ ひろひさ
阿萬 裕久 裕久( AMAN
Hirohisa )
(C) 2007-2022 Hirohisa AMAN
1
Test purpose and content
Purpose
Find errors, bugs that may exist in the soft
ware
Content
Run the software and make sure it works co
rrectly as specified
Make sure the failures do not occur even for
situations that do not in specifications
(C) 2007-2022 Hirohisa AMAN
2
Difficulty of the test
Originally, designers and developers t
ried to make something according to
specifications
If it is outside the specifications diffic
ult to check it’s unexpected or unnotic
ed in the first place
(C) 2007-2022 Hirohisa AMAN
3
Terms:
Test case, Test suite, Test domain
Test case case
Specific input data conditions & expected o
utput
Test case suit casee
A set of test cases that runs a set of tests
Test caseing Domain Domain
Ensuring that the program is no error
Complete collection of test cases
(C) 2007-2022 Hirohisa AMAN
4
Test example (1):
Length conversion
*1 kilomet caseer
= 0.621371 miles
Kilometers Miles Converter
【 Input 】 A real number from 0 to 10000
Up to two decimal places are allowed
【 Output 】 Value converted to miles, round
ed down to three decimal places
input
expected
output
input
expected
output
0
0.000
9.99
6.207
9999.99
6213.703
10
6.213
1
0.621
-1
error
1.001
0.621
10000
error
(C) 2007-2022 Hirohisa AMAN
Other
exceptions
5
Test example (2): Triangle prob
lem
Consider a triangle with three integers a
s input, each of which is the length of a
side.
Isosceles triangle
Equilateral triangle
Scalene triangle
Consider a test case for a program that
determines which of.
(C) 2007-2022 Hirohisa AMAN
6
Example test case for triangle p
roblem
input
expected output
(2, 5, 5)
isosceles triangle
(5, 5, 5)
equilateral triangle
(3, 4, 5)
scalene triangle
(0, 0, 0)
error
*become a point
(3, 4, 7)
error
*become a line segment
(2, 5, 8)
error
sides
*longest side length > sum of the lengths of other
(1.3, 4, 5) error
*there are real numbers
(-2, 4, 5) error *have a negative number
*Triangle Inequality: Length of longest side < sum of the lengths
of other sides
(C) 2007-2022 Hirohisa AMAN
7
[Exercise 1]
Test case an int caseeg Domainer sort caseing Domain prog Domainram
Now, We are given a program to sort
s N integers
0 ≤ N ≤ 10000 N ≤ N ≤ 10000 10000
The input case is from a file
Consider a test case for this program
(C) 2007-2022 Hirohisa AMAN
8
Important in testing
Record the result
What case kind of problem of problem was found of problem in which t caseest case ca
se,
who found of problem it case and of problem when
Import caseant case informat caseion aft caseer mod of problemificat case
Just
reporting
ion
Communicat casee properly
Ambig Domainuous informat caseion is useless
that it doesn‘t
work is
Meaning Domainless
How you communicat casee is import caseant case t casehan report case bug Domains
Should of problemn't case be proud of problemly show d of problemevelopers t casehat case you’ve found of problem a bu
g Domain
There are d of problemifficult caseies t casehat case only t casehe person who mad of probleme it case can un
d of problemerst caseand of problem, so human
relat caseionships
are also import case
ant case
(C) 2007-2022
Hirohisa AMAN
9
Testability
Ease of testing
Reduction in costs (man-hours) spent on te
sting
Shorter period of testing
Leads to improved quality
(C) 2007-2022 Hirohisa AMAN
10
Improved testability
Design and implementation considerations
are essential
Which function corresponds to which part o
f the program
Design the test Example: can be independe
ntly tested by split into functions
Keep testing in mind when making
Make what you're doing easy to understan
d quickly address errors
(C) 2007-2022 Hirohisa AMAN
11
Mod of problemule
A unit of program that can be separated
Group of prog Domainrams (Sofware Part cases) Can be r
eplaced
Ex: In C, “function” or "a collection of functi
ons” corresponds to this
Java, “class” corresponds to this (*A "meth
od" corresponds to a "function", but a meth
od cannot exist by itself.)
(C) 2007-2022 Hirohisa AMAN
12
Unit test, Integration test
Unit test
Give various inputs and check in single mo
dules if appropriate output is obtained
Integration test
Combine multiple modules, check if the mo
dule can perform appropriate input/output
with the connection relationship
(C) 2007-2022 Hirohisa AMAN
13
System test, Acceptance/Opera
tion test
System test
Verify the system works as specified
Acceptance test/Operation test
Similar to system test, but testing in act
ual operating environment, customer
testing
(C) 2007-2022 Hirohisa AMAN
14
Classification of tests
Black box testing
Does not see the contents of the program
Does system work based on specifications?
White box testing
Do a working test based on internal structure
(mainly flowchart) of the program
Random testing
Randomly create test cases and perform an o
peration test
(C) 2007-2022 Hirohisa AMAN
15
Black Box Testing Techniques (1)
Equivalence partitioning
To design test cases efficiently
Split input space based on kind of equivalen
ce relation
One partition is called as "equivalence class“
A collection of things that should be treated
the same for each input condition
Two types of equivalence classes
Valid equivalence class: valid input
Invalid equivalence class: invalid input
(C) 2007-2022 Hirohisa AMAN
16
Equivalence Partitioning Procedure
(1) Set valid equivalence classes and in
valid equivalence classes for each inp
ut condition
(2) Make all Combinations of valid equiv
alence classes
(3) Make all combinations that contains
only one invalid equivalence class
*You can add a test that includes two or more
First, only one No problems by mixing invalid items
(C) 2007-2022 Hirohisa AMAN
17
Example of equivalence partitio
ning ① (1/2) (1/2)
Input: Course grade (integer value)
Output: “Excellent, Good, Satisfactory,
Passing, Failure, Not evaluated"
Specifications: 90-100 → Excellent, Excellent,
80-89 → Excellent, Good, 70-79 → Excellent, Satisfactory, 6
0-69 → Excellent, Passing, 0 to 59 → Excellent, Failure,
-1 → Excellent, Not evaluated
(C) 2007-2022 Hirohisa AMAN
18
Example of equivalence partitio
ning ① (1/2) (2/2)
Valid and invalid equivalence classes
valid equivalence invalid
class
equivalence class
90-100
101 or more
80-89
-2 or less
Choose a
value from
each
equivalence
class to do
the test
70-79
60-69
0-59
-1
(C) 2007-2022 Hirohisa AMAN
19
Example of equivalence partitio
ning ② (1/4) (1/4)
Parking fee calculator
[Input case (1) : Parking time (unit: minutes)] Parking Domain t caseime (unit case: Parking time (unit: minutes)] minut casees) ]
1 minute – 30 minutes = 100 Yen
31 minutes - 60 minutes = 200 Yen
After that = 100 Yen up per hour
[Input case (2) : Parking time (unit: minutes)] Purchase amount case at case part casener st caseore
s]
1 hour free
over
2,000
* If t casehefor
parking Domain
t caseime
exceed of problemsYen
1 hour, 200
Yen d of problemiscount case (for t casehe first case hour)
(C) 2007-2022 Hirohisa AMAN
20