Professional Documents
Culture Documents
- cont’d
1
Equivalence partitioning
2
Subdomains
3
Program behavior and equivalence classes
4
Faults targeted
The entire set of inputs to any application can be divided into
at least two subsets: one containing all the expected, or legal,
inputs (E) and the other containing all unexpected, or illegal,
inputs (U).
5
Faults targeted (contd.)
6
Unidimensional partitioning
One way to partition the input domain is to consider one input
variable at a time. Thus each input variable leads to a partition
of the input domain. We refer to this style of partitioning as
unidimensional equivalence partitioning or simply
unidimensional partitioning.
7
Multidimensional partitioning
8
Partitioning Example
9
Partitioning Example (contd.)
x ignored.
E4: y<5 E5: 5y9 E6: y>9
10
Partitioning Example (contd.)
11
Partitioning Example (contd.)
6 equivalence classes:
13
Systematic procedure for equivalence partitioning
(contd.)
14
Systematic procedure for equivalence partitioning
(contd.)
15
Systematic procedure for equivalence partitioning
(contd.)
17
Errors at the boundaries
Experience indicates that programmers make mistakes in
processing values at and near the boundaries of equivalence
classes.
For example, suppose that method M is required to compute a
function f1 when x 0 is true and function f2 otherwise.
However, M has an error due to which it computes f1 for x<0
and f2 otherwise.
Obviously, this fault is revealed, though not necessarily, when
M is tested against x=0 but not if the input test set is, for
example, {-4, 7} derived using equivalence partitioning. In
this example, the value x=0, lies at the boundary of the
equivalence classes x0 and x>0.
18
Boundary value analysis (BVA)
19
BVA
20
BVA: Procedure
0 2 99 101
* x * * x *
E4 1 100 E6
E5
23
BVA: Example: 3. Construct test set
25
Boundary Value Testing Example
Boundary Value Testing Example
Notice the problem at the boundaries. The age "16" is included in two
different equivalence classes (as are 18 and 55).
27
Boundary Value Testing Example (cont)
Boundary value testing focuses on the boundaries simply because that is where
so many defects hide.
28
Boundary Value Testing Example (cont)
29
Boundary Value Testing Example (cont)
The interesting values on or near the boundaries in this example are {-1, 0, 1},
{15, 16, 17}, {17, 18, 19}, {54, 55, 56}, and {98, 99, 100}.
Other values, such as {-42, 1001, %$#@} might be included depending on the
module's documented preconditions.
30
Robustness Testing
31
Example
Consider a simple program to classify a triangle. Its inputs is a triple of positive integers
(say x, y, z) and the date type for input parameters ensures that these will be integers
greater than 0 and less than or equal to 100. The program output may be one of the
following words:
[Scalene; Isosceles; Equilateral; Not a triangle]
Design the Robustness test cases.
32
The boundary value test cases are shown below:
14 0 50 50 ?
15 101 50 50 ?
16 50 0 50 ?
17 50 101 50 ?
18 50 50 0 ?
19 50 50 101 ?
6n+1
34
Worst Cases Testing
35
Example
Consider a simple program to classify a triangle. Its inputs is a triple of positive integers
(say x, y, z) and the date type for input parameters ensures that these will be integers
greater than 0 and less than or equal to 100. The program output may be one of the
following words:
[Scalene; Isosceles; Equilateral; Not a triangle]
Design the Worst Case test cases.
36
Worst Case Testing
Worst test cases are 53 = 125
44
Exercise
Consider a program for determining the Previous date. Its input is a triple of day,
month and year with the values in the range
1 ≤ month ≤ 12
1 ≤ day ≤ 31
1900 ≤ year ≤ 2025
The possible outputs would be Previous date or invalid input date.
Design the Robustness and worst case test cases.
45