Tuesday, July 16, 2013

How to do Boundary Value Analysis

How to do Boundary Value Analysis


Boundary value is a software design technique to determine the test cases covering off by one errors.

Boundary value analysis is a methodology for designing test cases that concentrates software testing effort on cases near the limits of valid ranges Boundary value analysis is a method which refines equivalence partitioning. Boundary value analysis generates test cases that highlight errors better than equivalence partitioning.

The purpose of boundary value analysis is to concentrate the testing effort on error prone areas by accurately pinpointing the boundaries of conditions,(e.g., a programmer may specify >, when the requirement states > or =).

To set up boundary value analysis test cases you first have to determine which boundaries you have at the interface of a software component.This has to be done by applying the equivalence partitioning technique. Boundary value analysis and equivalence partitioning are inevitably linked together. For the example of the month in a date you would have the following partitions:

 ... -2 -1  0 1 .............. 12 13  14  15 ..... 
      --------------|-------------------|---------------------
 invalid partition 1     valid partition    invalid partition 2

Applying boundary value analysis you have to select now a test case at each each side of the boundary between two partitions. In the above example this would be 0 and 1 for the lower boundary as well as 12 and 13 for the upper boundary. Each of these pairs consists of a "clean" and a "dirty" test case. A "clean" test case should give you a valid operation result of your program. A "dirty" test case should lead to a correct and specified input error treatment such as the limiting of values, the usage of a substitute value, or in case of a program with a user interface, it has to lead to warning and request to enter correct data. The boundary value analysis can have 6 testcases. n, n-1,n+1 for the upper limit and n, n-1,n+1 for the lower limit.

There are two steps to perform boundary value analysis:
1. Identify the equivalence classes.

2. Design test cases. 

Step 1.

Follow the same rules you used in equivalence partitioning. However, consider the output specifications as well. For example, if the output specifications for the inventory system stated that a report on inventory should indicate a total quantity for all products no greater than 999,999, then you d add the following classes to the ones you found previously:

 The valid class ( 0 < = total quantity on hand < = 999,999 )

 The invalid class (total quantity on hand <0)

 The invalid class (total quantity on hand> 999,999 )

Step 2.

In this step, you derive test cases from the equivalence classes. The process is similar to that of equivalence partitioning but the rules for designing test cases differ. With equivalence partitioning, you may select any test case within a range and any on either side of it with boundary analysis, you focus your attention on cases close to the edges of the range.

Rules for Test Cases

1. If the condition is a range of values, create valid test cases for each end of the range and invalid test cases just beyond each end of the range. For example, if a valid range of quantity on hand is -9,999 through 9,999, write test cases that include:
1.        the valid test case quantity on hand is -9,999
2.       the valid test case quantity on hand is 9,999
3.       the invalid test case quantity on hand is -10,000 and
4.       the invalid test case quantity on hand is 10,000
You may combine valid classes wherever possible, just as you did with equivalencepartitioning, and, once again, you may not combine invalid classes. DonĂ¯¿½t forget to consider output conditions as well. In our inventory example the output conditions generate the following test cases:
1.       the valid test case total quantity on hand is 0
2.       the valid test case total quantity on hand is 999,999
3.       the invalid test case total quantity on hand is -1 and
4.       the invalid test case total quantity on hand is 1,000,000
2. A similar rule applies where the, condition states that the number of values must lie within a certain range select two valid test cases, one for each boundary of the range, and two invalid test cases, one just below and one just above the acceptable range.

3. Design tests that highlight the first and last records in an input or output file. 

4.Look for any other extreme input or output conditions, and generate a test for each of them.


Software blogs

No comments:

Post a Comment