Equivalence Partitioning
Stop testing every value one by one. Learn how to group inputs into "buckets" where every member behaves the same way — then test one representative from each bucket.
1 The Hook — The Christchurch GST Crash
A Christchurch accounting firm launched a new GST return portal. Their tester manually entered fifty random invoice amounts — all passed. On launch day, a contractor entered −$500.00 for a credit note. The system accepted it, calculated negative GST, and fed invalid data straight to Inland Revenue.
The tester had tested the "happy path" exhaustively but never thought about groups of bad input. One missing invalid partition — negative numbers — caused real financial pain. Equivalence partitioning would have caught this in five minutes.
2 The Rule — One Rep per Bucket
Divide every input into groups (partitions) that should behave the same way. Test one representative from each — never more, never less.
If $50.00 works, $500.00 probably works too. If −$1.00 fails, −$100.00 will fail for the same reason. You don't need to prove it fifty times. You prove it once per bucket.
3 The Analogy — Kiwifruit Sorting
Te Puke Packing House.
You don't inspect every single fruit for bruises. You create buckets: "Export Grade," "Local Market," and "Reject." You pick one fruit from each bucket. If the export bucket is good, they're all good. If the reject bucket is rotten, the whole bucket is rotten. EP is your sorting table for software inputs.
4 Watch Me Do It — NZ IRD Numbers
Scenario: You're testing a tax form. The "IRD Number" field has a very specific business rule: it must be 8 or 9 digits long. It must only contain numbers. Anything else is rejected.
-
Identify the Valid Partition: 8-digit or 9-digit numbers. (Rep:
12-345-678) -
Identify Invalid (Too Short): 7 digits or fewer. (Rep:
1234567) -
Identify Invalid (Too Long): 10 digits or more. (Rep:
1234567890) -
Identify Invalid (Non-Numeric): Letters or symbols. (Rep:
12-345-abc) -
Identify Invalid (Empty): Leaving it blank. (Rep:
"")
| Partition | Representative | Expected Result |
|---|---|---|
| Valid (8 or 9 digits) | 12345678 | Accepted |
| Invalid (Too short) | 1234567 | Rejected (Error: "Too short") |
| Invalid (Too long) | 1234567890 | Rejected (Error: "Too long") |
| Invalid (Format) | 12-abc-45 | Rejected (Error: "Numbers only") |
| Invalid (Empty) | (blank) | Rejected (Error: "Required") |
5 Decision Tool — When to Use It?
✅ Use EP when...
- You have clear input ranges (e.g. Age 18-65)
- You have categories (e.g. Member, Admin, Guest)
- You have infinite possibilities (e.g. Name field)
❌ Don't use it for...
- Checking the exact edges (use BVA for that)
- Complex multi-field logic (use Decision Tables)
- Simple Yes/No toggles
6 Common Mistakes
🚫 Skipping the "Invalid" buckets
I used to think: If it works for valid data, I'm done.
Actually: Most crashes happen in the invalid buckets. Negative numbers, symbols in name fields, and 100-character addresses are where the bugs hide.
🚫 Testing only one valid value
I used to think: I tested "John", so the Name field is fine.
Actually: Some partitions are "hidden." "John" works, but what about "O'Reilly" (apostrophe) or "Müller" (accent)? Those are different sub-partitions that often break code.
7 Now You Try — KiwiSaver Age
Scenario: A KiwiSaver provider accepts new members aged 18 to 65 inclusive. Under 18s are rejected. Over 65s are redirected to a different form.
List the partitions and one representative for each.
8 Self-Check
Q1. Can you combine two invalid values in one test case?
No. Test each invalid partition separately. If you submit a negative number that is ALSO non-numeric, and the test fails, you won't know which validation rule broke.
Q2. Is one representative enough for a partition?
Yes, by definition. The assumption of EP is that all values in a partition are handled the same way. If you need more than one, you've probably found a "hidden" sub-partition.
9 Interview Prep
"Why do we use Equivalence Partitioning?"
Answer: "Because testing is infinite, but time is finite. EP allows us to achieve high functional coverage with a minimum number of test cases by identifying groups of input that are logically equivalent. It ensures we don't waste time re-testing the same logic over and over."
10 Next Step
Now that you've mastered the middle of the buckets, it's time to test the edges. Next: Boundary Value Analysis.