ST Mod2
ST Mod2
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
from one set to another set)
– Program outputs form its range
f (y1,y2), wher
a y1 b ,c y2 d
• Boundary inequalities of n input variables define an n-
dimensional input space: interval[a,b] and [c,d] is referred to
as ranges of y1 and y2
y2
d
a b y1
Value Selection in Boundary Value Analysis
• The basic idea in boundary value analysis is to select input
variable values at their:
– Minimum
– A nominal value
– Maximum
Single Fault Assumption
• Boundary value analysis is also augmented by the single fault
assumption principle.
“Failures occur rarely as the result of the simultaneous
occurrence of two (or more) faults”
y2
d ..
.. .. ..
c .
a b y1
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:
• Bounded discrete(distinct)
• 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.
y2
d
..
... .. …
c ..
a b y1
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.
y2
d .... .. ....
.... .. ....
c .. . ..
a b y1
Robust Worst Case Testing for
Program P
y2
d
...
...
... ... …
…
…
... . …
...
... ... …
…
c
... …
a b y1
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.
• Test cases can be stated for the inputs <a,b,c> in terms of the
representative points.
• The basic idea behind the techniques is that one point within an
equivalence class is just as good as any other point within the
same class.
Types of Equivalence testing
• There are four types of equivalence testing:
– Weak Normal equivalence class testing
– Strong Normal equivalence class testing
– Weak Robust equivalence class testing
– Strong Robust equivalence class testing
Weak Normal Equivalence Class Testing
• Weak equivalence class testing is accomplished by using one variable from
each equivalence class (interval) in a test case (single fault assumption).
• Always number of equivalence class test cases are same as classes in the
partition with the largest number of subsets.
Strong Normal Equivalence Class Testing
• Strong equivalence class testing is based on the Cartesian Product of the
equivalence classes (multiple fault assumption).
• Valid Inputs
– Use one value from each valid class (as in what we have
called weak normal equivalence class testing). In this context,
each input in these test cases will be valid.
• Invalid Inputs
– A test case will have one invalid value and the remaining
values will be valid. In this context, a “single failure” should
cause the test case to fail.
Weak Robust!!! Equivalence Class Testing
• Two problems occur with robust
equivalence testing.
• The first is that, very often, the specification does not
define what the expected output for an invalid test case
should be. Thus, testers spend a lot of time defining
expected outputs for these cases.
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:
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