Back To Blogs

Boundary Value Analysis and Equivalence Partitioning, Explained With Examples

You can't test every possible input. A quantity field that accepts 1–99 has 99 valid values and an infinite number of invalid ones. Equivalence partitioning and boundary value analysis are the two techniques that let you test it thoroughly with a handful of cases. They also appear in almost every ISTQB exam and QA interview.

Equivalence partitioning (EP)

The idea: split the inputs into groups (partitions) that the system should treat the same way. If one value in a group works, the others probably do too; if one fails, the others probably fail the same way. So you test one value per partition.

Example: quantity field, valid range 1–99

PartitionExample valueExpected
Below range (≤ 0)-5Rejected
Valid (1–99)40Accepted
Above range (≥ 100)150Rejected
Not a number"abc"Rejected
Empty""Rejected or default to 1
Decimal2.5Rejected or rounded (check the spec)

Six tests cover the main behaviours. Notice the partitions that aren't about the range at all, like type, emptiness and decimals. Those are often where bugs hide.

Boundary value analysis (BVA)

Bugs cluster at the edges of partitions, because that's where developers write < instead of <=, or count from 0 instead of 1. BVA tests the values on and right next to each boundary.

For a valid range of 1–99:

  • Two-value BVA: 0, 1, 99, 100
  • Three-value BVA: 0, 1, 2, 98, 99, 100

Two-value BVA catches most off-by-one errors; three-value adds a check just inside each edge.

Worked examples

Age gate: must be 18 or older

  • Partitions: under 18 (rejected), 18 and over (accepted), invalid (negative, non-numeric, absurd like 200)
  • Boundaries: 17, 18 (and 19 for three-value)
  • Don't forget the date version: if age comes from a birth date, test someone whose 18th birthday is today, tomorrow and yesterday.

Room capacity: a room holds 6 people

  • Boundaries: 6 guests (accepted), 7 guests (rejected); also 0 and 1
  • A classic off-by-one: the code checks guests > capacity + 1, or uses <= where it should use <, so 7 people get booked into a 6-person room.

Opening hours: bookings between 08:00 and 20:00

Time ranges have two edges, the start and the end of the booking:

  • Start at 07:59 (rejected), 08:00 (accepted)
  • Ending exactly at 20:00 (accepted), ending at 20:01 (rejected)
  • A 2-hour booking starting at 19:00 ends at 21:00, past closing. Systems often check only the start time.

Password length 8–64

Test 7, 8, 64 and 65 characters, plus empty. Also check whether leading or trailing spaces count toward the length.

Combining EP and BVA

In practice you use both together:

  1. List the partitions (valid and every kind of invalid)
  2. Pick one representative from each partition
  3. Add boundary values for every ordered range
  4. Remove duplicates

For the 1–99 quantity field you get roughly: -5, 0, 1, 40, 99, 100, "abc", "". That's eight tests that would catch most bugs in that field.

Beyond numbers

Boundaries exist everywhere:

  • Dates: today, end of month, 29 February, the daylight-saving switch, the last bookable day
  • Lists: empty, one item, the maximum page size, one more than the page size
  • Money: 0.00, the smallest unit (0.01), discount thresholds ("free shipping over $50": test $49.99 and $50.00)
  • Text: empty, max length, max length + 1, emoji and accented characters

Practise on real off-by-one bugs

The quickest way to make these techniques second nature is to use them on an app with real boundary bugs. In QAUnlocked Practice Labs, the BookIt booking app hides defects at exactly these edges (capacity, opening hours, dates in the past), and the store lab has a quantity field worth testing at 0 and -1. Try the techniques above and see how many you catch.

test designboundary value analysisequivalence partitioningISTQB

Comments

0 Comments

Be the first to comment.