Session 3.1 - Boundary Value Analysis

Module 3: Dynamic & Static Testing | Duration: 1 hour

Learning Objectives
  • Apply boundary value analysis to reveal failures at input and output limits.
  • Design normal and robust boundary test sets from requirements.
  • Trace each boundary test to an expected result and defect risk.

What Is Boundary Value Analysis?

Boundary Value Analysis (BVA) focuses tests around the edges of allowed ranges where defects are most likely: minimum, just above minimum, nominal, just below maximum, and maximum.

Why edges fail
Off-by-one logic, comparison mistakes (< vs <=), truncation, and rounding behavior frequently break at limits.
When to apply
Numeric ranges, date limits, text length constraints, file size limits, and threshold-based business rules.
Typical gain
High defect discovery with a small, systematic set of tests instead of random values.
Quick visual model

If input range is [10..50], boundary-focused values are:

9, 10, 11, 30, 49, 50, 51

Black-Box Testing Context

Before diving into BVA, it is important to understand where it fits. Black-box testing is a major dynamic testing technique that considers only the functional requirements of the software or module. The internal structure or logic of the software is not examined — the system is treated as a "black box".

Key point: Black-box testing does not look at how the code is written. It only checks whether the software produces the correct output for a given input, based on the specification.

The objectives of black-box testing include:

  • Testing modules independently for functional correctness.
  • Testing the functional validity of the software against requirements.
  • Looking for interface errors between components.
  • Testing system behavior and checking performance under load or stress.
  • Testing the software such that the user/customer accepts the system within defined acceptable limits.
Black-box testing techniques covered in this module:
  1. Boundary Value Analysis (BVA) — this session
  2. Equivalence Class Testing — Session 3.2
  3. State Table Based Testing — Session 3.2
  4. Decision Table Based Testing — Session 3.3
  5. Cause-Effect Graphing — Session 3.4
  6. Error Guessing — Session 3.4

Boundary Value Checking (BVC)

BVA is a technique that uncovers bugs at the boundary of input values. Here, boundary means the maximum or minimum value taken by the input domain.

Core idea: For any input variable with a range, the most error-prone values are at and around the edges. Instead of testing random values from the range, we systematically pick values at, just inside, and just outside the boundaries.

For example, if variable A is an integer between 10 and 255:

  • Boundary checking on the lower end: 9, 10, 11
  • Boundary checking on the upper end: 254, 255, 256

The standard boundary value checking approach for a single variable with range [min, max] uses these five test points:

Test PointValuePurpose
MinimumminLowest valid value
Just above minimummin + 1Confirms acceptance just inside lower bound
NominalA middle valueConfirms normal processing works
Just below maximummax - 1Confirms acceptance just inside upper bound
MaximummaxHighest valid value
Formula: For n input variables in a module, basic BVC generates 4n + 1 test cases. The "+1" accounts for the single test where all variables are at their nominal values simultaneously.

Robustness Testing

The basic BVC idea can be extended by considering values that exceed the boundaries:

  • A value just greater than the maximum value (max + 1)
  • A value just less than the minimum value (min - 1)

When test cases are designed considering these additional points beyond the valid range, it is called robustness testing.

Robustness test set for a single variable:
Test PointValueExpected
Below minimummin - 1Reject / Error
MinimumminAccept
Just above minimummin + 1Accept
NominalA middle valueAccept
Just below maximummax - 1Accept
MaximummaxAccept
Above maximummax + 1Reject / Error
Formula: For n input variables in a module, robustness testing generates 6n + 1 test cases. Each variable contributes 6 boundary points (min-1, min, min+1, max-1, max, max+1) plus 1 all-nominal case.
Why robustness matters: Many real-world defects occur because the code does not properly reject out-of-range inputs. A function might work perfectly for values within the range but crash, produce wrong results, or silently accept invalid values at min-1 or max+1. Robustness tests specifically target this.

Worst-Case & Robust Worst-Case Testing

Standard BVA varies one input at a time while keeping the others at nominal values. Worst-case testing takes a different approach: it considers what happens when multiple variables are simultaneously at their boundary values.

Worst-case testing: Instead of varying one variable at a time, the boundary values of all input variables are combined. For each variable, the test values are {min, min+1, nominal, max-1, max}, and the test set is the Cartesian product of all variables' boundary sets.

This is more thorough because defects sometimes only appear when multiple inputs are at extreme values simultaneously. For example, a calculation might work fine when one input is at its maximum, but overflow when two inputs are both at their maximum.

Formula: For n input variables, worst-case testing generates 5n test cases (5 values per variable, all combinations).

The worst case can be further extended if we add robustness. That is, if we consider the extreme values of the variables as in the robust testing method (7 values per variable: min-1, min, min+1, nominal, max-1, max, max+1), we get robust worst-case testing.

Formula: For n input variables, robust worst-case testing generates 7n test cases.
When to use each approach:
ApproachTest Cases (n vars)Best For
Normal BVC4n + 1Quick, low-risk modules
Robustness6n + 1Modules handling user input directly
Worst-case5nCritical modules where variable interactions matter
Robust worst-case7nSafety-critical or financial systems

Test Case Count Formulas

Understanding the formulas helps you estimate testing effort before you begin. Here is a quick-reference comparison.

