To give the highest test results and quality, zen8labs utilizes a variety of testing techniques. Equivalence partitioning and boundary value analysis approach are two of the most popular and successful methods.
Equivalence partitioning in testing
If you ever wonder what Equivalence partitioning (or EP) is – it’s a black box testing technique. We can use it at any test level and it is one of the first techniques used at the beginning of any project’s testing process.
The idea behind this technique is to divide the input conditions or data ranges into equivalent groups/partitions. Let’s assume that all conditions and values in the same partition will be treated the same way and produce the same results, so we only test with one value in each partition. If one value in the partition is correct, we assume that all other values in the same partition are correct as well. In contrast, if any value in the partition is incorrect, then all values in that partition are incorrect.
![The different spheres of equivalence classes](https://www.zen8labs.com/wp-content/uploads/2024/03/zen8labs-Input-classes.png)
Example
Interest rates on bank savings accounts vary depending on the account balance. If the balance is between $0 and $2000, the interest rate is 3%; 5% if the balance is between $2001 and $5000; and 7% if the balance is above $5000 respectively. In other to test the program that calculates the amount of interest, we can identify the account balance ranges of different interest rates. Based on the requirement, we can identify 3 valid partitions and 1 invalid partition:
- From $1 to $2000
- From $2001 to $5000
- Above $5000
- Below $0
![The scale of valid equivalence](https://www.zen8labs.com/wp-content/uploads/2024/03/zen8labs-Valid-scale-1.png)
It’s important to note that in this example, we can identify four partitions even though the requirement only specifies three – it’s because we added an invalid partition (below $0). Therefore, identifying invalid partitions as well as valid partitions is an important task for the tester (negative test), This helps to ensure that the system also handles invalid data properly (showing error messages or instructions, etc.)
If testers do not use the equivalence partitioning approach, they can use any values as input. This subjective selection of data, however, may not cover all interest rates or will necessitate a large number of test cases.
Why use Equivalence Partitioning?
By using the equivalence partitioning technique, you can select any four values from the four identified partitions and assume that other values in the same partition will produce the same result. As a result, you can reduce the number of test cases to be executed to four, making it more efficient.
Advantage
- The number of test cases is reduced significantly because it is only necessary to select any value in each partition to test.
Disadvantages
- The proper equivalence partitions must be determined for this technique, and the tester’s expertise is key in this regard.
- Since errors are commonly concentrated in the boundary areas between partitions, selecting values in the middle of the partition will not find many errors. Therefore, this technique is frequently combined with the boundary value analysis technique to improve testing efficiency.
Boundary value analysis in testing
Boundary value analysis – BVA is a testing technique that involves analyzing and testing the boundary values between data partitions. As mentioned in the previous section, the errors appear more often at partition boundaries than within partitions, so the boundary values are the area where the test finds more errors. Each partition has a minimum and maximum value, that serves as the partition’s boundary values.
![How zen8labs view the input flow of equivalence](https://www.zen8labs.com/wp-content/uploads/2024/03/zen8labs-Input-flow-1.png)
The following rule can be used to select test cases for a partition:
- Minimum boundary value – 1
- Minimum boundary value
- Minimum boundary value + 1
- The normal value in the partition (nominal)
- maximum boundary value – 1
- maximum boundary value
- maximum boundary value +1
Example
Returning to the equivalent partitioning technique example, we can select the test cases for the Valid 1 partition (3% interest) as follows:
![the valid scale](https://www.zen8labs.com/wp-content/uploads/2024/03/zen8labs-Valid-scale-ii.png)
Advantages
- Since error densities more often concentrate on boundary values, this technique helps you find errors more easily and efficiently.
- Instead of testing with all values, you
Disadvantages
- The effectiveness of this testing technique is dependent on the identification of equivalence partitions. Misidentification of partitions can lead to misidentification or missing boundary values and, thus, failure to detect errors.
- This technique is not suitable for applications with open boundary values (values are not restricted in a certain direction).
Conclusion
Through different projects, zen8labs has found that by combining the equivalence partitioning technique and boundary value analysis, we can achieve more complete and efficient test results. Equivalence partitioning reduces the number of test cases by identifying groups of inputs that are likely to behave similarly. Boundary analysis complements equivalence partitioning by focusing on boundary values, which are frequently the most important areas, and detect the most errors in testing. When combined, these techniques can help identify bugs efficiently while reducing the number of test cases required.
If you are interested in other testing techniques, follow our Blog and stay updated!
Toan Tran, Head of Quality Assurance