NormalBoundaryValue
NormalBoundaryValue
Design
EECS4313 Integration Testing
Unit Testing
Automation
Software Engineering Testing Software Engineering Testing
Report & Documentation
Dr. Marzieh Ahmadzadeh Verification
Validation Theory
Practice
Integration
▪ Last Lecture
▪ Introduction to the significance of testing
▪ Introducing key terms
▪ Fault, Error, Failure
▪ Validation vs. Verification
▪ This week
▪ Category of unit testing (Verification)
▪ Black-box testing
▪ Boundary Value
2
TESTING TECHNIQUES; UNIT TESTING
3
A Unit of Work
▪ Depending on the paradigm of the programming, a unit of work can be interpreted differently:
▪ A function
▪ A body of code that is presented as a unit in Work Breakdown Structure
▪ An independent body of code that can be compiled and executed by itself.
▪ A class in OOP and all its methods.
▪ The authors of the reference book believe that a unit is a body of software that can be completed by one or two
persons.
4
Two Categories of Unit Testing
5
Specification vs. Code-based testing
▪ Disadv.: ▪ Disadv.:
▪ Redundant test cases are possible ▪ Does not recognize if some parts of specification were
▪ Some part of software may remain untested. not implemented.
7
Two Categories of Unit Testing
8
Functional/Specification Testing
Da = { A, E, I, O, U}
Db = {1, 2}
▪ The domain of the function is a cartesian product of sets
𝐷1 , 𝐷2, 𝐷3 , … , 𝐷𝑛 , where there are n inputs.
▪ i.e. D= 𝐷1 × 𝐷2 × 𝐷3 × … . × 𝐷𝑛 DF = {(A, 1),(A, 2),(E,
1),(E, 2),(I, 1), (I, 2),
(O, 1), (O, 2), (U, 1),
(U, 2)}
9
Boundary Value Testing
▪ Assumption:
▪ F is a function (i.e. program/unit) that gets two inputs x1, x2.
▪ x1 and x2 have some boundaries: 𝑎 ≤ 𝑥1 ≤ 𝑏
▪ A representative from each category is selected. 𝑐 ≤ 𝑥2 ≤ 𝑑
x2
Input Domain of F(x1, x2)
X2 max
d
X2 max-
X2 nom
X2 min+
X2 min
c x1 x1 x1 x1
x1 min min+ nom max- max
x1 10
a b
F(X1, X2)
DF = {(x1 min , X2 min), (x1 min , X2 min+), (x1 min , X2 nom), (x1 min , X2 max-), (x1 min , X2 max),
(x1 min+ , X2 min), (x1 min+ , X2 min+), (x1 min+ , X2 nom), (x1 min+ , X2 max-), (x1 min+ , X2 max),
(x1 nom , X2 min), (x1 nom , X2 min+), (x1 nom , X2 nom), (x1 nom , X2 max-), (x1 nom , X2 max),
(x1 max- , X2 min), (x1 max- , X2 min+), (x1 max- , X2 nom), (x1 max- , X2 max-), (x1 max- , X2 max),
(x1 max , X2 min), (x1 max , X2 min+), (x1 max , X2 nom), (x1 max , X2 max-), (x1 max , X2 max)}
11
x2
<X1 min X2 nom> <X1 min+ X2 nom> <X1 max- X2 nom> <X1 max X2 nom>
12
Test Case reduction
▪ Boundary testing is important because errors are seen frequently on the boundary values.
▪ It is assumed that two variables rarely hold their extreme values at the same time, when a fault
happens.
▪ Single fault assumptions
▪ a balance between testing comprehensiveness and efficiency
13
STRENGTH AND LIMITATIONS OF NBVT
14
Generalizing Boundary Value Analysis
▪ As long as an order can be defined on the domain of the variable, this method can be used,
because a boundary can be defined.
▪ Nominal variables: can be interpreted as integers.
▪ {Jan, Feb, March, …Dec} -> {1, 2, 3, …12}
▪ Discrete Variables:
▪ Perfect squares less than 100 = {0, 4, 9, 16, 25, 36, 49, 64, 81, 100}
15
Limitation of Boundary Value Analysis
16
Expectations & Reading
▪ Expectations:
▪ You should be able to write a complete set of test cases using NBVT technique
▪ To explain what’s the advantage and disadvantages of this method.
▪ You should be mindful of what levels of test maturity you are working, when you write a set of test cases.
▪ Reading:
▪ [Optional]: Chapter 5 of the first reference book up to and including NBVT technique.
17