# 5 Boundary Value Analysis Examples

Posted on Dec 17 2012 - 11:13am by Raj
Categorized as
3960

Bounday value analysis is a test case design technique in software testing. This covers the known areas of frequent problems at the boundaries of software component input ranges. Experience has shown that the boundaries of input and output ranges of a software component are common locations for errors that result in software faults. Boundary value analysis assists with the design of test cases that will exercise these boundaries in an attempt to uncover faults in the software during the testing process.Applying boundary value analysis you have to select now a test case at each side of the boundary between two partitions. The boundary value analysis can have 6 text cases: n, n-1, n+1 for the upper limit and n, n-1, n+1 for the lower limit. The best way to learn boundary value analsysis is by going though some examples. In this artticle we will cover 5 such examples of BVA: 1) Order numbers on a purchase control system can range between 10000 and 99999 inclusive. Which of the following inputs might be a result of designing tests for only valid equivalence classes and valid boundaries?

a) 1000, 50000, 99999
b) 9999, 50000, 100000
c) 10000, 50000, 99999
d) 10000, 99999, 100000

2) An input field takes the year of birth between 1900 and 2004
The boundary values for testing this field are
a. 0,1900,2004,2005
b. 1900, 2004
c. 1899,1900,2004,2005
d. 1899, 1900, 1901,2003,2004,2005

3) To test the password field which accepts minimum of 6 characters and Maximum of 12 Characters.
To satisfy Boundary value, tester will have to write Test Cases considering values from  Valid region and each Invalid Region and Values which define exact boundary.
For our example we require 5 Test Cases
1. Consider password length less than 6
2. Consider password of length exactly 6
3. Consider password of length between 7 and 11
4. Consider password of length exactly 12
5. Consider password of length more than 12

4) More complex example:

For example, if a purchase is in the range of \$5 up to \$60 has no discounts, a purchase over \$60 and up to \$150 has a 5% discount, and purchases of \$151 and up to \$400 have a 10% discounts, and purchases of \$401 and above have a 15% discounts.

Now we can identify 4 valid equivalence partitions and 1 invalid partition as shown below.

Invalid partition=\$0.01%

Valid partition(No Discounts)=\$5-\$60

Valid partition(5%)=\$60-\$150

Valid partition(10%)=\$151-\$400

Valid partition(15%)=\$401 and above

From this above example we can identify the boundary values of each partition. We assume that two decimal digits are allowed.

Boundary values for Invalid partition: 0.00
Boundary values for valid partition(No Discounts): 5, 60
Boundary values for valid partition(5% Discount): 61, 151
Boundary values for valid partition(10% Discount): 151,400
Boundary values for valid partition(15% Discount): 401, Max allowed number in the software application

5) Input should be greater than equal to 10 and less than 50″

Probably you will write something like

if (input >=10 AND input <50)>10 AND input <50> Input value 10 in invalid now.

input <=10 AND input <50> Input value 9 is valid now.

input >=10 AND input <=50 —–> Input value 50 is valid now

input >=10 AND input >50 —–> Input value 49 is invalid now

Because it is very easy to introduce defects at boundaries, boundary values are important. So for the above example, at the minimum we should have following test cases for boundaries

9, 10, 11 and 48, 49, 50

lower_boundary – 1, lower_boundary, lower_boundary + 1 and upper_boundary – 1, upper_boundary, upper_boundary + 1