Stop 02 · Manual Testing FundamentalsTopics · 4/11

Equivalence Partitioning & Boundary Value Analysis

Part of the QA Testing Roadmap

In short

An age field accepting 18 to 60 has thousands of possible inputs. With two simple techniques, about eight tests cover it properly.

Equivalence partitioning groups inputs into classes that should behave the same way (testing one representative per class); boundary value analysis specifically tests the edges of those classes, where bugs cluster most often.

The purple blob sits in an auto-rickshaw tapping the fare meter on the dashboard.

Think of it like this

The auto fare meter

An auto charges a minimum fare for the first stretch, then per kilometre. You don't test every 100 metres. You test one ride inside each fare band, then rides right at the edge where one band switches to the next.

Watch it happen

Age field: valid from 18 to 60

5
0
17
1
18
2
19
3
35
4
59
5
60
6
61
7
80
8

1/5Three partitions: below 18 (invalid), 18 to 60 (valid), above 60 (invalid). Every value in a partition should behave the same.

The big ideas

What you need to know

Partitions behave alike

If 25 works, 30 almost certainly works too. Test one value per group.

Edges break most often

Off-by-one mistakes like < vs <= only show up at the exact boundary value.

Don't forget invalid types

Letters, decimals, negatives, spaces and an empty field are partitions too.

See it in code

Walk through the code

python
1import pytest2from signup import is_valid_age3 4@pytest.mark.parametrize("age, ok", [5    (17, False), (18, True), (19, True),   # lower edge6    (59, True), (60, True), (61, False),   # upper edge7    (5, False), (35, True), (80, False),   # one per partition8])9def test_age_limits(age, ok):10    assert is_valid_age(age) == ok

1/4parametrize runs the test once per tuple in the list.

One pytest function runs all nine cases. Each tuple is an input and the expected verdict.

Save yourself the pain

Common mistakes

Oops

Testing only 18 and 60 for the boundaries.

Do this instead

Test both sides of each edge too: 17 and 19, 59 and 61.

Oops

Testing ten values that all sit in the same valid partition.

Do this instead

Those ten tests find the same bugs as one. Spend them on edges and invalid groups.

Your mission

Partition a password field

~20 min

Quick check

A field accepts quantities from 1 to 10. Which set is the best boundary value test?

Go deeper

  1. 1Apply equivalence partitioning to a sample input field (e.g. an age field accepting 1-120).
  2. 2Identify the boundary values for that same field and design test cases around them.
  3. 3Learn why off-by-one errors make boundaries the highest-value place to focus testing.

More topics at this stop

Stuck on this topic? Ask an Insider

Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.

Download
InsideEdge