Equivalence Partitioning & Boundary Value Analysis
Partition an input domain into equivalence classes and derive minimal, boundary-focused test values from it.
Equivalence partitioning (EP) divides an input or output domain into partitions that should all be handled the same way by the system — one representative value from a partition is assumed to exercise it as well as any other value in that partition would. This is what makes testing every value unnecessary: one test per partition gives you full equivalence partition coverage. Partitions can be valid (the system should accept and process them normally) or invalid (the system should reject them, e.g. with an error).
When a test item has several independent inputs, one test rarely covers a full combination of partitions — the simplest criterion, Each Choice coverage, only requires exercising every partition from every set at least once, without considering combinations.
Boundary value analysis (BVA) exploits the fact that developers are more likely to make errors right at the edges of ordered partitions. In 2-value BVA, each boundary has two coverage items: the boundary value itself and its closest neighbor in the adjacent partition (for a valid range of 18–65: 17, 18, 65, 66). In 3-value BVA, each boundary has three coverage items: the boundary value and both its neighbors (17, 18, 19, 64, 65, 66) — more rigorous, since it can catch a defect 2-value BVA overlooks entirely. For example, if if (x <= 10) is mistakenly coded as if (x == 10), neither 2-value BVA test (x=10, x=11) detects it — but 3-value BVA's x=9 does, since the buggy code wrongly rejects it.
The two techniques are almost always combined: EP tells you which partitions exist and guarantees you haven't missed a whole category of input; BVA tells you where inside and around each partition a defect is statistically most likely to be hiding.
Real-world use case
A discount rule reads "orders of $50 or more get free shipping." A single happy-path test at $75 would pass even if the code used > 50 instead of >= 50 — a real off-by-one that silently denies free shipping to every order of exactly $50.00. BVA testing at exactly $50.00 is what catches it; a mid-partition value like $75 never would.
Example code
Exercise
A discount rule: orders with a subtotal from $50.00 to $500.00 (inclusive) get 10% off; below $50 or above $500, standard pricing applies. List the equivalence partitions and the boundary values (two-value BVA) you would test.
Read-only here — open the English track at /learn to write and edit this exercise.
Quiz (3)
1. A field accepts whole numbers from 1 to 100 inclusive. Using two-value boundary value analysis, which set of values should you test?
2. A form's country field has three valid partitions: domestic, EU, and rest-of-world, each with different shipping logic. What is the minimum number of tests to achieve 100% equivalence partition coverage?
3. Why is boundary value analysis usually combined with equivalence partitioning rather than used alone?