In this article we’ll be creating test cases for previous date problem using Equivalence Class testing. In this technique, we split input domain into two groups or partitions, valid and invalid.
You can check out the “previous date problem” program along with its tested test cases here.
First let’s identify the output domain for the previous date problem.
O1 = Previous date
O2 = Invalid date
Coming to Input domain,
I1 = {1 <= date <=31 }
I2 = {date<0 }
I3 = {date>31}
I4 = {1<= month <=12 }
I5 = {month<1 }
I6 = {month >31}
I7 = {2000<= year <=2050}
I8 = {year<2000 }
I9 = {year>2050}
In this problem, we can clearly see 2 test cases for output and 9 test cases for input are made.
Test cases | Date | Month | Year | Expected Output | Program Output | Test Outcome |
---|---|---|---|---|---|---|
O1 | 15 | 6 | 2025 | 14-6-2025 | 14-6-2025 | Pass |
O2 | 31 | 6 | 2025 | Invalid Date | Invalid Date | Pass |
I1 | 15 | 6 | 2025 | 14-6-2025 | 14-6-2025 | Pass |
I2 | 0 | 6 | 2025 | Invalid Input | Invalid Input | Pass |
I3 | 32 | 6 | 2025 | Invalid Input | Invalid Input | Pass |
I4 | 15 | 6 | 2025 | 14-6-2025 | 14-6-2025 | Pass |
I5 | 15 | -1 | 2025 | Invalid Input | Invalid Input | Pass |
I6 | 15 | 13 | 2025 | Invalid Input | Invalid Input | Pass |
I7 | 15 | 6 | 2025 | 14-6-2025 | 14-6-2025 | Pass |
I8 | 15 | 6 | 1999 | Invalid Input | Invalid Input | Pass |
I9 | 15 | 6 | 2051 | Invalid Input | Invalid Input | Pass |
This post was last modified on December 4, 2020