What is "Equivalence Class Partitioning"?
We define "Equivalence Class Partitioning" as a method that can help you derive test cases. You identify classes of input or output conditions. The rule is that each member in the class causes the same kind of behavior of the system. In other words, the "Equivalence Class Partitioning" method creates sets of inputs or outputs that are handled in the same way by the application.
"A technique in black box testing. It is designed to minimize the number of test cases by dividing tests in such a way that the system is expected to act the same way for all tests of each equivalence partition. Test inputs are selected from each class. Every possible input belongs to one and only one equivalence partition."
Why learn "Equivalence Class Partitioning"?
This method drastically reduces the number of test cases that are required to be tested because we don't have time, money or manpower to test everything. In addition, it can help you find many errors with the smallest number of test cases.
How to use "Equivalence Class Partitioning"?
- Identify the equivalence classes of input or output. Take each input's or
output's condition that is described in the specification and derive at least 2
classes for it:
- One class that satisfies the condition – the valid class.
- Second class that doesn't satisfy the condition – the invalid class.
- Design test cases based on the equivalence classes.
Example 1
Invalid class: QTY > +500
Invalid class: QTY < -500
Valid class: type is P3
Valid class: type is P4
Valid class: type is P5
Invalid class: type isn’t P2, P3, P4 or P5
- Valid class: 0 <= account <= 499
- Valid class: 500 <= account <= 1000
- Valid class: 2000 <= account <= 2000
- Invalid class: account < 0
- Invalid class: 1000 < account < 2000
- Invalid class: account > 2000
Equivalence Class Vs Boundary Testing
- valid class: 0 <= account <= 499
- valid class: 500 <= account <= 1000
- valid class: 2000 <= account <= 2000
- invalid class: account < 0
- invalid class: 1000 < account < 2000
- invalid class: account > 2000
|
Test Case # |
Value |
Result |
|
1 |
-1 | Invalid |
|
2 |
0 | Valid |
|
3 |
1 | Valid |
|
4 |
498 | Valid |
|
5 |
499 | Valid |
|
6 |
500 | Valid |
|
7 |
501 | Valid |
|
8 |
999 | Valid |
| 9 | 1000 | Valid |
| 10 | 1001 | Invalid |
| 11 | 1999 | Invalid |
| 12 | 2000 | Valid |
| 13 | 2001 | Invalid |
In boundary testing, you need to test each value in the boundary and you know the value, you don't need to choose it from any set. In this example you have 13 test cases.
|
# |
Boundary Value |
Equivalence Class |
Result |
|
1 |
-1 | account < 0 | Invalid |
|
2 |
0 | 0 <= account <= 499 | Valid |
|
3 |
1 | 0 <= account <= 499 | Valid |
|
4 |
498 | 0 <= account <= 499 | Valid |
|
5 |
499 | 0 <= account <= 499 | Valid |
|
6 |
500 | 500 <= account <= 1000 | Valid |
|
7 |
501 | 500 <= account <= 1000 | Valid |
|
8 |
999 | 500 <= account <= 1000 | Valid |
| 9 | 1000 | 500 <= account <= 1000 | Valid |
| 10 | 1001 | 1000 < account < 2000 | Invalid |
| 11 | 1999 | 1000 < account < 2000 | Invalid |
| 12 | 2000 | 2000 <= account <= 2000 | Valid |
| 13 | 2001 | account > 2000 | Invalid |
Now, we can reduce some of the test cases that belong to the same equivalence class. We can delete lines 3 and 4 which belong to equivalence class "0 <= account <= 499". We also can delete lines 7 and 8 hich belong to "500 <= account <= 1000". The new table will be:
|
# |
Boundary Value |
Equivalence
Class |
Result |
|
1 |
-1 | account < 0 | Invalid |
|
2 |
0 | 0 <= account <= 499 | Valid |
|
5 |
499 | 0 <= account <= 499 | Valid |
|
6 |
500 | 500 <= account <= 1000 | Valid |
| 9 | 1000 | 500 <= account <= 1000 | Valid |
| 10 | 1001 | 1000 < account < 2000 | Invalid |
| 11 | 1999 | 1000 < account < 2000 | Invalid |
| 12 | 2000 | 2000 <= account <= 2000 | Valid |
| 13 | 2001 | account > 2000 | Invalid |
|
# |
Boundary Value |
Equivalence
Class |
Result |
|
1 |
-1 | account < 0 | Invalid |
|
2 |
0 | 0 <= account <= 499 | Valid |
|
6 |
500 | 500 <= account <= 1000 | Valid |
| 11 | 1999 | 1000 < account < 2000 | Invalid |
| 12 | 2000 | 2000 <= account <= 2000 | Valid |
| 13 | 2001 | account > 2000 | Invalid |


 
 






JoshiKrish
