Beyond Single-Variable Boundaries

Boundary value analysis (Lesson 3.2) tests one variable at a time. But real software has input spaces defined by relationships between multiple variables. Consider a loan approval system:

  • Approved if: income >= 30000 AND debt_ratio < 0.4 AND credit_score >= 650

This creates a three-dimensional input domain. The boundary is not a single point but a surface in 3D space. Testing each variable independently (as BVA does) misses defects that occur at the intersection of boundaries.

Domain analysis, formalized by Beizer and later by Binder, extends BVA to handle these multi-dimensional input spaces systematically.

Core Concepts

Input Domain

The set of all possible input combinations. For two integer variables x (1-100) and y (1-50), the domain is a 100 x 50 rectangle in 2D space.

Domain Boundary

A boundary is a condition that divides the input space into regions with different behaviors. x + y <= 100 creates a diagonal line in 2D space — inputs on one side are accepted, inputs on the other are rejected.

On Points and Off Points

On point: A value that lies exactly on the boundary.

  • For x <= 10: on point is x = 10
  • For x < 10: on point is x = 10 (the boundary itself, even though 10 is excluded)

Off point: A value that is minimally different from the on point, on the other side of the boundary.

  • For x <= 10 (closed boundary): off point is x = 11
  • For x < 10 (open boundary): off point is x = 10 (since 10 is just outside the domain)

Wait — this seems confusing. Let us clarify with a precise rule:

For a boundary condition where the domain is on one side:

  • On point: Exactly on the boundary, on the domain side (IN the domain if closed, OUT if open)
  • Off point: Minimally across the boundary from the on point
BoundaryOn PointOff Point
x <= 10 (domain is x <= 10)10 (in domain)11 (out)
x < 10 (domain is x < 10)9 (in domain)10 (out)
x >= 5 (domain is x >= 5)5 (in domain)4 (out)
x > 5 (domain is x > 5)6 (in domain)5 (out)

In Points

Values clearly inside the domain — not near any boundary. Used to verify that the interior of the domain behaves correctly.

Out Points

Values clearly outside the domain — not near any boundary. Used to verify rejection behavior.

Domain Error Types

Boundary Shift

The boundary is at the wrong position. The condition should be x <= 100 but is implemented as x <= 99 or x <= 101.

Closure Error

The boundary has the wrong type. Should be x <= 10 but implemented as x < 10, or vice versa. The boundary position is correct but the inclusion/exclusion is wrong.

Missing Boundary

A boundary that should exist is absent. The specification says “discount applies only to orders over $50” but no check for $50 is implemented.

Extra Boundary

A boundary exists that should not. An unnecessary validation rejects valid inputs.

Tilted Boundary

For multi-variable boundaries like x + y <= 100, the boundary has the wrong slope. Implemented as x + 2*y <= 100 instead.

The Domain Analysis Method

Step 1: Identify Variables and Boundaries

List all input variables and the conditions that define boundaries between different behaviors.

Example: Insurance Quote

  • Variables: age (18-80), driving_years (0-62), accidents (0-10)
  • Boundaries: age >= 25, driving_years >= 3, accidents <= 2 → standard rate

Step 2: For Each Boundary, Select On and Off Points

BoundaryVariableOn PointOff Point
age >= 25age2524
driving_years >= 3driving_years32
accidents <= 2accidents23

Step 3: Build the Domain Matrix

Each test case varies one boundary while keeping others at typical (interior) values:

Testagedriving_yearsaccidentsBoundary TestedExpected
125100age ONStandard
224100age OFFHigher rate
33530years ONStandard
43520years OFFHigher rate
535102accidents ONStandard
635103accidents OFFHigher rate
735100IN pointStandard

This requires 2 tests per boundary plus 1 in-point = 2B + 1 total.

Multi-Variable Boundaries

When boundaries involve multiple variables, the analysis becomes more interesting.

Example: Free shipping if quantity * price >= 100