Example: A module with 3 input variables
MethodFormulan = 3
Normal BVC4n + 14(3) + 1 = 13
Robustness6n + 16(3) + 1 = 19
Worst-case5n53 = 125
Robust worst-case7n73 = 343
Key takeaway: Normal BVC and robustness testing grow linearly with the number of variables, keeping test counts manageable. Worst-case methods grow exponentially and should be reserved for high-risk modules where the extra effort is justified.

Input Boundary Design

Start from each input domain and derive values around every range endpoint.

Standard 5-point boundary set (single variable)

min, min+1, nominal, max-1, max

Robust variant

min-1, min, min+1, nominal, max-1, max, max+1

  • Normal BVA: uses only valid range values.
  • Robust BVA: adds just-outside invalid values to confirm rejection.
  • Multiple inputs: vary one input at boundaries while keeping others nominal, then rotate.
Step-by-step recipe for any requirement
  1. Extract exact range and inclusivity from the requirement text.
  2. Mark min, max, and one nominal value.
  3. Create normal BVA tests first, then add robust invalid edges.
  4. Define expected outcome for each value before execution.
  5. Record observed behavior and map failures to root cause.

Output Boundary Checks

BVA also validates output limits, especially where formula outputs are capped, rounded, or bucketed.

Threshold labels
Validate transitions like Grade C to B at exact cutoff marks.
Capped calculations
Test around max output caps (e.g., discount capped at 500).
Precision edges
Check behavior at 2-decimal boundaries, rounding up/down, and format limits.
Example: Output capping rule

Final Discount = min(0.2 * amount, 500)

Boundary amounts near cap trigger: 2499, 2500, 2501. Verify displayed output stays at 499.8, 500, 500.

Illustrations & Examples

Use these examples to show students how BVA adapts across different data types.

Illustration A: Age field (18 to 60 inclusive)
Boundary ValueExpectedReason
17RejectBelow minimum
18AcceptMinimum valid
19AcceptMinimum + 1
59AcceptMaximum - 1
60AcceptMaximum valid
61RejectAbove maximum
Illustration B: Password length (8 to 16 chars)

Choose test strings by length, not meaning:

  • 7 chars: invalid (abc123!).
  • 8 chars: valid lower edge (abc123!@).
  • 16 chars: valid upper edge.
  • 17 chars: invalid upper overflow.
Illustration C: Grade boundaries

If grades are A: >=90, B: 80-89, C: 70-79, then critical tests are around 69/70, 79/80, and 89/90.

This shows students that boundaries are not only at global min/max, but also at internal decision thresholds.

Worked Example: Scholarship Eligibility Form

Requirement: Eligible if attendance is between 75 and 100 (inclusive) and CGPA is between 6.0 and 10.0 (inclusive).

Boundary Test Set (attendance only; CGPA nominal at 8.0)
Test ID Attendance Expected Purpose
BVA-0174Rejectmin-1 invalid
BVA-0275Acceptmin valid
BVA-0376Acceptmin+1 valid
BVA-0499Acceptmax-1 valid
BVA-05100Acceptmax valid
BVA-06101Rejectmax+1 invalid
Second pass: combine attendance and CGPA boundaries
Test IDAttendanceCGPAExpected
BVA-07755.9Reject (CGPA below min)
BVA-08756.0Accept (both at boundary)
BVA-0910010.0Accept (both at max boundary)
BVA-1010110.0Reject (attendance above max)
Defect patterns this catches
  • Incorrect exclusive checks such as attendance > 75 instead of >= 75.
  • Upper range leaks where values over 100 are accepted.
  • Wrong validation order causing crash/format errors at extremes.

Common Mistakes

Only testing valid values
Students often skip min-1 and max+1, missing rejection logic defects.
Ignoring inclusivity words
Words like "between", "up to", "at least" must map to precise operators.
No expected output defined
Without expected behavior per test, pass/fail judgement is ambiguous.
Testing random middle values
Nominal tests are useful, but boundaries should drive the first test set.

Class Activity

  1. Select one form field with a clear numeric/text limit (age, password length, marks, upload size).
  2. Write normal and robust boundary value sets.
  3. Execute each test and capture Pass/Fail with screenshot or log evidence.
  4. Map each failing case to likely root cause (comparison operator, parsing, rounding, cap rule).
Deliverable: A one-page boundary analysis sheet with requirement, boundary points, executed tests, and observed defects.
Evaluation rubric (10 marks)
  • 2 marks: Clear extraction of range and inclusivity.
  • 3 marks: Correct normal + robust test design.
  • 3 marks: Accurate expected results and execution evidence.
  • 2 marks: Root-cause reasoning for observed failures.

Exit Ticket

Use these 3 quick checks at the end of class to confirm learning.

  1. Requirement: allowed quantity is 1 to 25 inclusive. Write robust boundary values.
  2. If code uses if (score > 40) for pass rule "40 and above", which boundary fails?
  3. Name one difference between input boundary testing and output boundary testing.

Summary & Assignment

BVA is a focused, low-cost way to uncover limit-related defects in both inputs and outputs. Well-chosen edge tests significantly improve confidence in validation logic.

Assignment: Pick a module from your mini-project and prepare at least 12 boundary tests (normal + robust) for two critical input fields. Include expected output, actual result, and at least one defect report format entry.