
In short
- Equivalence partitioning splits every possible input into groups the software should treat the same way, so one test per group is enough.
- Boundary value analysis then tests the edges of those groups, because that is where off-by-one mistakes live.
- Used together they cut a field with thousands of possible values down to about ten tests that matter.
On this page
- 01Equivalence partitioning: one test per group
- 02Boundary value analysis: test the edges
- 03The step size decides what "next to" means
- 04Boundaries that are not numbers
- 05Turning it into automated tests
- 06Mistakes that make these techniques miss bugs
- 07When rules start to combine
- 08Frequently asked questions
A sign-up form says you must be between 18 and 65. A developer writes the check as age > 18. Somebody tests it with 30, sees it accepted, tests 12, sees it rejected, and marks it done. The form ships, and every 18-year-old who tries to sign up gets turned away.
Nothing about that test was lazy. It just used the wrong numbers. 30 and 12 are nowhere near the place the code can go wrong. The mistake sits exactly on the line, at 18, and only a test that lands on 18 will see it.
That is the whole idea behind the two techniques in this guide. Equivalence partitioning tells you which groups of inputs are worth one test each. Boundary value analysis tells you which exact values to pick at the edges of those groups. They are taught together because they are almost always used together.
Predict it
A field accepts ages 18 to 65. You can run one test. Which value is most likely to find a bug?
01Equivalence partitioning: one test per group
An age field can receive any whole number, plus things that are not numbers at all. You cannot test all of them. You do not need to, because the software treats most of them the same way. Every age from 19 to 64 goes down the same code path. If 40 works, 41 will almost certainly work too.
So you split the possible inputs into partitions: groups where every member should get the same result. Then you test one value from each. Write down the invalid groups as carefully as the valid one. They are where input handling usually breaks.
| Partition | Example value | Expected result |
|---|---|---|
| Valid: 18 to 65 | 40 | Accepted |
| Too young: below 18 | 10 | Rejected, with a message saying why |
| Too old: above 65 | 80 | Rejected, with a message |
| Negative numbers | -5 | Rejected |
| Decimals | 30.5 | Rejected, or rounded if the spec says so |
| Not a number | abc | Rejected |
| Empty | (blank) | Rejected as required |
Seven tests instead of an infinite number. Notice that the decimal row says "or rounded if the spec says so". Partitioning forces questions like that into the open. If nobody knows what 30.5 should do, you have found a gap in the requirements before writing a single test, which is the cheapest time to find one.
02Boundary value analysis: test the edges
Partitions have edges, and edges are where programmers slip. > instead of >=. A loop that runs one time too many. A limit copied from an old version of the spec. Boundary value analysis says: for each edge, test the values on it and right next to it.
There are two common ways to do it. Both are in the ISTQB Foundation syllabus, so you will see both names in interviews.
| Approach | Values per boundary | For 18 to 65 | When to use it |
|---|---|---|---|
| 2-value | The boundary and its nearest neighbour outside | 17, 18, 65, 66 | Most everyday fields |
| 3-value | Just below, on, and just above | 17, 18, 19, 64, 65, 66 | Money, safety, anything where a wrong edge is expensive |
The 3-value version adds 19 and 64. Those catch a different mistake: a check written as age == 18 || age > 19, or a range that accidentally excludes the first valid value after the edge. It costs two more tests. For a payment limit, that is a bargain.
Try it
Boundary value calculator
Enter an inclusive range and the smallest step. Try 50, 1000 and 0.01 for a money field.
2-value boundary tests
3-value boundary tests
03The step size decides what "next to" means
For whole-number ages, the neighbour of 18 is 17. For money it is not. Take a common rule: free shipping on orders of $50 or more. Prices move in cents, so the values to test are $49.99, $50.00 and $50.01. Testing $49 and $51 skips right over the place where a rounding bug would show up.
Ask what the smallest step is before you pick values. Cents for money. One character for text length. One second, or one day, for time. If the spec does not say, ask. "Orders over $50" and "orders of $50 or more" are different rules, and the difference is exactly one boundary test.
04Boundaries that are not numbers
The technique is usually taught with numbers, but most real boundaries are hiding somewhere else.
- Text length. A password of 8 to 64 characters gives you 7, 8, 9, 63, 64 and 65. Also try a string made of spaces, and one with emoji. In JavaScript
"😀".lengthis 2, so a "64 character" limit can reject 33 emoji. Decide which way it should count, then test it. - Lists and pages. An API that returns 50 items per page has boundaries at 0 items, 1 item, 50 items and 51 items. The 51st item is where "next page" logic tends to fall over.
- Files. An upload limit of 10 MB needs a file just under, exactly at, and just over. Check whether the system means 10,000,000 bytes or 10,485,760.
- Dates and times. The last day of the month, 29 February, 31 December into 1 January, and midnight in a time zone other than the server's.
- Limits nobody wrote down. Database columns (
VARCHAR(50)), rate limits, retry counts, session timeouts. These are often stricter than the form in front of them, so a value the screen allows can still fail when it is saved.
05Turning it into automated tests
Partition and boundary tests are perfect for parameterised tests: one test body, many rows of data. Each row reads like a line from the table above, which makes the suite easy to review.
import pytest
from signup import validate_age
@pytest.mark.parametrize("age, accepted", [
(17, False), (18, True), (19, True), # lower boundary
(64, True), (65, True), (66, False), # upper boundary
(40, True), # valid partition
(-5, False), (30.5, False), # invalid partitions
("abc", False), (None, False),
])
def test_age_rules(age, accepted):
assert validate_age(age).accepted is acceptedEleven rows, and every one of them earns its place. If a row fails, its comment tells you which rule broke without opening the code.
06Mistakes that make these techniques miss bugs
- Only testing the valid partition. The happy path is the part users exercise for you. The invalid partitions are where your tests add value.
- Trusting "between". "Between 18 and 65" does not say whether 18 and 65 are included. Get the answer in writing, then test both edges.
- Picking boundaries from the screen, not the system. The form may allow 100 characters while the database stores 50. Test the tightest limit along the whole path.
- Ignoring the step size. Testing 49 and 51 for a $50 rule leaves the actual boundary untested.
- Ten tests in one partition. 40, 41, 42 and 43 all prove the same thing. Spend those tests on edges and invalid groups instead.
07When rules start to combine
These techniques look at one input at a time. Real features rarely stop there. Free shipping might also depend on membership, the delivery country and the weight of the parcel. Once two or three rules interact, a decision table is the next tool: it lists every combination of conditions and the outcome each one should produce. Partitioning and boundaries still decide which values go into each column.
Before you call a field tested
- Listed every valid and invalid partition, including empty and wrong type
- Confirmed whether each boundary value is included or excluded
- Found the step size (cents, characters, seconds) and picked neighbours with it
- Tested both edges of every range, not just the lower one
- Checked limits behind the screen: database, API, file size
- Covered values that change after input, like totals after a discount
- Turned the table into parameterised tests with one row per case
Frequently asked questions
What is the difference between boundary value analysis and equivalence partitioning?
Equivalence partitioning divides inputs into groups that should behave the same, and tests one value from each group. Boundary value analysis tests the values at and next to the edges of those groups. Partitioning keeps the number of tests small; boundaries catch off-by-one mistakes that a middle value never would.
Should I use 2-value or 3-value boundary value analysis?
Use 2-value for most fields. Switch to 3-value when a wrong edge costs real money or safety, such as payment limits, dosages or credit decisions. It adds one extra test per boundary.
Does boundary value analysis only work for numbers?
No. Any input with an ordered range has boundaries: text length, list sizes, file sizes, dates and times, page numbers and retry counts. These non-numeric boundaries are often where the most interesting bugs are.
How many test cases does boundary value analysis produce?
For one range with two edges, four tests with the 2-value approach and six with the 3-value approach, plus one test per invalid partition. A typical form field ends up with eight to twelve tests.
Are these black-box techniques?
Yes. Both are designed from the specification, without reading the code, which is why they are covered in the ISTQB Foundation syllabus under black-box test techniques. Knowing the code can still help you find hidden limits, like a database column size.
Written by
Vihari Panyam
QualityAIQ