Download as pdf or txt
Download as pdf or txt
You are on page 1of 59

Established as per the Section 2(f) of the UGC Act, 1956

Approved by AICTE, COA and BCI, New Delhi

Unit:02
Boundary Value Testing, Equivalence Class
Testing & Decision table based testing :
School of CSA
Pinaka Pani. R
Contents

• Boundary value analysis, Robustness testing, Worst-case testing, Special


value testing, Examples, Random testing.
• Equivalence classes- Equivalence test cases for triangle problem, Next Date
function and commission problem, Guidelines and observations.
• Decision tables, Test cases for triangle problem.
There are two types of testing
1. Black box testing ( by giving inputs test the output according to the requirements)
2. White box testing (testing source code)
Example:- Requirement for age drop down (1-100)
•If you select the values between 1 - 100 it should accept, else it should display error
message.
•It is not possible to test all the values from 1 to 100(time consuming)
• To overcome that, two types of black box testing methods are there to derive test cases.
1.Boundary value analysis
2.Equivalence class testing
Overview
Functional Testing
Boundary Value Testing (BVT)
Boundary Value Analysis
Robustness Testing
Worst Case Testing
Special Value Testing
Equivalence Class Testing
Weak Equivalence Class Testing
Strong Equivalence Class Testing
Traditional Equivalence Class testing
Decision Table Based testing

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 :-

• Min+ Avg Max-


• |------|----------------------|------------------------|------|
• Min Max
• Boundary value test cases of single input
• Here we are testing within the boundaries(only valid data according to the
requirement) We are not testing for invalid data (out of boundary).
• Boundary value analysis (BVA) tests the behavior of a program at the boundaries.
• When checking a range of values, after selecting the set of data that lie in the valid
partitions, next is to check how the program behaves at the boundary values of the valid
partitions.
• Boundary value analysis is most common when checking a range of numbers.
• For each range, there are two boundaries, the lower boundary (start of the range) and
the upper boundary (end of the range) and the boundaries are the beginning and end
of each valid partition.
• We should design test cases which exercises the program functionality at the
boundaries, and with values just inside and just outside the boundaries.
• Every partition has its maximum and minimum values and these maximum and
minimum values are the boundary values of a partition.
• A boundary value for a valid partition is a valid boundary value. Similarly a boundary
value for an invalid partition is an invalid boundary value.
• Tests can be designed to cover both valid and invalid boundary values.
• When designing test cases, a test for each boundary value is chosen.
• For each boundary, we test +/-1 in the least significant digit of either side of the
boundary.
• Boundary value analysis can be applied at all test levels.
• Example on Boundary Value Analysis Test Case Design Technique: Assume, we
have to test a field which accepts Age 18 – 56
• Minimum boundary value is 18 Maximum boundary value is 56
Valid Inputs: 18,19,55,56

Invalid Inputs: 17 and 57


• Test case 1: Enter the value 17 (18-1) = Invalid Test case 2: Enter the
value 18 = Valid
• Test case 3: Enter the value 19 (18+1) = Valid Test case 4: Enter the value
55 (56-1) = Valid Test case 5: Enter the value 56 = Valid

• Test case 6: Enter the value 57 (56+1) =Invalid


Generate BVA Test Cases-For the Triangle Problem:
Problem Domain: “The triangle program accepts three integers, a, b and c as input.
These are taken to be the sides of a triangle. The integers a, b and c must satisfy
the following conditions C1: 1 ≤ a ≤ 200
C2: 1 ≤ b ≤ 200
C3: 1 ≤ c ≤ 200
C4: a < b+c C5: b < a+c C6: c < a+b
The output of the program may be either of: Equilateral Triangle, Isosceles Triangle,
Scalene or
“Not a Traingle”.
Generate BVA Test Cases for this problem?
We know that our range is [1, 200] where 1 is the lower bound and 200 being the
upper bound.
This program has three inputs like a, b and c.
Number of inputs or n = 3.
BVA yields (4n + 1) test cases according to single fault assumption theory.
Total number of test cases will be (4*3+1)=12+1=13.
Test Side Side Side
Case ID “a” “b” “c” Expected Output
1 100 100 1 Isosceles Triangle
2 100 100 2 Isosceles Triangle
3 100 100 100 Equilateral Triangle
4 100 100 199 Isosceles Triangle
5 100 100 200 Not a Triangle
6 100 1 100 Isosceles Triangle
7 100 2 100 Isosceles Triangle
8 100 100 100 Equilateral Triangle
9 100 199 100 Isosceles Triangle
10 100 200 100 Not a Triangle
11 1 100 100 Isosceles Triangle
12 2 100 100 Isosceles Triangle
13 100 100 100 Equilateral Triangle
14 199 100 100 Isosceles Triangle
15 200 100 100 Not a Triangle
• It may be noted that as explained above that we can have 13 test cases (4n + 1)
for this problem.
• But instead of 13, now we have 15 test cases.
• Test cases vide ID number 8 and 13 are redundant.
• We can ignore them. However, we do not ignore test case ID number 3, as we
must consider at least one test case out of these three.
• These 13 test cases are sufficient to test this program using BVA technique.
Min ---------------------------------- Minimal
Min+ ---------------------------------- Just above Minimal
Nominal ---------------------------------- Average
Max ---------------------------------- Just below Maximum
Max ---------------------------------- Maximum

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)

