Tutorial-2: To Generate BVA Test Cases-For the Triangle Problem
Before we generate the test cases, firstly we need to define the problem domain as described below.
Problem Domain: “The triangle program accepts three integers, a, b and c as input. These are taken to be the sides of a triangle. The integers a, b and c must satisfy the following conditions
C1: 1 ≤ a ≤ 200
C2: 1 ≤ b ≤ 200
C3: 1 ≤ c ≤ 200
C4: a < b+c
C5: b < a+c
C6: c < a+b
The output of the program may be either of: Equilateral Triangle, Isosceles Triangle, Scalene or “Not a Traingle”.
Objective of this Tutorial: How to Generate BVA Test Cases for this problem?
We know that our range is [1, 200] where 1 is the lower bound and 200 being the upper bound.
Also, we find that this program has three inputs like a, b and c.
Hence for our
case number of inputs or n = 3Since BVA yields (4n + 1) test cases according to single fault assumption theory, hence we can say that the total number of test cases will be (4*3+1)=12+1=13.
Now we can draw the following Table indicating all the 13 test-cases.
|Test Case ID||Side “a”||Side “b”||Side “c”||Expected Output|
|5||100||100||200||Not a Triangle|
|10||100||200||100||Not a Triangle|
|15||200||100||100||Not a Triangle|
It may be noted that as explained above that we can have 13 test cases (4n + 1) for this problem. But instead of 13, now we have 15 test cases.
Moreover we can see that the test cases vide ID number 8 and 13 are redundant. Hence we can ignore them. However, we do not ignore test case ID number 3, as we must consider at least one test case out of these three. Thus it is evident that it is a mechanical activity.
Hence we can say that these 13 test cases are sufficient to test this program using BVA technique.
An expert on R&D, Online Training and Publishing. He is M.Tech. (Honours) and is a part of the STG team since inception.