Tutorial-6: To Generate Equivalence Class Test Cases-For the Triangle Problem
“The triangle program takes three integers, a, b and c as input. These are taken to be the sides of the triangle.
The output of the program can be either of: Equilateral Triangle, Isosceles Triangle, Scalene or “Not a Triangle”.
We can use these to identify output (range) equivalence classes as under:
01 = {<a, c=”” b,=””> : the triangle is equilateral}
</a,>
02 = {<a, c=”” b,=””> : the triangle is isosceles}
</a,>
03 = {<a, c=”” b,=””> : the triangle is scalene}
</a,>
04 = {<a, c=”” b,=””> : sides a, b and c do not form a triangle}</a,>
Objective of this Tutorial: To apply the four techniques of equivalence class partitioning one by one & generate appropriate test cases?
1) Weak Normal Equivalence Class: The four weak normal equivalence class test cases can be defined as under
Test Case ID | Side “a” | Side “b” | Side “c” | Expected Output |
WN1 | 5 | 5 | 5 | Equilateral Triangle |
WN2 | 2 | 2 | 3 | Isosceles Triangle |
WN3 | 3 | 4 | 5 | Scalene Triangle |
WN4 | 4 | 1 | 2 | Not a Triangle |
2) Strong Normal Equivalence Class: Since no valid subintervals of variables a, b and c exist, so the strong normal equivalence class test cases are identical to the weak normal equivalence class test cases.
3) Weak Robust Equivalence Class: Considering the invalid values for a, b and c yields the following additional weak robust equivalence class test cases
Test Case ID | Side “a” | Side “b” | Side “c” | Expected Output |
WR1 | 1 | 5 | 5 | Invalid Value of a |
WR2 | 5 | -1 | 5 | Invalid Value of b |
WR3 | 5 | 5 | -1 | Invalid Value of c |
WR4 | 201 | 5 | 5 | Out of Range Value of a |
WR5 | 5 | 201 | 5 | Out of Range Value of a |
WR6 | 5 | 5 | 201 | Out of Range Value of a |
4) Strong Robust Equivalence Class: Test Cases falling under this category are
Test Case ID | Side “a” | Side “b” | Side “c” | Expected Output |
SR1 | -1 | 5 | 5 | Invalid Value of a |
SR2 | 5 | -1 | 5 | Invalid Value of b |
SR3 | 5 | 5 | -1 | Invalid Value of c |
SR4 | -1 | -1 | 5 | Invalid Value of a & b |
SR5 | 5 | -1 | -1 | Invalid Value of b & c |
SR6 | -1 | 5 | -1 | Invalid Value of a & c |
SR7 | -1 | -1 | -1 | Invalid Value of a , b & c |
It may be noted that the expected outputs describe the invalid input values thoroughly.
Many More Articles & Tutorials on Black Box Testing
An expert on R&D, Online Training and Publishing. He is M.Tech. (Honours) and is a part of the STG team since inception.