Requirement:- c= a* b (1<=a<=100, 1<=b<=100)


Boundary value sets of a and b are a= {1,2,50,99 ,100} b={1,2,50,99,100} Based
on the above sets, combinations of test cases (input sets by BVA)are
{< x1 nom,x2min>,< x1 nom,x2min+>,< x1 nom,x2nom>,< x1 nom,x2max->,< x1
nom,x2max>,
<x1min+,x2nom>,<x1min,x2nom>, <x1max,x2nom>,<x1max-,x2nom> }
{(50,1),(50,2),(50 ,50),(50,99),(50,100),(1,50),(2,50)(99,50)(100,50)}
Take first set of inputs and check whether it is according to the requirement or
not Give first set input values are 50 and 1 c=50*1

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

{< x1 nom,x2min>,< x1 nom,x2min+>,< x1 nom,x2nom>,< x1 nom,x2max->,< x1


nom,x2max>, <x1min+,x2nom>,<x1min,x2nom>, <x1max,x2nom>,<x1max-,x2nom> }
5

A B Expected Actual Status


Result Result Pass/fail
Example:-

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),(50,2),(50 ,50),(50,99),(50,100),(1,50),(2,50)(99,50)(100,50)} *{1, 2, 50,


99,100}

{(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

Inputs Table format


Expectedof triangle Actual
test cases using Status
Result BVA
x1 x2 x3 Result Pass/fail
50 1 1 Isosceles Not a triangle Fail
50 2 1 Scalene Scalene Pass
50 50 1 Isosceles Not a triangle Fail
…… …… …….. ………. ……….. ………
Worst-case Boundary value analysis Test cases for two inputs:-
If you are not satisfied with Boundary value Test cases, that means you can’t make
sure that,
The related functionality is working according to the requirements after testing with
the above Boundary value limited sets, and then we can go for Worst Case Testing.

In case of two inputs, consider all sets produced by the below Cartesian product

{x1 min, x1 min+1, x1 nom, x1max-1, x1max} * {x2 min, x2 min+1, x2


nom, x2max-1, x2max}
6

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

5.Worst-Case Boundary value Test cases of three inputs triangle problem:-


Three sides of the triangle are x1, x2, x3 lies between1-200 test cases are

{{ {x1min,x1min+,x1nom,x1max,x1 max-} *{x2min,x2min+,x2nom,x2max,x2 max-}}*


{x3min, x3min+, x3nom, x3max, x3 max-}}

} * {x3 min, x3 min+1, x3 nom, x3max-1, x3 max}

Total no.of testcases are 5 n (N is no.of inputs)


ROBUSTNESS TESTING

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

1.Robustness Testing of single input

Min- Min+ Avg Max- Max+


|------|------|----------------------|------------------------|------|------|
Min Max

Robustness Test Cases of single input


{ x1 mn-,x1min,x1min+,x1avg,x1max-,x1max,x1max+ }
No.of test cases are 6n+1 (n is no of inputs)
Example: -
Requirement of ATM withdraw min amount is 100 max is 10,000 Robustness Test
Cases are (Min-1, min, min+1, avg, max-1, max max+1)
0 1 2 51 99 100 101

2.Robustness Test Cases of two inputs a<= x1<=b,c<=x2<=d:-

{< x1 nom,x2min->,< x1 nom,x2min>,< x1 nom,x2min+>,< x1 nom,x2nom>,< x1


nom,x2max->,
<x1nom,x2max>,<x1nom,x2max+>,<x1min,x2nom>,<x1min,x2nom>,<x1min+,x2nom>
<x1max+,x2nom>,<x1max,x2nom>,<x1max-,x2nom> }
Example for writing Robustness Test Case of two inputs
To test whether addition is working correctly or not (2 inputs) c= a+ b
(1<=a<=100, 1<=b<=100)
a= {0,1,2,50,99,100,101} b={0,1,2,50,99,100,101}

Based on the above sets, combinations of test cases (inputs) are

{(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

Give first set input values are 50 and 0 c=50+0

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).

Best method to follow is Robustness testing.


Equivalence Class Testing

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.

There are four types of Equivalence Class Testing types


1.Weak Normal Equivalence Class Testing
2.Strong Normal Equivalence Class Testing
3.Weak Robust Equivalence Class Testing
4.Strong Robust Equivalence Class Testing
Equivalence Class Test Cases of single input: -
Consider a numerical input variable, i, whose values may range from -200 through
+200. Then a possible partitioning of testing input variable by 4 people may be:
o -200 to -101| -100 to 0|1 to 100|101 to 200
Inputs are -150, -50,90, and 150
Weak Normal Equivalence testing of two inputs:-
Assumes the ‘single fault’ or “independence of input variables.”
E.g. If there are 2 input variables, these input variables are independent of each
other.
Partition the test cases of each input variable separately into different equivalent
classes.
Choose the test case from each of the equivalence classes for each input variable
independently of the other input variable
Strong Normal Equivalence testing of two inputs:-

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

Weak Robust Equivalence testing of two inputs:-

• Up to now we have only considered partitioning the valid input space.


• “Weak robust” is similar to “weak normal” equivalence test except that the invalid input
variables are now considered.

13

Strong Robust Equivalence testing of two inputs:-

• Does not assume “single fault” - - - assumes dependency of input variables


• “Strong robust” is similar to “strong normal” equivalence test except that the invalid
input variables are now considered.robo
Equivalence Class Test Cases for the Triangle Problem

• 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

Weak Normal Test Cases of Triangle problem

Test A b C Expected Output


Case
WN1 5 5 5 Equilateral
WN2 2 2 3 Isosceles
WN3 3 4 5 Scalene
WN4 4 1 2 Not a Triangle
Weak Robust Test Cases of Triangle problem

Test Case A b C Expected Output


WR1 -1 5 5 Value a is not in range
WR2 5 -1 5 Value b is not in range
WR3 5 5 -1 Value c is not in range
WR4 201 5 5 Value a is not in range
WR5 5 201 5 Value b is not in range
WR6 5 5 201 Value c is not in range
Strong Robust Test Cases of Triangle problem
Test Case A b C Expected Output
SR1 -1 5 5 Value a is not in range
SR2 5 -1 5 Value b is not in range
SR3 5 5 -1 Value c is not in range
SR4 -1 -1 5 Value a,b is not in range
SR5 5 -1 -1 Value b,c is not in range
SR6 -1 5 -1 Value c,a is not in range
SR7 -1 -1 -1 Value c,a,b is not in range
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
mutially 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 disjointness assures a form of non-redundency

35
Equivalence Classes

• The idea of equivalence class testing is to identify test cases by using


one element from each equivalence class.
• If the equivalence classes are chosen wisely this greatly reduces the
potential redundancy among test cases.
• The key point in equivalence class testing is the choice of the
equivalence relation that determines the classes (partitions).
• We will differentiate below, between weak and strong equivalence class
testing.

36
Equivalence Class Selection

• tends to much of a “craft”:


– no dependence on knowledge of code, only the specification.
– needs knowledge of input domain that usually goes beyond what an interface
design spec provides
» familiarity with specifications
– must understand how inputs are mutually dependent.

37
Example

• Let us consider a program P with 3 inputs: a, b


and c and the corresponding input domains are
A, B, and C.
– let there be defined the partition:

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.

• 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.(?)

39
Weak Equivalence Class Testing

• Weak equivalence class testing is accomplished by using one


variable from each equivalence class in a test case.
• The minimum number of test cases is equal to the number of
classes in the partition with the largest number of subsets.
• From the previous example, we have:

Test Case Variable a Variable b Variable c


WE1 a1 b1 c1
WE2 a2 b2 c2
WE3 a3 b3 c1
WE4 a1 B4 c2 40
Strong Equivalence Class Testing

• Strong equivalence class testing is based on the Cartesian Product of the partition
subsets.

• From the previous example, this would generate:


3 * 4 * 2 = 24 test cases

• 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

• The traditional view of equivalence class testing


defines equivalence in terms of validity that is,
test cases determined from the valid and invalid
values for each input variable.
• For each input variable there are valid and invalid
values.
• In the traditional approach, these are identified
and numbered, and then incorporated into test
cases in the weak sense as presented above.

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:

– The first is that, very often, the specification does not


define what the expected value for an invalid test case
should be.

– The second problem is that strongly typed languages


eliminate the need for the consideration of invalid
inputs.

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)

Test Case size weight Expected Output


TE1 100 750 what ever it should be
TE2 100 -1 invalid input
TE3 100 1500 invalid input

TE4 -1 750 invalid input

TE5 200 750 invalid input

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:

R1= {<a, b, c> | the triangle with sides a, b, c, is equilateral}


R2= {<a, b, c> | the triangle with sides a, b, c, is isosceles}
R3= {< a, b, c> | the triangle with sides a, b, c, is scalene}
R4= {a, b, c> | sides a, b, c do not form a triangle}

• These classes yield the following simple set of test cases:


48
Sample Test Cases based on Output Domain

Test Case a b c Expected


Output
OE1 5 5 5 Equilateral

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:

D1= {<a,b,c> | a=b=c}


D2= {<a,b,c> | a=b, a≠c}
D3= {<a,b,c> | a=c, a≠b}
D4= {<a,b,c> | b=c, a≠b}
D5= {<a,b,c> | a≠b, a≠c, b≠c}

• 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}

