Professional Documents
Culture Documents
ST 2 - 2
ST 2 - 2
Functional Testing
Boundary Value Testing (BVT)
Boundary Value Analysis
Robustness Testing
Worst Case Testing
Special Value Testing
Equivalence Class Testing
Decision Table Based testing
Overview
• Any program can be considered to be a function
– Program inputs form its domain(function maps the value to one set
to another set)
– Program outputs form its range
..
.. .. ..
.
T = { <y1nom, y2min>, <y1nom, y2min+>, <y1nom, y2nom>, <y1nom,
y2max->,
<y1nom, y2max+>, <y1min, y2nom>, < 1nin+, y2nom>, <y1max-, y2nom>,
<y1max, y2nom> }
Example Test Cases Using Boundary
Value Analysis
Case # a b c Expected Output
1 100 100 1 Isosceles
2 100 100 2 Isosceles
3 100 100 100 Equilateral
4 100 100 199 Isosceles
5 100 100 200 Not a Triangle
6 100 1 100 Isosceles
7 100 2 100 Isosceles
8 100 100 100 Equilateral
9 100 199 100 Isosceles
10 100 200 100 Not a Triangle
11 1 100 100 Isosceles
12 2 100 100 Isosceles
13 100 100 100 Equilateral
14 199 100 100 Isosceles
15 200 100 100 Not a Triangle
Generalizing Boundary Value
Analysis
• The basic boundary value analysis can be
generalized in two ways:
1.By the number of variables - yields(4n +1)
unique test cases for n variables
2.By the kinds of ranges of variables
• Programming language dependent
• Bounded discrete(distinct)
• Unbounded discrete (no upper or lower bounds
clearly defined)
• Logical variables
Limitations of Boundary Value
Analysis
• Boundary value analysis works well when the program to
be tested is a function of several independent variables that
represent bounded physical quantities.
..
... .. …
..
Worst Case Testing
• In worst case testing we reject the single fault
assumption as we are interested what happens
when more than one variable has an extreme
value.
.... .. ..
..
.... .. ....
.. . ..
Robust Worst Case Testing for
Program P
...
...
... ... …
…
…
... . …
...
... ... …
…
... …
1 1 1 1 100 10 min
3 10 9 10 970 97 border-
Chapter 4
Equivalence Class Testing
Equivalence Class Testing
• The use of equivalence class testing has two
motivations:
– Sense of complete testing
– Avoid redundancy
• Equivalence classes form a partition of a set
that is a collection of mutually disjoint subsets
whose union is the entire set.
• Two important implications for testing:
1. The fact that the entire set is represented provides a
form of completeness
2. The disjointedness assures a form of non-redundancy
Equivalence Classes
• The idea of equivalence class testing is to
identify test cases by using one element from
each equivalence class.
A = A1 U A2 U A3
B = B1 U B2 U B3 U B4
C = C1 U C2
• Define a1, a2 and a3 as:
– let ai be a “representative” or “typical” value within its respective
equivalence class (e.g. the midpoint in a linear equivalence class).
– similarly define bi and ci.
WN1 5 5 5 Equilateral
WN2 2 2 3 Isosceles
WN3 3 4 5 Scalene
WN4 4 1 2 Not a
Triangle
Table 1: Weak and Strong Normal class test cases
Table 2: Weak Robust class test cases
Table 3: Strong Robust class test cases
Equivalence Test Cases for the Triangle
Problem (Input Domain)
• If we base the equivalence classes on the input domain, we will obtain a larger
set of test cases. We can define the sets:
• As a separate property we can apply the triangle property to see even if the
input constitutes a triangle
D6= {<a, b, c> | a ≥ b+c}
D7= {<a, b, c> | b ≥ a+c}
D8= {<a, b, c> | c ≥ a+b}
1 ≤ month ≤ 12
1 ≤ day ≤ 31
1812 ≤ year ≤ 2012
• These classes yield the following test cases, where the valid inputs are mechanically
selected from the approximate middle of the valid range:
Barrels 90
72
40
Locks
22.2 70
60
33.3
60
Stocks
80
Guidelines and Considerations
• The weak forms of equivalence class testing (normal or
robust) are not as comprehensive(complete) as the
corresponding strong forms.
Chapter 5
Decision Table-Based Testing
Decision Tables - General
• Decision tables have been used to represent and analyze
complex logical relationships (since 1960s).
• Decision tables, like if-then-else and switch-case
statements, associate conditions with actions to perform.
• A decision table has four portions: the left-most column
is the stub portion; and to the right is the entry portion.
• The condition portion is noted by c’s, and the action
portion is noted by a’s.
• Thus, decision table consisting of 4 areas called the
condition stub, condition entry, action stub and the
action entry
Decision Tables - Structure
Conditions - (Condition stub) Condition Alternatives –
(Condition Entry)
Actions – (Action Stub) Action Entries
Condition
stub
Action stub
Action Entry
• The condition portion of a DT is a truth table that has been rotated 90o(ATM)
Decision Table - Example
Printer does not print Y Y Y Y N N N N
Check/replace ink X X X X
Printer Troubleshooting
Decision Tables - Usage
• The use of the decision-table model is applicable when :
– the specification is given or can be converted to a
decision table .
• For a limited entry DT, if ‘n’ conditions exist, then there must be
2n rules.
• When a don’t care entries really indicate that the condition is
irrelevant, we can develop the rule count as follows:
“rules in which no don’t care entries occur as one rule,
and each don’t care entry in a rule doubles the count
of that rule”.
•Notice that the sum of the rule count is 64 in Table 7.5.
• These classes have a Cartesian product that contains 36 entries (test cases),
with several that are impossible.
Decision Table for NextDate (1)
Conditions 1 2 3 4 5 6 7 8
C1: month in M1 M1 M1 M1 M2 M2 M2 M2
C2: day in D1 D2 D3 D4 D1 D2 D3 D4
C3: year in - - - - - - - -
Rule count 3 3 3 3 3 3 3 3
Actions
A1: Impossible X
C2: day in D1 D1 D1 D2 D2 D2 D3 D3
C3: year in Y1 Y2 Y3 Y1 Y2 Y3 - -
Rule count 1 1 1 1 1 1 3 3
Actions
A1: Impossible X X X X
• These classes have a Cartesian product that contains 40 entries (test cases),
with several that are impossible.
Decision Table for NextDate (1)
Conditions 1 2 3 4 5 6 7 8 9 10
C1: month in M1 M1 M1 M1 M1 M2 M2 M2 M2 M2
C2: day in D1 D2 D3 D4 D5 D1 D2 D3 D4 D5
C3: year in - - - - - - - - - -
Actions
A1: Impossible X
C2: day in D1 D2 D3 D4 D5 D1 D2 D2 D3 D3 D4 D5
C3: year in - - - - - - Y1 Y2 Y1 Y2 - -
Actions
A1: Impossible X X X