Tutorial-1: To Generate BVA Test Cases-For Tax Calculation Problem
Boundary Value Analysis is a data selection technique in which test data is selected from the “boundaries” of the input or output domain classes, data structures and procedure parameters. Selection mainly include the actual minimum and maximum boundary values, with a tolerance of (+ 1 or – 1) on the maximum and the minimum values.
Boundary Value Analysis is similar to Equivalence Partitioning, however it focuses on “Boundary or Corner Cases”.
Although according to Equivalence Partitioning definition, testing of one value from a particular class is equivalent to doing the testing of any other value from that particular class; since boundaries are more prone to errors, hence boundaries of equivalent classes need to be given more close consideration.
Following type of test cases utilizing boundary value analysis are considered for various range of values.
a) Two valid test cases covering extreme ends
b) Two invalid test cases immediately across the range limits
Letus take an example program where we consider “Pay” as an input having values 12000 to 35000 in the valid range. The program calculates the corresponding tax with following assumptions:1) Pay up to Rs. 15000 � Tax is Zero
2) Pay between 15001 and 25000 � Tax is 18 % of Pay
3) Pay above 25000 � Tax is 20% of Pay
Here the valid input domain can be divided into three valid equivalent classes like:
Class c1 : Values in the range 12000 to 15000
Class c2: Values in the range 15001 to 25000
Class c3: Values more than 25000
Test cases utilizing valid equivalence classes having values in falling within the range of 12000 to 15000 of Pay shall be
While observing the “Observed Output” column, Desired Outputs are always found to be different for any set of two successive inputs. Hence it is necessary to carryout the testing with the help of boundary value analysis approach by maintaining such difference. Similar approach is applied to verify the output boundaries as well.
Few other illustrations of test cases designed with boundary value analysis approach are:
a) Testing of a compiler using an empty source code
b) Testing of trigonometric functions as TAN having values close to p/2
c) Testing of a function involving deletion of a record from a particular empty data file or a data file having just a single record.
Thus summarizing, Boundary Value Analysis is an efficient approach of designing the test cases, which can discover majority of most common errors getting introduced during the programming.