In this tutorial, we will discuss the approach to design the test cases and also how to apply the boundary value and equivalence class techniques. lets get started.
Equivalence Class:
In this technique, we divide the ‘System under Test’ into number of equivalence classes and just test few values from each of class. The set of input values that gives one single output is called ‘partition’ or ‘Class’. and if the software behaves equally to the inputs then it is called as ‘Equivalence’. Hence, the term Equivalence Class.
For example : In the below figure, the circle accepts only Positive input values ranging from 1-10 only . So, to test the circle, Do we need not test with all the possible values ? like 1,2,3,4, … 10 and negative values -1, -2, -3, -4, …. -10 and values over the accepted range like 11, 12, 13, 14, 15,……. 99, 100, …1000, 6000000 etc. the inputs are infinite.
The answer is a big NO. Because we know the basic principle ‘Exhaustive testing’ is not possible. Hence, we divide them into equivalence class and test with some inputs.
This is because, we are assuming that all the conditions in one partition will be treated in the same way by the software. If one condition in a partition works, all of the conditions in that partition will work, Similarly, if one of the conditions in a partition does not work, then none of the conditions in that partition will work.
The possible solution would be by dividing into 3 different class :
- Positive class
- Negative class
- Invalid Class
Although there are many classes in the diagram. For our easy understanding, we will have only 3 classes. In order to test for different classes we need to select certain inputs. In this example, we have -2 for the negative , 4 for the positive and 12 for the invalid. so, if one input from the class gives the valid output, then for all the other inputs, the result would be similar in the same class, which is represented below.
Advantages of EP :
1. To reduce the number of test cases to a necessary minimum.
2. To select correct test cases to cover all possible scenarios.
Boundary value Analysis:
Boundary value analysis is to test the boundaries between partitions. Is a technique to refine equivalence partitioning by concentrating on the values at the ends of each partition or class.
Value at the minimum, just above minimum, just below minimum, normal, at the maximum, just below maximum, just above maximum are the values selected. Confusing ? check out the below figure.
Consider the same example, the valid values for the circle are 1-10, which means 1 is the minimum value and 1o is the maximum value. Now what are all the boundaries we have 0,1,2 and 9,10,11 .
[su_dropcap]Q[/su_dropcap]Hence, Combining both Equivalence class and Boundary value analysis, what are all the test condition we have to test ?
[su_dropcap]A[/su_dropcap]Yes, you are correct we have all of these values . -2,0,1,2,4,9,10,11,12 . Good anaswer 🙂
Why is BVA important ?
Generally, it has been found that most of the defects are found around boundaries due to the following.
- Programmer mistakes in using the correct comparison parameter like using < operator rather than <= operator.
- Unclear requirements, mostly at the boundaries like discounts for purchases of above $989 only.
- Confusion in using loops and conditions checks (related to coding).
How to Use these techniques to Design Test Cases ?
- Carefully analyse the requirements and find out whether ECP and BVA can be applied to design.
- Identify equivalence classes.
- Define Test cases i.e, Valid test cases and Invalid Test cases.
- Select Boundaries in the partitions.
- Combine ECP and BVA to choose the data for testing.
That’s it! you are done with first draft of designing test cases. just need to follow certain guidelines in writing test cases.
In future posts we will discuss about realtime examples using BVA and ECP . For now, we will continue with the other black box testing techniques part 2 in the immediate next post.
[su_divider]Project Plan = life cycle model + Project parameters[/su_divider]