Boundary Value Analysis Examples for QA Engineers
Boundary value analysis (BVA) is a test design technique that picks test inputs at the edges of valid ranges, because off-by-one mistakes such as > written instead of >= cluster there. Equivalence partitioning (EP) comes first: it splits all possible inputs into groups that the system should treat the same way, so you test one value per group instead of hundreds.
Used together, the two techniques give you a small, defensible set of test cases for any field that has a limit. Below are three worked examples (an age field, a password length and a discount tier), a way to handle decimals, and a short data-driven test you can run in CI.
1. Equivalence partitioning: group the inputs
The idea is simple: if the requirement says ages 18 to 60 are accepted, then 25, 31 and 44 are all expected to behave identically. Testing all three adds cost and almost no information. Divide the input space into partitions, then test one representative from each.
For a registration form that accepts an integer age from 18 to 60, the partitions are:
- Invalid, too low: 17 and below (including 0 and negative numbers)
- Valid: 18 to 60
- Invalid, too high: 61 and above
- Invalid, wrong type: empty, letters, symbols, decimals such as 18.5
Four partitions means four test cases at minimum, for example 10, 35, 75 and "abc". That already beats a dozen random guesses, because every case has a reason.
2. Boundary value analysis: test the edges
Developers rarely get the middle of a range wrong. They get the edges wrong: age > 18 instead of age >= 18, or a database column that is one character too short. BVA adds test values on and around each boundary of a partition.
For the 18 to 60 range there are two boundaries (the lower and upper limits), so the values are:
- Two-value BVA: 17, 18, 60, 61 (each boundary and its nearest neighbour in the other partition)
- Three-value BVA: 17, 18, 19, 59, 60, 61 (also the value just inside the valid range)
Two-value BVA is the usual starting point and is what the ISTQB syllabus describes first. Move to three-value BVA when the code around the boundary is complex or the feature is high risk, such as money or access limits.
3. Worked example: password length
Requirement: a password must be 8 to 64 characters. The partitions are shorter than 8 (invalid), 8 to 64 (valid) and longer than 64 (invalid). The boundary values are lengths 7, 8, 64 and 65.
- 7 characters: rejected, with a clear message
- 8 characters: accepted
- 64 characters: accepted
- 65 characters: rejected, or at least not silently truncated
Add the partition that people forget: the empty string, and a very long input such as 10,000 characters to see how the server copes. Also watch for the classic bug where the form says 8 to 64 but the API or database allows a different range. Test the UI and the API separately, because they often enforce different limits.
4. Worked example: discount tiers
Requirement for a checkout: orders under 100.00 get no discount, orders from 100.00 to 499.99 get 5%, and orders of 500.00 or more get 10%. There are two boundaries: 100.00 and 500.00.
With money, the "nearest value" is the smallest currency unit, 0.01. So the boundary values are:
- 99.99 → no discount
- 100.00 → 5%
- 499.99 → 5%
- 500.00 → 10%
Then check the edges of the whole range too: 0.00, a negative amount, and the largest order the system supports. Add one more case that is easy to miss: an order that reaches 100.00 only after a coupon or shipping is applied. The boundary depends on which amount the rule is evaluated against (before or after tax and shipping), so ask the product owner and write it into the test case.
5. Turn the table into automated tests
Boundary tests are a natural fit for data-driven automation, since the logic is identical and only the input and expected result change. With Playwright's parameterized tests, a list of cases becomes a list of test results (the endpoint here is illustrative):
const cases = [
{ age: 17, ok: false },
{ age: 18, ok: true },
{ age: 60, ok: true },
{ age: 61, ok: false },
];
for (const { age, ok } of cases) {
test(`age ${age} is ${ok ? "accepted" : "rejected"}`, async ({ request }) => {
const res = await request.post("/api/register", { data: { age } });
expect(res.ok()).toBe(ok);
});
}
Each failing case names the exact value that broke, which makes the bug report almost write itself. Run the file with the rest of your suite in the pipeline described in QA automation and security testing in one CI pipeline, so a changed limit fails the build instead of reaching users.
6. Common mistakes
- Testing only the valid middle. Values like 25 or 30 almost never find bugs. The invalid partitions and the edges do.
- Guessing the boundary. If the requirement doesn't state whether a limit is inclusive, ask. A vague requirement is itself a defect worth logging.
- Forgetting the layers. Check the same boundary in the UI, the API and the database. Client-side validation can be bypassed, and server-side limits can differ.
- Ignoring non-numeric boundaries. Dates (the last day of the month, 29 February), list sizes (zero, one, maximum items), file sizes and string lengths all have edges.
- Multiple fields at once. BVA treats each input on its own. When two fields interact, add decision tables or pairwise combinations on top.
The same edge-first thinking carries over to security testing, where limits and IDs are probed on purpose. For an example, see the IDOR testing checklist for QA engineers. And if you are building up your fundamentals, test design techniques are stage one in the QA automation and security testing career roadmap.
Key takeaways
- Equivalence partitioning groups inputs that behave the same, so you test one value per group.
- Boundary value analysis adds the values on and next to each boundary, where off-by-one defects live.
- Two-value BVA (17, 18, 60, 61) is the baseline, and three-value BVA adds extra coverage for risky features.
- For decimals and money, the step to the next value is the smallest unit, such as 0.01.
- Always include invalid partitions: empty, wrong type, negative and extremely large inputs.
- Put boundary cases in a data table and automate them so every limit change is caught in CI.
FAQ
What is the difference between boundary value analysis and equivalence partitioning?
Equivalence partitioning divides inputs into groups that should behave the same and picks one value per group. Boundary value analysis then adds the values at the edges of those groups. EP reduces how many cases you need, and BVA makes sure the riskiest ones are included.
How many test cases does boundary value analysis give for one range?
A single range with a lower and an upper limit gives four test values with two-value BVA (for 18 to 60: 17, 18, 60 and 61) and six with three-value BVA (17, 18, 19, 59, 60 and 61). Add one representative from the valid middle only if you want a baseline pass.
Can boundary value analysis be used for non-numeric inputs?
Yes. Anything with an order has boundaries: dates, string and file lengths, list sizes, time windows and quantities. For unordered inputs such as a country dropdown, use equivalence partitioning only. The ISTQB Foundation Level syllabus covers both techniques if you want the formal definitions.