Great work!

XP to next level

BugEater

Two-Point vs. Three-Point BVA

Learning Objectives

By the end of this lesson you will be able to:

  • Explain the difference between two-point and three-point BVA
  • Choose the appropriate BVA strategy based on the specification
  • Generate a minimal boundary test suite for any ranged input

Why Boundaries Are Special

Equivalence partitioning gives you one representative per class. But within the valid class of a range (say, ages 18–70), which value should you pick?

The answer isn't 35 — it's 18, 19, 69, and 70.

Why? Because the most common programming error is an off-by-one mistake in the boundary condition. The developer writes age > 18 instead of age >= 18, and everyone under 19 is incorrectly rejected. A representative in the middle of the valid range will never catch this.

Boundary Value Analysis is the systematic technique for testing at and near those dangerous boundary points.

Two-Point BVA

Two-point BVA tests the last invalid value and the first valid value on each boundary:

For range 18–70:

  • Lower boundary: 17 (last invalid) and 18 (first valid)
  • Upper boundary: 70 (last valid) and 71 (first invalid)

That's 4 test cases (plus one mid-range representative for good measure = 5 total).

Two-point BVA catches off-by-one errors on both sides of both boundaries.

Three-Point BVA

Three-point BVA adds the value just inside the valid range on each side:

For range 18–70:

  • Lower boundary: 17, 18, 19
  • Upper boundary: 69, 70, 71

That's 6 test cases. The extra two values (19 and 69) verify behavior just inside the valid range and can catch bugs that affect only the "just inside" case (rare, but it happens).

Three-point BVA is more thorough; two-point is more efficient. In practice, many teams use two-point for routine testing and three-point for high-risk fields.

Choosing Between Them

Scenario Recommendation
Routine testing, time constraints Two-point BVA
High-risk financial/medical inputs Three-point BVA
Legacy code with known edge case bugs Three-point BVA
New clean implementation with good tests Two-point BVA

The Missing Test: The Exact Boundary Value

Both two-point and three-point BVA include the exact boundary value (18 and 70 in our example). This is the most critical test case — it verifies that the system handles the minimum and maximum valid values correctly.

Testers who only test "slightly below" and "slightly above" the boundary often miss this test.

Pro Tip: Always include the exact boundary value in your test suite. It's the one most likely to be wrong due to off-by-one errors.

Key Takeaways

  • Two-point BVA: last invalid + first valid on each boundary (4 test cases for a range)
  • Three-point BVA: adds one value just inside the valid range (6 test cases for a range)
  • Always include the exact boundary value in your tests
  • Two-point is sufficient for most cases; three-point for high-risk inputs

Quiz

What is the core insight behind Boundary Value Analysis?

Two-point BVA tests the value just below AND at the boundary. Three-point BVA adds one more. Which value?

For a field accepting 10–50 inclusive, which set represents complete three-point BVA for BOTH boundaries?

A developer codes if (score >= 100) reject(). The spec says scores of 100 or above are invalid. What does BVA reveal?