Wednesday, May 19, 2010

Software Testing 101: Boundary-value analysis

Welcome to Software Testing 101, a guild to assist in the testing of software. Today's topic, boundary-value analysis also known as boundary testing.

Boundary-value analysis is used to test the boundary of a process. For instance, say we have a process which can take inputs between 1 and 100. How can we test the process with the minimal amount of test cases (in most work environments it is hard enough to get enough time to test the cases needed).
What we want to do, to test this process, is to test the boundary or edge condition. The boundaries of this process are 1 and 100, therefore if we test integers around 1 and 100, we would be testing the boundary.

In order to test any boundary, fully, you would need three test cases:
  • Out side the boundary
  • Exactly on the boundary
  • In side the boundary
In this case for the lower bound of 1, we should test 0 (one out side of the boundary), 1 (exactly on the boundary), and 2 (one in side the boundary). Likewise for the upper bound of 100, we should test 99 (one in side the boundary), 100 (exactly on the boundary), and 101 (one out side of the boundary).

By using boundary-value analysis we are able to limit the number of test cases and fully test the boundary of a process.