Tuesday, November 15, 2011

Boundary Value Analysis

Boundary Value Analysis is a Blackbox Testing Technique. It makes use of the fact that the inputs and outputs of the component under test can be partitioned into ordered sets with identifiable boundaries. Values in the same set will be treated in the same way. Test values are chosen that are just inside, on and just outside the boundaries.

For example, suppose an application collects some data about a traveller using the dialog box shown in the diagram. When the OK button is pressed the component calculates a fare from the current location using the input values.

The Discount Table

Age
Discount
0-4 years
100%
5-15 years
50%
16-64 years
0%
64 years and older
25%
There is a standard fare to each destination. Our travel service offers discounts to travellers based on their age. For example, children under 5 travel free and those over 65 get a 25% discount.
We can use boundary value analysis testing on the age field of our fare calculation component. We can partition the age input data into ordered sets using the data the Discount table. This gives us the following sets:
  • 0, 1, 2, 3, 4.
  • 5, 6, 7, …15.
  • 16, 17, 18, …64.
  • 65, 66, 67, …120.
  • Ages greater than 120 years.
It is often useful to draw these partitions as shown below.
 
Boundary value analysis requires us to identify the set boundaries. In our example, the boundaries are at ages: 0, 5, 15, 65 and 120. We then have to test values on and at either side of each boundary. So we test the component with ages:
  • -1, 0, 1.
  • 4, 5, 6.
  • 14, 15, 16.
  • 64, 65 66.
  • 119, 120, 121.
The component handles all values on the name field in the same way. As all values are treated the same, it is not possible to separate the name field values into separate sets so boundary value analysis cannot be performed on the name field.
Our application does treat different values in the destination field differently, based on region. However, it is not possible to identify boundary values for destination regions. Consequently, we are unable to perform boundary value analysis on the destination field.

0 comments:

Post a Comment