Tuesday, January 4, 2011

BBT Strategies: Boundary Value Analysis

Boundary Value Analysis

Boris Beizer, well-known author of testing book advises, “Bugs lurk in corners and congregate at boundaries.” Programmers often make mistakes on the boundaries of the equivalence classes/input domain. As a result, we need to focus testing at these boundaries. This type of testing is called Boundary Value Analysis (BVA) and guides you to create test cases at the “edge” of the equivalence classes. Boundary value is defined as a data value that corresponds to a minimum or maximum input, internal, or output value specified for a system or component. In our above example, the boundary of the class is at 50, as shown in Figure 3. We should create test cases for the Player 1 having $49, $50, and $51. These test cases will help to find common off-by-one errors, caused by errors like using >= when you mean to use >.

Boundary Value Analysis
Boundary Value Analysis. Test cases should be created for the boundaries (arrows) between equivalence classes

When creating BVA test cases, consider the following:
  • If input conditions have a range from a to b (such as a=100 to b=300), create test cases:
  1. immediately below a (99)
  2. at a (100)
  3. immediately above a (101)
  4. immediately below b (299)
  5. at b (300)
  6. immediately above b (301)
  • If input conditions specify a number of values that are allowed, test these limits. For example, input conditions specify that only one train is allowed to start in each direction on each station. In testing, try to add a second train to the same station/same direction. If (somehow) three trains could start on one station/direction, try to add two trains (pass), three trains (pass), and four trains (fail).

No comments: