4.3 Boundary Value Analysis
Key Takeaways
- Boundary value analysis (BVA) tests values at and near the edges of ordered equivalence partitions, where defects cluster.
- Boundary defects come from comparison and off-by-one errors such as using < instead of <=.
- Two-value BVA tests the boundary value and its nearest neighbour on the other side of the boundary.
- Three-value BVA tests the value before, at, and after each boundary.
- BVA only applies to ordered (numeric or sequential) partitions and is normally combined with equivalence partitioning.
Why Boundaries Matter
Boundary value analysis (BVA) is built on a recurring observation: defects cluster at the edges of ordered partitions. Programmers routinely make off-by-one and comparison mistakes — writing < 100 where the specification means <= 100, or >= 0 where it should be > 0. These faults are invisible to a value chosen from the middle of a partition but are caught immediately by a value sitting on the boundary.
BVA is an extension of equivalence partitioning and shares its partitions, but it adds a crucial restriction: it applies only to ordered partitions — numeric ranges, dates, sequential codes — because the concept of an 'edge' or 'next value' must be meaningful. A boundary is the minimum or maximum value of a partition. You cannot do BVA on an unordered set such as {card, wallet, bank transfer}; there is no 'just below card.'
The CTFL v4.0 syllabus describes two variants of BVA, and the exam expects you to compute the test values for each precisely. The difference is how many values you take around each boundary.
Two-Value vs Three-Value BVA
Consider a field accepting integer scores from 50 through 100 inclusive. The lower boundary is 50; the upper boundary is 100.
Two-value BVA uses, for each boundary, the boundary value itself and its nearest neighbour across the boundary:
| Boundary | Two-value set |
|---|---|
| Lower (50) | 49, 50 |
| Upper (100) | 100, 101 |
So the two-value test data is {49, 50, 100, 101} — four values.
Three-value BVA uses, for each boundary, the value before, at, and after the boundary:
| Boundary | Three-value set |
|---|---|
| Lower (50) | 49, 50, 51 |
| Upper (100) | 99, 100, 101 |
So the three-value test data is {49, 50, 51, 99, 100, 101} — six values. Three-value BVA is more thorough (it catches a wider set of boundary faults, including those that mis-handle the value just inside the boundary) but costs more tests. Two-value BVA is the lighter default in many contexts.
Inclusive vs Exclusive Boundaries and Coverage
The exact boundary value depends on whether the limit is inclusive or exclusive — a frequent exam trap.
- 'Age 18 or over' → 18 is the boundary (inclusive); the values around it are 17 and 18 (and 19 for three-value).
- 'Amount greater than 1000' → 1000 is not valid; the first valid value is 1001. The boundary pair is 1000 (invalid) and 1001 (valid).
- For real numbers you must know the precision: if a price field allows two decimals, the value 'just below 100.00' is 99.99, not 99.
BVA coverage is measured against the boundary values identified:
BVA coverage % = (boundary values exercised
÷ total boundary values) × 100
In practice BVA and EP are used together: EP selects which partitions to cover, then BVA hardens each ordered partition by testing its edges. A complete black-box data set for a numeric field typically includes one mid-partition EP value plus the boundary values from BVA. Remember the constraints the exam checks: BVA needs ordered data, you must respect inclusive/exclusive limits and the data precision, and three-value BVA always produces more values than two-value BVA for the same boundaries.
Relationship to EP, and How to Apply BVA on the Exam
BVA and equivalence partitioning are siblings: EP identifies the ordered partitions, and BVA then examines the edges between adjacent partitions. A boundary is therefore always a point where one partition ends and the next begins. 2 (child 0–12, standard 13–64, senior 65+), the boundaries are between 12 and 13, and between 64 and 65 — so the BVA values of interest are 12, 13, 64, and 65 (two-value), plus 11, 14, 63, 66 for three-value. Notice BVA never operates on the unordered partitions such as payment type, which is why a complete black-box data set uses EP for all partitions and adds BVA only for the ordered ones.
A dependable BVA procedure for the exam:
- Identify each ordered partition and its specification rule.
- Find the minimum and maximum of each partition, respecting inclusive vs exclusive limits and the data precision.
- For two-value BVA, take the boundary and its nearest neighbour across the edge.
- For three-value BVA, take the value before, at, and after each boundary.
- State coverage as boundary values exercised over total boundary values.
Worked recap with an exclusive limit
A withdrawal must be 'between 20 and 500, both inclusive'. Lower boundary 20: two-value {19, 20}; three-value {19, 20, 21}. Upper boundary 500: two-value {500, 501}; three-value {499, 500, 501}. If instead the rule were 'less than 500' (exclusive), the largest valid value becomes 499 and 500 becomes the first invalid value — the same arithmetic but a different verdict on each side. Getting the inclusive/exclusive verdict right is the single most-tested BVA skill, because the boundary value is correct yet its valid/invalid classification flips, and exam options are written to catch exactly that confusion.
When in doubt, restate the rule as a numeric comparison ('valid when value >= 20 and value <= 500') and read the boundaries straight off it — that habit removes almost all inclusive/exclusive errors under exam time pressure.
A field accepts integer scores from 50 through 100 inclusive. What are the two-value BVA values?
For an inclusive integer range from 3 through 7, what is the three-value BVA set?
A specification states that an order qualifies for free shipping when the total is 'greater than 1000'. Which value is the smallest qualifying (valid) boundary value?