Equivalence partitioning

Equivalence partitioning is a software testing techniquethis example this would be:
to optimize the number of permutation and combination…. -2 -1 0 1 ….. 6 7 ….. 12 13 14 15 …..
of input data. In equivalence partitioning, data is selected-----|---|----|------invalid partition 1 P1 P2 invalid partition 2
in a way such that with minimal set of data it may giveTC1 TC2 TC3 TC4valid partitions
many output.To check for the expected results you would need to
For a set of value if the software behaves in anevaluate some internal intermediate values rather than
identical way then the set can be termed asthe output interface.
equivalence class or partition. The software canTypes
assume as, it will work the same way for the differentContinuous classes, or ranges of values, run from one
values in the given equivalence class or partition. Thepoint to another, with no clear separations of value, like
input data is analyzed and divided as per the differenttemperature range.
output it is producing which is named as equivalenceDiscrete classes have clear separation of values.
partitioning. Whatever things the software expects canDiscrete classes are sets, or enumerations. Boolean
be a representative of all the input values in thisclasses are either true or false.
partitioning class. For a specific equivalence classes, itBoolean classes only have two values, either true or
can be assumed that software will behave in similarlyfalse, on or off, yes or no.
for any data value from that partition.Use
TheoryEquivalence partitioning will radically cuts down the
The testing theory of equivalence partitioning suggestsnumber of test cases required to test a system
that only one test case is needed to evaluate thereasonably. This is an attempt to get a good ‘hit
behaviour of the program for the related partition. Inrate', to find the most errors with the smallest number
other words it is sufficient to select one test case outof test cases.
of each partition to check the behaviour of theTo use equivalence partitioning, you will need to
program. By using more or all the test cases of theperform two steps
partition it will not find new faults in the program. TheIdentify the equivalence classes
values within one partition are considered to beDesign test cases
"equivalent." Thus the number of test cases can beTake each input condition described in the specification
reduced considerably.and derive at least two equivalence classes for it. One
Another effect by applying the equivalence partitioningclass represents the set of cases which satisfy the
technique is that it is able to find out the "dirty" testcondition (the valid class) and one represents cases
cases. An inexperienced tester may be tempted towhich do not (the invalid class).a) If the requirements
use as test cases the input data 1 to 12 for the monthstate that a numeric value is input to the system and
and forget to select some out of the invalid partitions.must be within a range of values, identify one valid
This would lead to a huge number of unnecessary testclass inputs which are within the valid range and two
cases on the one hand, and a lack of test cases forinvalid equivalence classes inputs which are too low
the dirty ranges on the other hand.and inputs which are too high.b) If the requirements
Black Box vs. White Boxstate that the number of items input by the system at
The main tendency is that the equivalence partitioningsome point must lie within a certain range, specify one
is always related to black box testing which is strictlyvalid class where the number of inputs is within the
checking a software component at its interfacevalid range, one invalid class where there are too few
without any consideration about its internal logics. Butinputs and one invalid class where there are, too many
there are various cases where we can apply theinputs.c) If the requirements state that a particular input
equivalence test in white box testing also.item match one of a set of values and each case will
Let us consider an interface is having a valid rangebe dealt with the same way, identify a valid class for
from 1 to 12. Internal structure is like that for 1 to 6, itvalues in the set and one invalid class representing
has a particular logic and for 7 to 12, has a differentvalues outside of the set.d) If the requirements state
logic. Depending on the input value the softwarethat a particular input item match one of a set of
internally will run through different paths to performvalues and each case will be dealt with differently,
slightly different actions.identify a valid equivalence class for each element and
Regarding the input and output interfaces to theonly one invalid class for values outside the set.e) If
component this difference will not be noticed, howeveryou think any elements of an equivalence class will be
in your white-box testing you would like to make surehandled differently than the others, divide the
that both paths are examined. To achieve this it isequivalence class to create an equivalence class with
necessary to introduce additional equivalence partitionsonly these elements and an equivalence class with
which would not be needed for black-box testing. Fornone of these elements.