Equivalence partitioning is a specification-based (black box) testing technique.
Test conditions are divided (partitioned) in groups (partitions). The assumption is that the software we are testing treats all test conditions within a group identically.
If one test condition passes, we can safely assume that all the other test conditions within that group (partition) will pass. Based on same logic, if one test condition fails, all test conditions within that partition will fail.
Instead of testing all test conditions within a partition, it is sufficient to test one single test condition.
Consider N the numeric value of the grade.
If 90 <= N <=100 then the mark is A If 80 <= N < 90 then the mark is B If 50 <= N <80 the mark is C If 0 <=N < 50 then the mark is D
Use equivalence partitioning and boundary value analysis in order to determine:
|Invalid partition||D||C||B||A||Invalid Partition|
|0 -1||0 49||50 79||80 89||90 100||101|
There are six equivalence partitions which we identified from specifications.
We can design six test cases, each test case having as input a value from one of these partitions.
For example, we can use as input values: -10, 45, 60, 85, 95, 120.
Invalid partition does not mean that the software will crash when a value from that partition is entered. Software will have to somehow warn the user that an invalid value has been entered.
Equivalence partitioning is used in conjunction with Boundary Value Analysis.
In the above example, we identify six equivalence partitions and ten boundary values. Sixteen test cases will provide a good coverage,