Boundary Value Analysis & Equivalence Class Testing

Boundary Value Analysis & Equivalence Class Testing

Verified Sources
Sep 12, 2026

Boundary Value Analysis (BVA) and Equivalence Class Testing (also called Equivalence Partitioning) are black-box test design techniques used to systematically select a small set of tests that is likely to expose defects near “interesting” input conditions. In practice, you combine them: equivalence classes define which input behaviors are similar, while boundary value analysis targets where errors often occur—typically at edges of valid/invalid ranges.

Core ideas:

  • Equivalence class testing partitions the input domain so one test per class can represent the class’s behavior.
  • Boundary value analysis focuses on the values at the boundaries between classes (e.g., min/max of valid ranges, just inside/outside).
  • Both assume the specification defines input domains and expected outcomes for each domain.

Mermaid overview of how they relate:

Boundary Value Analysis & Equivalence Partitioning (Tutorial)

Key concepts and vocabulary

You’ll get more consistent test designs if you explicitly capture the boundaries and classes in a small table before writing test cases.

  1. Input domain: the full set of possible input values.
  2. Valid equivalence class: inputs that satisfy constraints.
  3. Invalid equivalence class: inputs that violate constraints (type, range, format).
  4. Boundary value: e.g., min valid, max valid, and neighboring invalids.

Pro Tip: when the specification says something like “1x101 \le x \le 10”, treat the boundaries as separators between valid and invalid behaviors: x=1x=1 and x=10x=10 are valid boundaries; x=0x=0 and x=11x=11 are invalid just outside.

Pro Tip: Translate specs into class boundaries

For every stated constraint (range, length, allowable set), write: (1) valid min/max, (2) invalid just outside, (3) invalid inside (if the spec has holes). This turns BVA into a repeatable checklist.

Step-by-step: Equivalence Class Testing (ECT)

Equivalence Class Testing reduces redundant testing by assuming that inputs within the same class produce equivalent outcomes.

Process

Deriving tests using equivalence classes

  1. 1
    Step 1

    Identify every input parameter and list constraints from the specification (ranges, lengths, formats, required/optional fields).

  2. 2
    Step 2

    For each constraint, create classes for valid inputs and invalid inputs (e.g., below min, above max, wrong type/format).

  3. 3
    Step 3

    Write what the system should do for each class: accept and produce a result, or reject with a particular error/exception.

  4. 4
    Step 4

    Pick one representative value from each class. For large classes, choose convenient values (e.g., min valid, mid valid, min invalid).

  5. 5
    Step 5

    If there are multiple parameters, decide whether to (a) apply ECT per-parameter first or (b) use pairwise/combinational selection to cover meaningful interactions.

  6. 6
    Step 6

    Run the selected tests and verify that actual behavior matches expected behavior for the class.

Step-by-step: Boundary Value Analysis (BVA)

Boundary values often trigger off-by-one errors, incorrect comparisons, rounding issues, and boundary-condition bugs.

How to pick boundary tests

Common boundary patterns:

  • Valid boundary points: min and max of valid ranges.
  • Invalid boundary points: just below min and just above max of valid ranges.
  • Transition boundaries: if constraints are based on categories (e.g., “letters” vs “digits”), test edges between categories.
  • Multiple ranges / holes: if valid is a union of intervals (e.g., x[1,3][7,9]x \in [1,3] \cup [7,9]), test at each interval edge and the gap boundaries.

Deriving tests using boundary value analysis

  1. 1
    Step 1

    Locate every numeric/string boundary from the spec: range endpoints, length limits, and allowable/forbidden sets.

  2. 2
    Step 2

    For each valid interval, define neighbors just inside and just outside (e.g., minmin, min1min-1, maxmax, max+1max+1 for integers; adapt for real numbers).

  3. 3
    Step 3

    Choose tests at: valid min, valid max, and at least one invalid point below and one invalid point above.

  4. 4
    Step 4

    If the system parses input (string-to-number, locale-specific formats), include boundary tests that target parsing transitions (e.g., empty string, whitespace, non-numeric).

  5. 5
    Step 5

    If an invalid boundary value is already represented by an equivalence-class test, you may reuse it—but ensure expected outcomes align with the boundary intent.

  6. 6
    Step 6

    Verify outputs/errors are correct at each edge; boundary failures often show up as wrong comparisons or wrong error classification.

Warning: “Just outside” depends on the spec and type

If inputs are integers vs floats, “1-1” style neighbors may not apply literally. Decide the neighbor values that represent the closest invalid conditions allowed by the input type and constraints.

Worked example (range constraint)

Assume a specification:

  • For an integer input xx: accept only if 1x101 \le x \le 10, otherwise reject.

Equivalence classes

  • Valid class: x[1,10]x \in [1,10]
  • Invalid class: x0x \le 0 or x11x \ge 11

A simple ECT set might be:

  • one valid representative: x=5x=5
  • one invalid representative: x=0x=0 (or x=11x=11)

Boundary value analysis set

BVA would emphasize edges:

  • valid boundaries: x=1x=1, x=10x=10
  • invalid neighbors: x=0x=0, x=11x=11

Combined strategy

A combined set could be: x{1,5,10,0,11}x \in \{1, 5, 10, 0, 11\}—this covers:

  • class representatives (ECT) to verify “typical” valid behavior
  • boundary edges (BVA) to detect off-by-one and comparison faults

Mermaid traceability:

Coverage intent: ECT vs BVA (conceptual)

Higher score means the technique is strongly aimed at that risk/region.

How these techniques fit into test design

Specification reading

1) Extract constraints

Identify all input parameters, legal ranges, and forbidden values."

Equivalence Class Testing

2) Partition

Group inputs into classes with similar expected behavior; pick representatives."

Boundary Value Analysis

3) Edge focus

Choose tests at and around boundaries between valid and invalid regions."

Run and evaluate

4) Execute

Compare outputs/errors with expected results for each class and boundary."

Common pitfalls & guidance

ECT & BVA Quick Recall

1 / 4
Question · Term

What is an equivalence class?

Click to reveal
Answer · Definition

A set of inputs expected to produce similar behavior according to the specification.

Knowledge Check

Question 1 of 4
Q1Single choice

Equivalence Class Testing (ECT) primarily helps you reduce testing effort by: