Glossary · Test design
Equivalence partitioning
Also called: equivalence class partitioning, equivalence classes, equivalence class testing, equivalence partitions
Definition
A test design technique that divides inputs into groups the system should treat the same way, then tests one representative value from each group.
Equivalence partitioning (also called equivalence class partitioning) splits the possible inputs into partitions where every value should produce the same behavior. If one value in a partition works, the others are assumed to work; if one fails, the others probably fail the same way. So you test one representative per partition instead of every possible value.
Example: age 18 to 60 accepted
A form accepts ages 18 to 60 inclusive, as whole numbers.
| Partition | Valid? | Representative | Expected |
|---|---|---|---|
| Less than 18 | Invalid | 10 | Rejected: “You must be 18 or older” |
| 18 to 60 | Valid | 35 | Accepted |
| Greater than 60 | Invalid | 75 | Rejected |
| Non-numeric | Invalid | abc |
Rejected: “Enter a number” |
| Empty | Invalid | (blank) | Rejected: “Age is required” |
| Decimal | Invalid | 25.5 | Rejected |
| Negative | Invalid | -5 | Rejected |
Seven tests cover the whole input space conceptually. Boundary value analysis then adds 17, 18, 60 and 61 at the edges of the numeric partitions, where defects are most likely. The two techniques are almost always used together.
Partitioning outputs and other inputs
Partitions are not limited to numbers:
- Categories: a shipping country field might partition into domestic, EU, rest of world, and embargoed countries, each with different rules.
- Outputs: if a tax calculator has three tax bands, choose inputs that land in each band.
- Formats: email addresses partition into valid, missing
@, missing domain, and too long.
Testing invalid partitions one at a time
When a form has several fields, combine valid partitions freely, but test each invalid partition on its own with all other fields valid. If you submit an invalid age and an invalid email together, the first validation error may hide the second, and you cannot tell whether both checks work.
Common mistakes
- Wrong partitions. Partitions come from the specification and from how the system really behaves. If the code treats ages 18 to 25 differently (say, a different insurance price), that is a separate partition even if the form accepts all of them.
- Only valid partitions. Most defects in input handling live in the invalid ones.
- Stopping at partitions. One value per partition will not catch an off-by-one error at the edge. Add boundary values.