Boundary Value Analysis

Why defects often occur at boundaries and how to apply boundary value analysis to fields, ranges, and transition conditions.

Updated:

Contents

Boundary value analysis follows a simple, practical idea: errors often occur at range and condition boundaries. These are common locations for incorrect comparison operators, inclusive/exclusive boundary mistakes, and mishandling of empty or extreme values.

What counts as a boundary

  • →The minimum permitted value
  • →The maximum permitted value
  • →The value immediately before a boundary
  • →The value exactly at a boundary
  • →The value immediately after a boundary

Example

If passwords must contain 8 to 20 characters, useful candidates are lengths 7, 8, 9, 19, 20, and 21. These often provide more value than arbitrary lengths such as 11 and 14.

Where it is particularly useful

  • →Numeric ranges, limits, string lengths, and file sizes
  • →Dates and intervals: starts, ends, deadlines, and expiration
  • →Count limits: attempts, items, requests, and users
  • →Threshold-based business rules: discounts by amount, access by role, and status changes after conditions are met

Common mistakes

  • →Checking only boundary values and forgetting their neighbors
  • →Ignoring logical boundaries that are not explicitly numeric
  • →Overlooking inclusive versus exclusive conditions
  • →Treating BVA alone as sufficient for complex business logic
📏

Boundary analysis works particularly well with equivalence partitioning: identify partitions first, then strengthen coverage at their edges.

Worked boundary matrix: inclusive limits

Consider a separate training field that accepts an ASCII identifier of 8–20 letters, inclusive. All characters are otherwise valid; only length changes. ASCII is chosen so characters, bytes and code units do not introduce a second variable. This is a test-design exercise, not a password-security recommendation.

plain text
Length	Example	Expected
7	aaaaaaa	Reject: too short
8	aaaaaaaa	Accept
9	aaaaaaaaa	Accept
19	aaaaaaaaaaaaaaaaaaa	Accept
20	aaaaaaaaaaaaaaaaaaaa	Accept
21	aaaaaaaaaaaaaaaaaaaaa	Reject: too long

For this integer-length rule, a compact 2-value boundary set is 7, 8, 20, 21: it crosses each valid/invalid boundary. The 3-value set also includes the neighbor on the other side of each limit: 7, 8, 9 and 19, 20, 21. The latter can expose a defect affecting only the immediate valid neighbor. These sets do not cover every other input rule.

Exercise: quantity from 1 to 5

Assume a required integer quantity must be between 1 and 5 inclusive. Write the three-value boundary candidates before reading the answer. Keep “missing”, null, non-integer and nonnumeric inputs as separate checks; they are not represented by numeric boundary values.

plain text
Input	Expected
0	Reject
1	Accept
2	Accept
4	Accept
5	Accept
6	Reject

If a limit becomes exclusive, derive the expected results again from the new rule. For decimal values, timestamps or Unicode strings, first define the smallest relevant step and what the system actually measures. “One below” a date or a file-size limit has no precise meaning without a unit.

Continue learning

Equivalence partitioning

Test cases

Technique reference: ISTQB CTFL syllabus, sections 4.2 and 5.5. Examples above are original training scenarios.