Free tools

Boundary Value Analysis Calculator

Enter the valid range and the smallest step the input accepts. You get the boundary values to test, the equivalence partitions and a ready test table.

Runs in your browserNothing is uploadedNo sign-up

1 for whole numbers, 0.01 for cents.

2-value boundaries4

Each boundary and its closest neighbour outside the range.

ValueExpectedWhere
17Rejectmin - step
18Acceptmin
65Acceptmax
66Rejectmax + step

3-value boundaries6

Each boundary and both of its neighbours.

ValueExpectedWhere
17Rejectmin - step
18Acceptmin
19Acceptmin + step
64Acceptmax - step
65Acceptmax
66Rejectmax + step

Equivalence partitions

One representative per partition is enough for equivalence partitioning; the boundaries above test the edges.

PartitionRangeExampleExpected
Below the range< 18-6Reject
Valid range18 to 6542Accept
Above the range> 6589Reject

pytest

@pytest.mark.parametrize("age, is_valid", [
    (17, False),  # min - step
    (18, True),  # min
    (19, True),  # min + step
    (64, True),  # max - step
    (65, True),  # max
    (66, False),  # max + step
])
def test_age_boundaries(age, is_valid):
    assert accepts(age) is is_valid

Jest or Vitest

test.each([
  [17, false], // min - step
  [18, true], // min
  [19, true], // min + step
  [64, true], // max - step
  [65, true], // max
  [66, false], // max + step
])("accepts(%p) is %p", (age, isValid) => {
  expect(accepts(age)).toBe(isValid);
});

The generated tests call accepts(value); replace it with the function or request under test.

2-value and 3-value boundaries

Boundary value analysis tests the edges of a range, because off-by-one mistakes (< written for <=, a limit stored one too low) live there. The ISTQB Foundation syllabus defines two variants:

  • 2-value: each boundary value and its closest neighbour in the next partition. For a valid age of 18 to 65 that is 17, 18, 65 and 66.
  • 3-value: each boundary value and both of its neighbours: 17, 18, 19, 64, 65 and 66. The extra inner values catch a condition written as == 18 where >= 18 was meant, which 2-value analysis can miss.

The calculator also lists the three equivalence partitions (below, inside and above the range) with one representative each. Equivalence partitioning says one value per partition is enough to test the behaviour of the partition; the boundary values then test where the partitions meet.

The step decides the neighbours

The closest neighbour of a boundary is one step away, and the step is the smallest difference the input can express. Get it wrong and the test misses the bug:

InputValid rangeStep2-value boundaries
Age in whole years18 to 65117, 18, 65, 66
Price in cents0.01 to 100.000.010, 0.01, 100, 100.01
Discount in tenths of a percent0 to 500.1-0.1, 0, 50, 50.1

A step of 1 on a price field would test 101 and never 100.01, the value an off-by-one in the cents check lets through. The calculator works on whole numbers scaled by the step, so 0.1 + 0.2 comes out as 0.3, not 0.30000000000000004.

Using the generated tests

The pytest and Jest or Vitest blocks list the 3-value set with the expected result for each value. They call accepts(value), a placeholder: replace it with the function, form submit or API call under test. For a value the input should reject, also check how it rejects (an error message, a 400 response), not only that it does.

Ranges are rarely the only rule. A field can have a length limit, a format and a required flag on top; run boundary analysis on each numeric rule, and use the pairwise test generator when several inputs interact.

Sources

Get new posts by email.

Occasional email with new Testland posts and plugin releases.

Unsubscribe any time. Privacy policy