
Software Testing - Equivalence Partitioning Testing
A developed software goes through multiple phases of testing to verify whether it is working as per the specifications. In black box testing, the outputs generated from the software against the inputs are verified. Equivalence Partitioning is one of the concepts under black box testing. It is a technique which segregates the input data range into multiple classes which are then converted into test classes.
What is an Equivalence Partitioning?
An equivalence partitioning is a test design technique that is very popularly used in software testing. It enables the testers to divide input data into groups. It helps to minimize the total count of tests without compromising on achieving a good test coverage. It helps to handle large test data while testing the software.
How to set the Equivalence Partitions?
In case a span of conditions is provided as an input, then there should be one valid and two invalid equivalence classes. In case a particular data is considered as an input, then there should be one valid and two invalid equivalence classes. If a particular input is chosen from a data range, then there should be one valid and two invalid equivalence classes. Finally, if a boolean value is chosen as an input criteria, then there should be one valid and one invalid equivalence class.
Example
Let us take an example of an e-commerce application which gives discounts in the ranges described below −
Transactions of less than $ 1 are not allowed in the application. For transactions from $1 to $150, a discount of 5 % would be given. For transactions from $151 to $250, a discount of 10 % would be given. For transactions from $251 to $3500, a discount of 25 % would be given. Transactions of more than $ 3500 are not allowed in the application.
Equivalence Partitioning | ||||
---|---|---|---|---|
Invalid | Valid 5 % | Valid 10 % | Valid 25 % | Invalid |
>$1 | $1 to $150 | $151 to $250 | $251 to $3500 | < $3500 |
From the above equivalence partitioning table, we have divided the input data into logical valid and invalid partitions. Also, we have a clear view on what values that need to be tested in order to get different discount values. It also guides to develop the optimal number of test cases in order to achieve the best test coverage.
The equivalence partitioning reduces the chance of testing random values. We need to test some of the values within the invalid partitions at the higher and lower ends, and then concentrate on some of the values within the individual valid partitions as well. In our example, for the lower invalid partition, we can choose the values $ 0.99, and $ 0 for testing, for the upper invalid partition, we can choose the values $ 3506, and $ 4000 for testing, for the first valid partition, we can choose the values $ 1, and $ 140 for testing, for the second valid partition, we we can choose the values $ 152, and $ 250 for testing, and for the third valid partition, we we can choose the values $ 251, and $ 4000 for testing.
By applying the equivalence class partitioning, we can achieve a very good test coverage, and we can verify each partition of the discount feature of the e-commerce application. Thus we have divided the different modules which behave similarly or logically equal in specific scenarios into valid and invalid partitions. Then within those partitions, it does not matter which values are chosen inside that range, the outputs will be the same. For example, we should have the same discount of 5 %, for all transactions having values in the range $1 and $150. The equivalence class partitioning if used along with the boundary value analysis, give the best test coverage.
Why do We use an Equivalence Partitioning?
The equivalence partitioning is used for the reasons listed below −
- It helps to achieve the best test coverage with the optimal number of test cases designed.
- Since we just require creating the optimal number of test cases, it saves a lot of time and effort.
- It helps to detect bugs at the boundary values of each equivalent partition.
- It gives the option to reuse the test cases.
- The test cases built on equivalence partitioning are easier to maintain.
Advantages of Equivalence Partitioning
The advantages of equivalence partitioning are listed below −
- It enhances the quality and effectiveness of test cases.
- It helps to improve the test coverage.
- It saves a lot of time and effort in testing.
- It detects a lot of errors in the software.
- It enhances the overall software quality.
Disadvantages of Equivalence Partitioning
The disadvantages of equivalence partitioning are listed below −
- It is only limited to the input data sets and the outputs they generate and does not have any verification on how the different components of the software interact with each other.
- It is difficult to come up with equivalent partitions for complex, and integrated scenarios.
- It requires the tester's knowledge of the software to come up with all the equivalent partitions.
- Though the equivalent partitions give a good coverage, it does not guarantee identification of all defects in the software.
Conclusion
This concludes our comprehensive take on the tutorial on Software Equivalence Partitioning Testing. Weve started with describing what is an equivalence partitioning, how to set the equivalence partitions, example on equivalence partitioning, why do we use an equivalence partitioning, what are the advantages of equivalence partitioning, and what are the disadvantages of equivalence partitioning. This equips you with in-depth knowledge of Software Equivalence Partitioning Testing. It is wise to keep practicing what youve learned and exploring others relevant to Software Testing to deepen your understanding and expand your horizons.