In Equivalence class testing, we require to separate valid input and output domain from invalid inputs and outputs. And then after test cases are formed.
Program:
Here are the Quadratic Equation problem program and its tested outputs.
Equivalence Class testing
Considering Output domain first,
O1 = Not a quadratic equation when a = 0
O2 = Real roots, b2 – 4ac > 0
O3 = Equal roots, b2 – 4ac = 0
O4 = Imaginary roots, b2 – 4ac < 0
Now Input domain,
I1 = { 0< a <= 10 }
I2 = { a<0 }
I3 = { a>10 }
I4 = { 0< b <= 10 }
I5= { b<0 }
I6 = { b>10 }
I7 = { 0< c <= 10 }
I8 = { c<0 }
I9 = { c>10 }
I10 = { a= 0 }
In total there are 14 test cases, 4 for possible outputs and 10 for different different combinations of input.
Input and output domains | a | b | c | Expected Output | Program Output | Tested Outcome |
---|---|---|---|---|---|---|
O1 | 0 | 5 | 5 | Not Quadratic | Not Quadratic | Pass |
O2 | 1 | 5 | 5 | Real | Real | Pass |
O3 | 5 | 5 | 5 | Imaginary | Imaginary | Pass |
O4 | 5 | 10 | 5 | Equal | Equal | Pass |
I1 | 5 | 5 | 5 | Imaginary | Imaginary | Pass |
I2 | -1 | 5 | 5 | Invalid Input | Invalid Input | Pass |
I3 | 11 | 5 | 5 | Invalid Input | Invalid Input | Pass |
I4 | 5 | 5 | 5 | Imaginary | Imaginary | Pass |
I5 | 5 | -1 | 5 | Invalid Input | Invalid Input | Pass |
I6 | 5 | 11 | 5 | Invalid Input | Invalid Input | Pass |
I7 | 5 | 5 | 5 | Imaginary | Imaginary | Pass |
I8 | 5 | 5 | -1 | Invalid Input | Invalid Input | Pass |
I9 | 5 | 5 | 11 | Invalid Input | Invalid Input | Pass |
I10 | 0 | 5 | 5 | Not Quadratic | Not Quadratic | Pass |
In given table, first four are from output domain and other are from inputs.