All the software engineers would agree to the fact that software testing is as important as software development itself. Every developer is familiar with the frustration of receiving bug reports from users even after spending hundreds of hours on writing thousands of code lines. An increasing number of software companies are realizing the importance of software testing and are paying more attention to it. Equivalence partitioning is an important as well as interesting software testing technique.
In equivalence partitioning, the tester recognizes various equivalent classes for segregating, which are also the test cases. In this method, input possibilities are sorted into classes, which are known as equivalence classes. But each of these classes cause the same processing and produce the same output. A class is a bunch of inputs that are likely to be processed in the same manner by the software. This partitioning method can also be defined as a testing technique to minimize the occurrences of permutations and combinations of input data. It can be considered that the utility of the program will remain same for any value of data from the same class. That means, it is enough to choose one test case from every segment to inspect the behavior or utility of the program. Even if you test for all the test cases of a partition, hardly ever a new fault will be revealed in the program. Thus, the values in one partition can be safely taken to be equivalent. This reduces the effort of the tester by minimizing the number of test cases to be tested. Applying this technique also assists you in finding the "dirty" test cases.
Black Box Vs. White Box
Black box testing is a testing is a way in which a software program is tested at the outer interface, without considering its internal architecture. The testing technique in question is often compared with black box testing. However, it has similarities with white box testing too. Some software may give different results for different ranges of the input values, which will not be noticed by black box method, as it deals only with the outer interface. In white box testing, all the possible processes will be examined. To ensure this, additional segregation is considered in equivalence partitioning, which is not done in black box testing.
A Simple Example
Consider the following example of a simple software program for student grading system.
- Percentage 00 - 39 Output- Grade F
- Percentage 40 - 59 Output- Grade C
- Percentage 60 - 70 Output- Grade B
- Percentage 71 - 100 Output- Grade A
- Percentage between 0 to 39 - Valid Input
- Percentage between 40 to 59 - Valid Input
- Percentage between 60 to 70 - Valid Input
- Percentage between 71 to 100 - Valid Input
- Percentage less than 0 - Invalid Input
- Percentage more than 100 - Invalid Input
- Non numeric input - Invalid Input
The main use of this software is to find out equivalence classes, and doing that requires proper examination of all the possible inputs. The prime advantage of implementing this technique is that the efforts of the tester are greatly reduced without compromising with quality. Unnecessary test cases are eliminated, because all the cases that give the same outcome are bunched together.