BVA (Boundary Value Analysis)
What is Boundary Value Analysis?
Boundary Value Analysis (BVA) is a black box test design technique based on the observation that defects often occur at the boundaries of input ranges rather than in the middle.
How BVA Works
For a given valid range, testers create test cases for values:
- Just below the minimum boundary.
- At the minimum boundary.
- At the maximum boundary.
- Just above the maximum boundary.
For example, for an input field accepting values from 1 to 100, BVA would test 0, 1, 100, and 101.
Why BVA is Effective
Boundary conditions are a common source of off-by-one errors and incorrect comparison operators (e.g., using < instead of <=), making BVA a highly efficient technique for catching real defects with relatively few test cases.
Two-Value and Three-Value Boundary Testing
There are two common ways to apply the technique. Two-value BVA tests each boundary plus its nearest neighbour on the other side, which is the 0, 1, 100, 101 set for a 1 to 100 range. Three-value BVA also adds the value just inside each boundary, giving 0, 1, 2 and 99, 100, 101.
The extra values catch a specific bug. Imagine a developer wrote value == 1 where value >= 1 was intended. Testing 1 passes and testing 0 correctly fails, so two-value BVA misses it. Testing 2 reveals that a perfectly valid value is rejected. Use three-value BVA for high-risk fields such as payment amounts or age checks that carry legal meaning.
Worked Example: A Loan Application Form
Say a form has these rules: applicant age 21 to 60, loan amount 50,000 to 5,00,000, and a password of 8 to 16 characters. Boundaries exist for every one of them, including the text length.
| Field | Below min | Min | Max | Above max |
|---|---|---|---|---|
| Age | 20 | 21 | 60 | 61 |
| Loan amount | 49,999 | 50,000 | 5,00,000 | 5,00,001 |
| Password length | 7 chars | 8 chars | 16 chars | 17 chars |
When testing invalid values, change one field at a time and keep the others valid. If a test uses age 20 and a 17-character password together, and the form rejects it, you cannot tell which rule did the rejecting. The usual design is one test where all fields sit at valid boundaries, then separate tests where exactly one field crosses its boundary.
Boundaries People Forget
- Decimal precision: if amounts have two decimals, the value just below 50,000 is 49,999.99, not 49,999.
- Dates: the last day of a month, 29 February, and the cut-off time of a daily deadline.
- Collections: an empty cart, a cart with one item, and a cart at its maximum allowed size.
- Output boundaries: a discount that should cap at a maximum value, or a page that shows exactly the number of results that fills one page.
Using BVA Alongside Partitioning
BVA picks values at the edges; equivalence partitioning picks one value from the middle of each class. Together they give a compact, well-reasoned set: first split inputs into valid and invalid classes, then test the edges of every class that has a range. For the age field above, that means a middle value like 40 from the valid class plus the four boundary values.
Mistakes and a Short Checklist
- Testing only the valid boundaries and skipping the invalid side, which is where most off-by-one bugs show up.
- Guessing boundaries instead of reading them from the requirement. If the requirement says "up to 60", ask whether 60 itself is allowed.
- Applying BVA to fields with no ordered range, such as a list of city names, where it adds nothing.
Checklist: list every field with a range, confirm inclusive or exclusive limits, write the boundary values for each, vary one invalid field per test, and record the expected error message for every rejected value.
Ready to master real-world software testing?
Learn manual and automation testing hands-on with mentor-led sessions.