Software Testing Boundary Value Analysis

Boundary Value Analysis (BVA) is a test design technique that focuses testing on the edges of valid input ranges. Most software bugs hide at boundary points — the minimum, the maximum, and the values just outside those limits. BVA targets exactly those points.

Why Boundaries Are Bug Hotspots

Developers often use comparison operators like >=, <=, >, and < to define valid ranges. A small mistake — using > instead of >= — causes the boundary itself to behave incorrectly, while all values in the middle work fine.

  Intended:  if age >= 18 → allow access
  Coded as:  if age > 18  → allow access

  Result: Age 18 is rejected when it should be accepted.
  Middle of range (e.g., age 35) → works correctly
  Boundary (age 18) → fails!

  BVA catches this. Equivalence partitioning alone misses it.

The BVA Values to Test

For any valid range [Min, Max], BVA defines up to six test values:

  Min - 1   → Just below valid range  (Invalid)
  Min       → Lower boundary          (Valid)
  Min + 1   → Just above lower        (Valid)
  Max - 1   → Just below upper        (Valid)
  Max       → Upper boundary          (Valid)
  Max + 1   → Just above valid range  (Invalid)

BVA Example: Age Field (18 to 60)

  Valid range: 18 to 60

  ◄──Invalid──►◄────────── Valid ────────────►◄──Invalid──►
        |       |     |              |     |       |
       17      18    19            59    60       61

  Test Values:
  ┌────────────────────────────────────────────────────┐
  │ 17  → Just below minimum → Expected: Error         │
  │ 18  → Minimum boundary  → Expected: Accepted       │
  │ 19  → Just above min    → Expected: Accepted       │
  │ 59  → Just below max    → Expected: Accepted       │
  │ 60  → Maximum boundary  → Expected: Accepted       │
  │ 61  → Just above max    → Expected: Error          │
  └────────────────────────────────────────────────────┘

BVA Example: Password Length (8 to 20 characters)

  Requirement: "Password must be between 8 and 20 characters"

  BVA Test Cases:
  ┌──────────────────────────────────────────────────────┐
  │ TC01: 7 chars  → "Abc@123"           → Error         │
  │ TC02: 8 chars  → "Abc@1234"          → Accepted      │
  │ TC03: 9 chars  → "Abc@12345"         → Accepted      │
  │ TC04: 19 chars → "Abc@123456789012345" → Accepted    │
  │ TC05: 20 chars → "Abc@1234567890123456" → Accepted   │
  │ TC06: 21 chars → "Abc@12345678901234567" → Error     │
  └──────────────────────────────────────────────────────┘

Two-Value vs Three-Value BVA

Two-Value BVA

Tests only the boundary value and one value just outside it. Faster, fewer tests.

  For range 18–60:
  Test: 18 (boundary) and 17 (just outside)
  Test: 60 (boundary) and 61 (just outside)
  → 4 tests total

Three-Value BVA

Tests the boundary, one inside, and one outside. More thorough.

  For range 18–60:
  Test: 17, 18, 19
  Test: 59, 60, 61
  → 6 tests total

Three-value BVA is the industry standard because it catches both off-by-one errors and range definition mistakes.

BVA for Non-Numeric Inputs

BVA is not limited to numbers. It applies to any ordered input with defined boundaries.

  Date Field (must be between 01-Jan-2020 and 31-Dec-2025):
  ────────────────────────────────────────────────────────
  Test: 31-Dec-2019  → Just below minimum  → Error
  Test: 01-Jan-2020  → Minimum boundary    → Accepted
  Test: 02-Jan-2020  → Just above min      → Accepted
  Test: 30-Dec-2025  → Just below max      → Accepted
  Test: 31-Dec-2025  → Maximum boundary    → Accepted
  Test: 01-Jan-2026  → Just above max      → Error

  File Upload Size (max 5 MB):
  ────────────────────────────
  Test: 4.9 MB → Accepted
  Test: 5.0 MB → Accepted (boundary)
  Test: 5.1 MB → Error

BVA and Equivalence Partitioning Together

  STEP 1: Use Equivalence Partitioning to identify input groups
  ─────────────────────────────────────────────────────────────
  Valid: 18–60
  Invalid (low): below 18
  Invalid (high): above 60

  STEP 2: Use BVA to select the exact values to test within
          each partition boundary
  ─────────────────────────────────────────────────────────────
  From "Invalid (low)": test 17
  From "Valid":         test 18, 19, 59, 60
  From "Invalid (high)": test 61

Using both techniques together gives complete and efficient coverage of any input field.

Key Takeaways

  • Bugs cluster at boundaries — BVA goes exactly where bugs hide.
  • Six test values per numeric range give thorough boundary coverage.
  • BVA applies to any ordered input: numbers, dates, file sizes, text lengths.
  • Combine BVA with equivalence partitioning for the most efficient test design.

Leave a Comment