Professional Documents
Culture Documents
M21des323 02
M21des323 02
Unit:02
Boundary Value Testing, Equivalence Class
Testing & Decision table based testing :
School of CSA
Pinaka Pani. R
Contents
4
BOUNDARY VALUE ANALYSIS (BVA)
• BVA is one of the black box testing methods to derive testcases and to make sure it
works for all the values with in the boundary.
• Boundary value Test Cases are subset of Robustness Test Cases.
1.Boundary value Test cases of single input.
2.Boundary value Test cases of two input.
3.Boundary value Test cases of three input(additional info)
4.Worst case Boundary Value Test Cases of two inputs
5.Worst case Boundary Value Test Cases of three inputs
• 1.Boundary value Test cases of single input :-
Example:-
Requirement: Age: 1-100
Boundary Value Test Cases are (min, min+1, avg, max-1, max)
1 2 51 99 100
Requirement: ATM PIN: 0000-9999 Boundary Value Test Cases are (min
min+1 avg max-1 max) 0000 0001 5000 9998 9999
No. of test cases are 4n+1 (n is no of inputs)
Give each set of inputs and check whether the output is according to the requirement or not,
instead of testing all sets, you have to test the above set of inputs to make sure that it will work
for all the values within the range.
Example of two inputs: -
To test whether multiplication is working correctly or not (we need 2 inputs)
It displays some result that is called actual result, if you know the
multiplication(requirement) you can expect the result that is called expected result(if both
accepted result and actual result are same you can say first test case is pass else fail)
Like above you have to test all sets of inputs one by one, Second set is (50, 2) give inputs
and compare actual and expected and decide whether the test case is pass or fail. Same way
third set (50, 50), fourth (50, 99)...
2.Boundary Value Test Cases of two inputs (x1, x2) are:-
4
Requirement:-
50 1 50 50 Pass
50 2 100 100 Pass
50 50 2500 2500 Pass
…………. ……………. ………….. ………. ………….
{< x1 nom,x2min>,< x1 nom,x2min+>,< x1 nom,x2nom>,< x1 nom,x2max->,< x1
nom,x2max>, <x1min+,x2nom>,<x1min,x2nom>, <x1max,x2nom>,<x1max-
,x2nom> }
*
{x3min, x3 min+1, x3 nom, x3max-1, x3max}
(Cartesian product)
Boundary value Test cases of three inputs are :-
Example triangle problem: -
1 ≤ x1 ≤ 100,
1 ≤ x2≤ 100,
1 ≤ x3≤ 100 are three sides of triangle.
{(50,1,1)(50,2,1)(50,50,1),(50,99,1)(50,100,1)……………………………………..}
Give each set of inputs and compare actual and expected results
In case of two inputs, consider all sets produced by the below Cartesian product
These test cases although more comprehensive in their coverage, constitute much
more endeavour.
To compare we can see that Boundary Value Analysis results in 4n + 1 test case
where Worst-Case testing results in 5 test cases.
As each variable has to assume each of its variables for each permutation (the
Cartesian product) we have 5 to the n test cases.
6
Robustness testing is an extension of boundary value analysis, to derive test cases and to
make sure it will work for all the values (valid and invalid)with in andout of the boundaries.
1.Robustness Test cases of single input
2.Robustness Test cases of two input
3. Robustness Test cases of three input(additional info)
4.Worst case Robustness Test Cases of two inputs
5.Worst case Robustness Test Cases of three inputs
{(50,0)(50,1),(50,2),(50 ,50),(50,99),(50,101),(50,100),(1,50),(2,50)(99,50)(100,50)(101,50)(0,50)}
Take first set of inputs and check whether it is according to the requirement or not
It displays some result that is called actual result, if you know the addition you can expect the
result that is called expected result (if both accepted result and actual result are same you can
say first test case is pass else fail)
Like this you have to test all sets of inputs one by one, second set is (50, 1) give inputs and
compare actual and expected and decide whether that is pass or fail. Same way third set (50, 2),
fourth (50, 50)...
Table format of addition test cases (Robustness Testing)
Inputs Expected Actual Status
A B Result result Pass/fail
50 0 50 50 Pass
50 1 51 51 Pass
50 2 52 52 Pass
50 50 100 100 Pass
…………. ……………. ………….. ………. ………….
{<x1nom,x2min>,<x1nom,x2min>,<x1nom,x2min+>,<x1nom,x2nom>,<x1nom,x2
max,<x1nom,x2max+>,<x1min,x2nom>,<x1min,x2nom>,<x1min+,x2nom><x1ma
x+,x2nom>,<x1max,x2nom>,<x1max-,x2nom> } * {x3 min-,x3 min, x3 min+1, x3
nom, x3 max-1, x3 max,x3 max+}
Test cases are:-
{(50,0),(50,1),(50,2),(50,50),(50,99),(50,100),(50,101)(0,50),(1,50),(2,50)(99,50)(
100,50),(101,50)} * {0, 1, 2, 50, 99,100,101}
10
Conclusion:-
The above Test cases are used in the case of single or multiple inputsand inputs
should have upper and
lower boundaries)
Not possible to test all the values so we can use this Black BoxTesting methods
BVA Test Cases are sub set of Robustness Test Cases, using BVA we are testing
within the boundaries (valid inputs), inRobustness Testing we are testing with and
without of the boundaries(valid and invalid).
Use the mathematical concept of partitioning into equivalence classes to generate test
cases for Functional (Black-box) testing
The key goals for equivalence class testing are similar to partitioning:
ocompleteness of test coverage
olessen duplication of test coverage
Partitioning : -
Recall a partitioning of a set, A, is to divide the set A into ( a1, a2, - - - -, an ) subsets such
that:
oa1 U a2 U - - - - U an = A (completeness)
ofor any i and j, ai ∩ aj = Ø (no duplication)
Equivalence Classes:-
Equivalence class testing is the partitioning of the (often times, but not
always) input variable’s value set into classes (subsets) using some
equivalence relation.
This is the same as the weak normal equivalence testing except for
“Multiple fault assumption”
or
“Dependence among the inputs”
• All the combinations of equivalence classes of the variables must be included.
12
• We may define the input test data by defining the equivalence class through
“viewing” the 4 output groups:
R1-input sides <a, b, c> do not form a triangle R2-input sides <a, b
,c> form an isosceles triangle R3-input sides <a, b, c> form a scalene
triangle
R4-input sides <a, b, c> form an equilateral triangle
35
Equivalence Classes
36
Equivalence Class Selection
37
Example
A A1 A2 A3
B B1 B 2
C C1 C 2 C 3 C 4
38
• define a1, a2 and a3 as: a1 A1, a2 A2, a3 A3
– 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.
39
Weak Equivalence Class Testing
• Strong equivalence class testing is based on the Cartesian Product of the partition
subsets.
• Generates more test cases which test for any interaction between the representative
values from each of the subsets.
• For either method, it may be possible to define equivalence relations for the
program output, then test cases can also be based on these.
41
Test Case # a b c
SE1 a1 b1 c1
SE2 a1 b1 c2
SE3 a1 b2 c1
SE4 a1 b2 C2
SE5 a1 b3 C1
SE6 a1 b3 C2
SE7 a1 b4 C1
SE8 a1 b4 C2
SE9 a2 b1 C1
SE10 a2 b1 C2
SE11 a2 b2 C1
SE12 a2 b2 C2
SE13 a2 b3 C1
SE14 a2 b3 C2
SE15 a2 b4 C1
SE16 a2 b4 C2
SE17 a3 b1 C1
SE18 a3 b1 C2
SE19 a3 b2 C1
SE20 a3 b2 C2
SE21 a3 b3 C1
SE22 a3 b3 C2
SE23 a3 b4 C1 42
SE24 a3 b4 c2
Traditional View
43
Traditional View
• Given valid and invalid sets of inputs, the traditional equivalence testing strategy
identifies test cases as follows:
– For valid inputs, use one value from each valid class (as in what we have called weak equivalence
class testing). In this context, each input in these test cases will be valid.
– For 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.
• If the input variables have defined ranges, then the test cases from traditional
equivalence class testing will always be a subset of those that would be generated
by robustness testing.
44
Issues with Traditional View
• There are two problems with the traditional
equivalence testing:
45
Example
• For example consider a program with two input
variables size and weight:
– valid ranges:
S1: 0 < size < 200
W1: 0 < weight < 1500
– corresponding invalid ranges might be:
S2 : size 200
S3 : size 0
W2 : weight 1500
W3 : weight 0
46
Test Cases Example (Traditional View)
47
Equivalence Test Cases for the Triangle Problem (Output
Domain)
• In the problem statement we note that there are four possible outputs:
– Not a Triangle
– Isosceles
– Equilateral
– Scalene
• We can use these to identify output (range) equivalence classes:
OE2 2 2 3 Isosceles
OE3 3 4 5 Scalene
OE4 4 1 2 Not a
Triangle
49
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
• We will examine below the valid, invalid equivalence classes, strong, and
weak equivalence class testing.
51
Traditional Test Cases
These classes yield the following test cases, where the valid inputs are mechanically selected from the approximate
middle of the valid range:
52
Traditional Test Cases
54
Weak Equivalence Class Test Cases
55
Strong Equivalence Test Cases
CASE ID Month Day Year Output
SE1 6 14 1900 6/15/1900
SE2 6 14 1912 6/15/1912
SE3 6 14 1913 6/15/1913
SE4 6 29 1900 6/30/1900
SE5 6 29 1912 6/30/1912
SE6 6 29 1913 6/30/1913
SE7 6 30 1900 7/1/1900
SE8 6 30 1912 7/1/1912
SE9 6 30 1913 7/1/1913
SE10 6 31 1900 ERROR
SE11 6 31 1912 ERROR
SE12 6 31 1913 ERROR
SE13 7 14 1900 7/15/1900
SE14 7 14 1912 7/15/1912
SE15 7 14 1913 7/15/1913
SE16 7 29 1900 7/30/1900
SE17 7 29 1912 7/30/1912
SE18 7 29 1913 7/30/1913
56
Strong Equivalence Test Classes
58
THANK YOU