This is a linear boundary in 2D space. On points lie exactly on the line quantity * price = 100:

  • (10, 10), (20, 5), (50, 2), (100, 1)

Off points are just below:

  • (10, 9.99), (20, 4.99), (50, 1.99)

Test at multiple on/off point pairs along the boundary to detect tilted boundary errors.

Exercise: Domain Analysis

Problem 1

A parking rate calculator uses these rules:

  • First hour: $5.00
  • Hours 2-4: $3.00/hour
  • Hours 5-8: $2.00/hour
  • Hours 9-24: $1.50/hour
  • Over 24 hours: $1.00/hour

Maximum charge: $50/day

Apply domain analysis to identify boundaries and derive test cases.

Solution

Variables: duration (hours), continuous from 0

Boundaries:

#BoundaryOn PointOff Point
1duration = 11.01.01 (enters hour 2 rate)
2duration = 44.04.01 (enters hour 5 rate)
3duration = 88.08.01 (enters hour 9 rate)
4duration = 2424.024.01 (enters over-24 rate)
5max charge = $50at capjust over cap

Test cases:

#durationExpected CostTests
10.5$5.00IN point, first hour
21.0$5.00ON boundary 1
31.01$5.00 + $0.03OFF boundary 1
44.0$5 + 3*3 = $14.00ON boundary 2
54.01$14.00 + $0.02OFF boundary 2
68.0$14 + 4*2 = $22.00ON boundary 3
78.01$22.00 + $0.015OFF boundary 3
824.0$22 + 16*1.5 = $46.00ON boundary 4
924.01$46 + $0.01OFF boundary 4
1048$50.00 (capped)Max charge boundary

Problem 2

A fitness app categorizes users by two variables:

  • BMI: underweight (<18.5), normal (18.5-24.9), overweight (25-29.9), obese (>=30)
  • Activity level: sedentary (<150 min/week), moderate (150-300), active (>300)

The app recommends different programs based on the BMI-activity combination. Apply domain analysis to the BMI x activity 2D space.

Solution

Boundaries:

#VariableBoundaryOnOff
1BMI18.518.518.4
2BMI25.024.925.0
3BMI30.029.930.0
4Activity150150149
5Activity300300301

Domain matrix (12 regions = 4 BMI x 3 activity):

#BMIActivityCategory
118.4100Underweight + Sedentary
218.5100Normal + Sedentary (ON BMI boundary)
322.0149Normal + Sedentary (OFF activity boundary)
422.0150Normal + Moderate (ON activity boundary)
522.0225Normal + Moderate (IN point)
622.0300Normal + Moderate (ON boundary)
722.0301Normal + Active (OFF boundary)
824.9225Normal + Moderate (ON BMI boundary)
925.0225Overweight + Moderate (OFF BMI boundary)
1029.9225Overweight + Moderate (ON BMI boundary)
1130.0225Obese + Moderate (OFF BMI boundary)
1235.0400Obese + Active (OUT point)

This gives comprehensive boundary coverage across the 2D input space.

When to Use Domain Analysis

Use domain analysis when:

  • Multiple input variables interact to determine behavior
  • Boundaries involve relationships between variables (x + y > limit)
  • The specification defines ranges or categories for inputs
  • You need to detect off-by-one, closure, and boundary shift errors

Prefer simpler BVA when:

  • Variables are independent (no interactions)
  • Single-variable boundaries are sufficient
  • Time constraints require a lighter approach

Key Takeaways

  • Domain analysis extends BVA to multi-variable input spaces
  • On points sit exactly on boundaries; off points are minimally across
  • Test 2 points per boundary (on + off) plus interior points = 2B + 1 minimum
  • Four error types: boundary shift, closure, missing boundary, tilted boundary
  • Build domain matrices to systematically vary one boundary while holding others at interior values
  • For multi-variable boundaries (x + y = C), test multiple on/off pairs to detect tilt errors
  • Domain analysis is most valuable when variables interact to define acceptance regions