Boundary Value Analysis: A Complete Guide

boundary value analysis guide

Boundary value analysis (BVA) is a black-box testing technique that targets the edges of input ranges, where defects tend to cluster. Learn how it builds on equivalence partitioning, with examples and best practices.

Key takeaways
The 30-second version of this article
Boundary value analysis is a black-box testing method that tests input values at, just below, and just above the edges of each range, because errors often occur at those edges rather than in the middle.
BVA builds on equivalence class partitioning: first group inputs into valid and invalid classes, then test the boundary points between those classes.
For an age field that accepts 18 to 60, the six key test values are 17, 18, 19, 59, 60, and 61, which cover both the lower and the upper boundary.
Look past the obvious limits by trying extreme inputs such as a negative age, a very large number, or a non-numeric value, and work with developers to learn how the code handles them.
When a range is split into segments such as 0 to 30 and 31 to 60, a value just above one boundary lands in the next segment, so pick test values that make sense for the segment you are testing.

Boundary Value Analysis (BVA) is a core software testing technique that focuses on testing the boundaries or edges of input ranges. It is based on the observation that errors often occur at the edges of input ranges rather than in the middle. By testing the extremes, BVA helps identify potential vulnerabilities and ensures that the system behaves correctly at its limits.

Since boundary value analysis is closely related to equivalence class partitioning (ECP), let's start with ECP first, then move on to BVA.

What Is Equivalence Class Partitioning?

Black box testing technique: equivalence class testing

Equivalence Partitioning Testing is a black-box testing method that divides input data into equivalent sets. The idea is that if one condition in the group passes or fails, the entire group will behave similarly. This significantly reduces the number of test cases while ensuring adequate test coverage.

Suppose you're testing a function that validates a user's age for an online registration form, with a valid age range of 18 to 60 years.

Here’s how you could create equivalence classes:

  • Valid Equivalence Class: Ages 18 to 60 [18-60]
  • Invalid Equivalence Classes:
    • Ages less than 18: [-∞ to 17]
    • Ages greater than 60: [61 to ∞]
    • Non-numeric inputs: ["abc", "#$%", etc.]

Now, let's select representative values from each class:

  • Valid class: 25 (within the valid range)
  • Invalid classes:
    • Less than 18: 17
    • Greater than 60: 61
    • Non-numeric: “abc”

From these, we can generate the following test cases:

  1. Test Case 1: Age = 25 (Expected: Valid)
  2. Test Case 2: Age = 17 (Expected: Invalid)
  3. Test Case 3: Age = 61 (Expected: Invalid)
  4. Test Case 4: Age = "abc" (Expected: Invalid)

What Is Boundary Value Analysis?

Black box testing technique: boundary value analysis

Boundary Value Analysis is a black-box testing method that aims to test the boundaries between equivalence classes. While Equivalence Class Partitioning only divides inputs into valid and invalid groups, BVA takes this a step further by testing only extreme values just below, just above, and at the defined boundaries. This helps ensure the system properly handles edge cases, which are often where software failures occur.

Let's go back to the previous example. You're testing a function that validates a user's age, with a valid age range of 18 to 60 years. We have the following equivalence classes already defined:

  • Valid Equivalence Class: [18–60]
  • Invalid Equivalence Classes:
    • Ages less than 18: [-∞ to 17]
    • Ages greater than 60: [61 to ∞]
    • Non-numeric inputs: ["abc", "#$%", etc.]

Boundary value analysis focuses on testing the boundaries of these ranges.

  • Just outside the lower boundary: 17
  • At the lower boundary: 18
  • Just above the lower boundary: 19
  • Just below the upper boundary: 59
  • At the upper boundary: 60
  • Just outside the upper boundary: 61

You now have 6 critical test cases, which cover the key points where errors are likely to occur.

Why Boundary Value Analysis Is Important

Testing within the range of valid inputs alone may not reveal issues that occur at the system’s extremes. For example, if the form accepts ages from 18 to 60 but fails to handle edge cases like 17 or 61 correctly, users may encounter problems at these boundaries. BVA ensures these edge cases are properly tested.

Going Beyond Simple Boundaries

Boundary value analysis doesn’t stop at obvious boundaries. Consider more extreme cases to ensure thorough coverage. For instance, what happens if someone enters an age of -3, 9,999,999, or a non-numeric value like “twenty-five”? Work with developers to understand how edge cases are handled in the code, so your boundaries are tested effectively.

Boundary Value Analysis Best Practices

Here are some best practices to follow when performing Boundary Value Analysis:

1. Identify Equivalence Classes

Begin by identifying the valid and invalid input ranges for your system. For instance, in the age validation example, the valid class is [18-60], and the invalid classes are those above 60, below 18, or non-numeric inputs.

2. Determine Boundaries

Once the equivalence classes are established, determine the boundaries for each class. For the age validation example, boundaries include 17, 18, 19, 59, 60, and 61.

3. Select Test Cases

Choose values that are at, just below, and just above each boundary. This ensures that edge cases are covered, where errors are most likely to occur.

How to Choose Values Above and Below Boundaries

When selecting values for boundary testing, consider how far above or below the boundary you should test. For example, if your input range is divided into multiple segments (e.g., [0-30], [31-60], [61-90]), selecting a value just above the boundary at 30 might mean crossing into the next range. Ensure that your selected boundary values are meaningful and within the context of the system.

Boundary Value Analysis vs. Equivalence Partitioning

While Equivalence Class Partitioning (ECP) focuses on grouping inputs into valid and invalid sets, Boundary Value Analysis takes this a step further by concentrating on the "edge" or boundary points of those sets. In a way, BVA is ECP taken to a more granular level. Testing just a few values at the edges often reveals more errors than testing random values within the middle of a class.

Conclusion

Boundary Value Analysis is an essential testing method that ensures systems behave correctly at the edges of input ranges, where errors are most likely to occur.

banner5.png

Frequently asked questions

Henrik (Minh Huy) Dao

Minh Huy Dao (Henrik) is a Senior Quality Engineer at Katalon, where he has worked since 2023. He has nearly 10 years of experience in QA and test automation, including roles at TMA Solutions, Axon Active and Doctor Anywhere. His work spans automation with Java, JavaScript and WebdriverIO, as well as CI/CD with Jenkins and leading Scrum teams.

Connect on LinkedIn →
Get started

Test everything. Ship with confidence.

From generating test cases to spotting failures, Katalon's AI works across your entire pipeline, automatically.

Live webinar

The Next Evolution of Manual Testing: Introducing Katalon AI Test Runner

Learn how to grow your QA team's capacity in the age of AI, then watch Katalon AI Test Runner turn manual test cases into automated runs, live.

2:00 to 3:00 PM IST
Almas AhmedSenior Account Manager
Sumit WankhedeSolutions Engineer Manager
Register now