What is Equivalence Partitioning Technique?
Updated: Jan 19, 2022
This Black-Box test technique can be used at any level of testing (Unit, Component, Integration, and system). It is used to determine the set of valid and invalid inputs specified for the tested object and divide it up into partitions of data inputs that, according to the application requirements, should behave the same when used as an input (the application behavior should be the same when tested with these inputs).
The main advantage of this method is that it allows the tester to validate the tested object with a narrow set of test inputs because he will use a single condition from each class instead of all available information (remember that we assume that all inputs in a single class will behave the same, therefore we can test only single value).
The assumptions are:
If a single value from a class is working, we can assume that all class values will work the same once used as input.
If a single value from a class is NOT working, we need to validate the object with further inputs of the same class.
The probability of uncovering defects with the selected test inputs is higher.
We will cover different domain inputs (Valid/Invalid).
We will reduce the number of test cases.
We will reduce the testing time.
One main disadvantage in ECP is that you must remember that testing is a big mistake! Therefore, you should use this method wisely and test more than a single value if you know that a specific area has more chances to trigger defects or when you know that there is a higher risk.
So How can we use this method?
The tested object is an input field where the user needs to specify his age; the requirements are:
The user can insert any number between 25 – 100.
The user can insert any number between 5 – 15.
The user cannot use negative numbers.
As you can see, we will not want to test all inputs that are available for testing; therefore, we will use the EP method to create the following partitions:
Class no'1: 25 <= Input <= 100 (Positive)
Class no'2: 5 <= Input <= 15 (Positive)
Class no'3: 16 <= Input <= 24 (Invalid)
Class no'4: Input > 100 (Invalid)
Class no'5: Input < 0 (Invalid)
Class no'6: 0 <= Input <= 4 (Invalid)
Now, all you need to do to validate the tested input field is to use one set of dates that belongs to each partition (six values in total). You can see we covered the main scenarios in 6 tests instead of running a large number of tests that will not add any real benefit/value to the testing effort.