Skip to content
faker.tools
All 79

Plate VIII · Localization, Edge Cases & Data Sanitizers

Boundary Value Generator

The values just inside and just outside every limit, each labelled accept or reject.

#CaseValueShould Accept
1below minimum0false
2minimum1true
3minimum + 12true
4midpoint50true
5maximum − 199true
6maximum100true
7above maximum101false
8zero0false
9negative-1false
10int32 maximum2147483647false
10 rows · 565 BGenerated in your browser · Boundary Value Generator

Boundary value analysis (BVA) is a test design technique that places test inputs at the edges of each valid range, because that is where off-by-one errors live. This generator produces those values for six data types — integers, floats, strings, dates, arrays and currency amounts — and labels each one with whether a correct implementation should accept it, so the output is a ready-made test table.

Enter a range of 1 to 100 and you get 0, 1, 2, 50, 99, 100 and 101. Then come the values outside your spec that real systems still receive: zero, negatives, the int32 and int64 maximums, numbers beyond JavaScript's safe-integer range, NaN, Infinity, -0, null, undefined and a missing key.

How to use it

  1. Pick a data type.
  2. Enter the lower and upper bounds from your requirement — or, for strings and arrays, the maximum length.
  3. Keep include null and empty cases on unless your input can never be absent.
  4. Export the table as JSON or CSV and feed it to a parameterised test, using the Should Accept column as the expected result.

What you can control

  • Integers: min−1, min, min+1, midpoint, max−1, max, max+1, zero, negative, int32 max, int64 max and an integer beyond Number.MAX_SAFE_INTEGER.
  • Floats: values just outside each bound, the smallest positive double, -0, Infinity, NaN, 0.1, the largest double and scientific notation.
  • Strings: empty, one character, maximum length and one over, padding, whitespace only, newlines, Unicode, HTML, a null byte and emoji.
  • Dates: leap day, 29 February in a non-leap year, 31 April, a DST spring-forward gap, a leap second, the Unix epoch, before the epoch, the 2038 overflow and 9999-12-31.
  • Arrays: empty, one element, maximum length and one over, duplicates, nested arrays, mixed types and an embedded null.
  • Currency: the integer cases plus leading zeros, a thousands separator and three decimal places.
  • null, undefined and an absent key for every type.

Using the table in a test

import json
import pytest

CASES = json.load(open("fixtures/quantity_boundaries.json"))  # exported from this tool

@pytest.mark.parametrize("case", CASES, ids=lambda c: c["Case"])
def test_quantity_validation(case, client):
    response = client.post("/cart/items", json={"sku": "ABC-1", "quantity": case["Value"]})
    assert (response.status_code == 201) == case["Should Accept"]

Each row becomes a named test — below minimum, int32 maximum, null — so a failure tells you exactly which edge broke. Values are exported as strings; convert them if your API is strict about JSON types, and give the missing key row a small branch that omits the field instead of sending it. The guide Boundary value analysis with examples goes further into choosing ranges and combining boundaries.

Testing ideas

  • Client and server separately. Run the table through the UI and directly against the API. A form that blocks 101 does not stop a script from sending it.
  • Type coercion. Send "100" as a string and 100 as a number. Loose comparison in JavaScript or PHP can accept one and reject the other.
  • Database limits. A VARCHAR(255) column with a 255-character UI limit still fails on a 255-character string of emoji in some collations. Use the string cases with the Unicode edge case generator.
  • Dates in your zone. The DST case is for US Eastern time; generate it again for each zone you serve.

What this is not

The generator cannot know your requirement — it trusts the bounds you enter. If the requirement itself is wrong (is 100 allowed or not?), the table will faithfully test the wrong thing. Agree on inclusive or exclusive bounds before you start.

Questions

What is boundary value analysis?

A test design technique that puts test cases at the edges of each valid range rather than in the middle, because off-by-one errors cluster there. For a field that accepts 1 to 100, the interesting values are 0, 1, 2, 99, 100 and 101 — not 50.

What is the difference between two-value and three-value boundary analysis?

Two-value BVA tests each boundary and its nearest invalid neighbour: 0, 1, 100 and 101 for a 1–100 range. Three-value BVA adds the nearest valid neighbour as well: 0, 1, 2, 99, 100 and 101. This generator produces the three-value set plus a midpoint.

Why are values like 2147483647 included?

They are the limits of common integer types: int32, int64 and JavaScript's safe-integer range. A field that validates 1–100 in the UI but parses into a 32-bit integer on the server can overflow before validation runs. They are labelled reject because they fall outside your range.

What does the Should Accept column mean?

It is the expected result for a correct implementation of the range you entered. Use it as the test oracle: if your code's answer differs from the column, either the code or the requirement is wrong.

How is this different from equivalence partitioning?

Equivalence partitioning picks one representative from each class of input — one valid, one too small, one too large. Boundary value analysis picks the values at the edges between those classes. They are complementary: partitioning gives you breadth, boundaries give you the off-by-one bugs.

Next in Edge cases

All 7 →