|
|
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.
If
software
behaves in
an identical
way for a
set of
value, then
the set is
termed as
equivalence
class or a
partition.
It can be
assumed
safely that
functionality
of the
software
will be same
for any data
value from
the
equivalence
class or
partition.
In
equivalence
partitioning,
input data
is analyzed
and divided
into
equivalence
classes
which
produces
different
output.
|
Now, data from these
classes can be
representative of all the
input values that your
software expect. For
equivalence classes, it can
be assumed that software
will behave in exactly same
way for any data value from
the same partition.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.
For example, consider a very simple function for awarding grades to the students. This program follow these guideline to award grades
Marks 00 - 39 ------------ Grade D
Marks 40 - 59 ------------ Grade C
Marks 60 - 70 ------------ Grade B
Marks 71 - 100 ------------ Grade A
Based on the equivalence partitioning techniques, partitions for this program could be as follows
Marks between 0 to 39 - Valid Input
Marks between 40 to 59 - Valid Input
Marks between 60 to 70 - Valid Input
Marks between 71 to 100 - Valid Input
Marks less than 0 - Invalid Input
Marks more than 100 - Invalid Input
Non numeric input - Invalid Input
From the example above, it is clear that from infinite possible test cases (Any value between 0 to 100, Infinite values for >100 , < 0 and non numeric) data can be divided into seven distinct classes. Now even if you take only one data value from these partitions, your coverage will be good.
Most important part in equivalence partitioning is to identify equivalence classes. Identifying equivalence classes needs close examination of the possible input values. Also, you can not rely on any one technique to ensure your testing is complete. You still need to apply other techniques to find defects.
If you have used Equivalence Partitioning in some interesting way, why not share with all?
|