• If we wanted also we could split D6 into


D6’={<a, b, c> | a = b+c} and
D6’’= {<a, b, c> | a > b+c} 50
Equivalence Test Cases for the NextDate Problem (Input
Domain)
• Nextdate is a function of three variables, month, day, and year and
these have ranges defined as:

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

• The valid equivalence classes are:


M1= {month | 1 ≤ month ≤ 12}
D1= {day | 1 ≤ day ≤ 31}
Y1= {year | 1812 ≤ year ≤ 2012}

The invalid equivalence classes are:


M2= {month | month < 1}
M3= {month | month > 12}
D2= {day | day < 1}
D3= {day | day > 31}
Y2= {year | year < 1812}
Y3= {year | year > 2012}

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

Case ID Month Day Year Expected


Output
TE1 6 15 1912 6/16/1912
TE2 -1 15 1912 Invalid
TE3 13 15 1912 Invalid
TE4 6 -1 1912 Invalid
TE5 6 32 1912 Invalid
TE6 6 15 1811 Invalid
TE7 6 15 2013 Invalid
53
Choice of Equivalence Classes

• If we more carefully chose the equivalence relation, the resulting


equivalence classes will be more useful

M1= {month | month has 30 days}


M2= {month | month has 31 days}
M3= {month | month is February}
D1= {day | 1 ≤ day ≤ 28}
D2= {day | day = 29}
D3= {day | day = 30}
D4= {day | day=31}
Y1= {year | year = 1900}
Y2= {year | 1812 ≤ year ≤ 2012 AND year ≠ 1900 AND (year = 0 mod 4}
Y3= {year | 1812 ≤ year ≤ 2012 AND year ≠ 0 mod 4}

54
Weak Equivalence Class Test Cases

Case ID Month Day Year Expected


Output

WE1 6 14 1900 6/15/1900

WE2 7 29 1912 7/30/1912

WE3 2 30 1913 Invalid

WE4 6 31 1900 Invalid

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

CASE ID Month Day Year Output


SE19 7 30 1900 7/31/1900
SE20 7 30 1912 7/31/1912
SE21 7 30 1913 7/31/1913
SE22 7 31 1900 8/1/1900
SE23 7 31 1912 8/1/1912
SE24 7 31 1913 8/1/1913
SE25 2 14 1900 2/15/1900
SE26 2 14 1912 2/15/1912
SE27 2 14 1913 2/15/1913
SE28 2 29 1900 ERROR
SE29 2 29 1912 3/1/1912
SE30 2 29 1913 ERROR
SE31 2 30 1900 ERROR
SE132 2 30 1912 ERROR
SE33 2 30 1913 ERROR
SE34 2 31 1900 ERROR
SE35 2 31 1912 ERROR
SE36 2 31 1913 ERROR
57
Guidelines and Considerations

• The traditional form of equivalence testing is generally not as


thorough as weak equivalence testing, and in its turn, not as thorough
as strong equivalence testing
• If error conditions is a priority we can extend strong equivalence
testing to include invalid classes
• Equivalence class testing is appropriate when input data is defined in
terms of ranges and sets of discrete values.
• Logic of functionality of the program can help define the equivalence
classes
• Strong equivalence takes the presumption that variables are
independent, otherwise it generates some “error” test cases
• Can be strengthened by using it with domain testing (boundary value)
– reuse the work to define the ranges.
– Does not consider elements at equivalence class boundaries
– need to expand ECT to include BVT-like requirements (domain testing)

58
THANK YOU

You might also like