Equivalence partitioning is a software testing technique to minimize
number of permutation and combination of input data. In equivalence
partitioning, data is selected in such a way that it gives as many
different out put as possible with the minimal set of data.
So essentially, there are two steps that you need to follow if you
want to use equivalence partitioning in your projects -
Identifying equivalence classes or partition
Picking one value from each partition for the complete coverage.
Main advantage of using this technique is that testing efforts are minimized and at the same time coverage is also ensured. Using this technique, redundancy of test cases is removed by eliminating data which does not produce different output.
Following are some general guidelines for identifying equivalence
classes:
a) If the requirements state that a numeric value is input to the
system and must be within a range of values, identify one valid class
inputs which are within the valid range and two invalid equivalence
classes inputs which are too low and inputs which are too high. For
example, if an item in inventory can have a quantity of - 9999 to
+ 9999, identify the following classes:
1. one valid class: (QTY is greater than or equal to -9999 and is
less than or equal to 9999). This is written as (- 9999 < = QTY
< = 9999)
2. the invalid class (QTY is less than -9999), also written as (QTY
< -9999)
3. the invalid class (QTY is greater than 9999) , also written as
(QTY >9999)
b) If the requirements state that the number of items input by the system at some point must lie within a certain range, specify one valid class where the number of inputs is within the valid range, one invalid class where there are too few inputs and one invalid class where there are, too many inputs.
For example, specifications state that a maximum of 4 purchase orders
can be registered against anyone product. The equivalence classes
are : the valid equivalence class: (number of purchase orders is greater
than or equal to 1 and less than or equal to 4 , also written as (1
< = no. of purchase orders < = 4)
the invalid class (no. of purchase orders> 4)
the invalid class (no. of purchase orders < 1)
c) If the requirements state that a particular input item match one
of a set of values and each case will be dealt with the same way,
identify a valid class for values in the set and one invalid class
representing values outside of the set. For example, if the requirements
state that a valid province code is ON, QU, and NB, then identify
:
the valid class code is one of ON, QU, NB
the invalid class code is not one of ON, QU, NB
d) If the requirements state that a particular input item match one
of a set of values and each case will be dealt with differently, identify
a valid equivalence class for each element and only one invalid class
for values outside the set. For example, if a discount code must be
input as P for preferred customer, R for standard reduced rate, or
N for none, and if each case is treated differently, identify
the valid class code = P
the valid class code = R
the valid class code = N
the invalid class code is not one of P, R, N