Home / BA / Boundary Value Analysis

# Boundary Value Analysis

```Introduction

Boundary value analysis, tests the functionality of a program at the extreme boundaries. When checking a range of values, after selecting the set of data that lie in the valid partitions, next is to check how a peace of code behaves at the boundary values of the valid partitions. BVA is most common when checking a range of numbers.

In a test case,there will be two boundaries, the lower boundary and the upper boundary , the boundaries are the beginning and end of each valid partition. We should design test cases which exercises the program functionality at the boundaries, and with values just inside and just outside the boundaries.

BVA Example

In a  functionality which accepts a set of numbers in the range -1000 to +1000, there would be three sets of equivalent partitions: these are -100 to -1, the negative range
0, Zero and 1 to 100, the positive range.

For each set,there are minimum and maximum values at each boundary. For the negative set the lower boundary is -100 and the upper boundary is -1. At each boundary, three conditions should be checked.

-1001, -1000, -999 … … … … … … -2, -1,

0, -1, 0, +1

0, 1, 2 … … … … … … 999, 1000, 1001

You have noticed that by selecting values at the boundaries for each partition there are some values that coincides. That is they appear in our conditions when we check the boundaries. We should of course eliminate those values to avoid unnecessary test cases.

Another worthy note to consider is that because the range goes from -1000 to +1000, then effectively, the values -2, -1 and -999 are considered as equivalent. That is, the behavior of the system is the equal when testing with values -999, -2 and -1.
.

Therefore, our list of final data to check at the boundaries are as follows:

-1001, -1000, -999 … … … … … … 0 … … … … … … 999, 1000, 1001

If our range of data was from 0 to +100 then the boundary value analysis would give us the following values to test:

-1, 0, 1 … … … … … …, 10, 11

It is to be noted  that BVA can be applied to decimal numbers as well as integers. The only difference is that when analyzing boundaries for decimal numbers, we should test to the nearest decimal point.

Example, if we have a range from 4.5 to 8.9, then the set of boundaries becomes

4.4, 4.5, 4.6 … … … … … … 8.8, 8.9, 9.0``` 