What is Boundary value analysis?

A black-box testing technique that, because defects tend to cluster at the boundaries between equivalence classes, tests the values immediately on both sides of each boundary (for example 0, 1, 100 and 101 when 1 to 100 is accepted). It is good at finding errors such as confused comparison operators.

Japanese name: 境界値分析

Boundary value analysis appears in 3 practice questions across 1 topic, including Software Development and Project Management.

Field: Software Development and Project Management

Why test the boundaries

Conditional branches in programs are prone to errors such as confusing '<' with '<=' or '>' with '>=', or being off by one in an array index, and the effect appears only at boundary values. For example, if the specification says 'warn at 85 °C or higher' but the code says if (t > 85), it behaves as specified at 84 °C and 86 °C and fails to warn only at 85 °C. Testing only the middle value of each class with equivalence partitioning does not find such errors.

How to choose the values

When integer inputs from 1 to 100 are accepted, 0 and 1 are chosen at the lower boundary and 100 and 101 at the upper boundary. A finer variant tests each boundary value and both of its neighbors (0, 1, 2 and 99, 100, 101). When there are several categories, such as fee categories, values on both sides of every boundary where the category changes are chosen. For decimal inputs, the neighboring value is determined by the resolution set in the specification (such as steps of 0.1).

Boundaries in software close to hardware

Embedded software has many numerical boundaries in its specification, such as thresholds on ADC readings, the point where a timer counter wraps from its maximum to 0, the point where a buffer becomes exactly full, and the maximum packet length of a communication protocol. Calculation errors are likely around the overflow from 255 to 0 for an 8-bit counter, or the boundary between 32,767 and −32,768 for a 16-bit signed integer. Such boundaries are identified from both the numbers in the specification and the ranges of the data types.

Try it: questions about Boundary value analysis

A program sets the admission fee by age (an integer of 0 or more): ages 0 to 17 pay the child fee, 18 to 64 the adult fee, and 65 or older the senior fee. Which set of test values is most appropriate for boundary value analysis to check the boundaries where the fee category changes?

  1. A10, 40, 90
  2. B17, 18, 64, 65
  3. C18, 65
Show answer and explanation

Answer: B. 17, 18, 64, 65

Because defects tend to cluster at the boundaries between equivalence classes, boundary value analysis tests the values immediately on both sides of each boundary. At the child/adult boundary 17 and 18 are chosen, and at the adult/senior boundary 64 and 65, giving the four values 17, 18, 64 and 65. Errors such as writing '<' instead of '<=' in a condition may not be found by testing only one side of a boundary. 10, 40 and 90 are equivalence-partitioning values chosen as representatives of each category, and they cannot check errors at the boundaries.

FAQ

How should equivalence partitioning and boundary value analysis be used together?

They are usually combined. Equivalence partitioning divides the inputs into classes and tests a representative of each, and boundary value analysis adds tests on both sides of the class boundaries. Equivalence partitioning alone reduces the number of tests but tends to miss errors at the boundaries.

Is boundary value analysis a white-box testing technique?

It chooses values from the boundaries of the ranges written in the specification, so it is a black-box testing technique. However, some boundaries, such as array sizes and data type ranges inside the implementation, are not written in the specification, so values are sometimes added after looking at the source code.

Boundary value analysis in the explanations

Questions that mention Boundary value analysis (3)

  1. A program sets the admission fee by age (an integer of 0 or more): ages 0 to 17 pay the child fee, 18 to 64 the adult fee, and 65 or older the senior fee. Which set of test values is most appropriate for boundary value analysis to check the boundaries where the fee category changes?
  2. Which describes black-box testing?
  3. The specification says 'issue a warning if the temperature is 85 °C or higher', but the firmware mistakenly contains 'if (t > 85)'. The temperature t is an integer. Which of the following test values can detect this error?

Books on Software Development and Project Management Ad

As an Amazon Associate I earn from qualifying purchases.

Related terms

Black-box testing Equivalence partitioning White-box testing Agile development Branch coverage CI/CD (continuous integration and continuous delivery) Critical path method (CPM) Earned value management (EVM) Scrum SLA (service level agreement)

Back to the glossary