In previous date problem, we will test our code using Robustness Testing to check whether it can provide expected the previous date as an output or not. We are considering interval [2000,2050] for year, [1,31] days for date, [1,12] for month. If we look closely, we require to figure out for given year input whether it is a leap year or not.
We will be using Robustness Testing to generate test cases. The expected output can be [Invalid input, Invalid date, previous Date].
Program
Here is the “previous date problem” program along with its tested test cases.
Robustness Testing
So, there will be 6N+ 1 test cases that is 6*3 +1 =19 in this case as we are using Robustness Testing.
Test ID | Date | Month | Year | Expected Output | Program Output | Test Outcome |
---|---|---|---|---|---|---|
1 | 0 | 6 | 2025 | Invalid Input | Invalid Input | Pass |
2 | 1 | 6 | 2025 | 31-5-2025 | 31-5-2025 | Pass |
3 | 2 | 6 | 2025 | 1-6-2015 | 1-6-2015 | Pass |
4 | 30 | 6 | 2025 | 29-6-2015 | 29-6-2015 | Pass |
5 | 31 | 6 | 2025 | Invalid Date | Invalid Date | Pass |
6 | 32 | 6 | 2025 | Invalid Input | Invalid Input | Pass |
7 | 15 | 0 | 2025 | Invalid Input | Invalid Input | Pass |
8 | 15 | 1 | 2025 | 14-1-2025 | 14-1-2025 | Pass |
9 | 15 | 2 | 2025 | 14-2-2025 | 14-2-2025 | Pass |
10 | 15 | 11 | 2025 | 14-11-2025 | 14-11-2025 | Pass |
11 | 15 | 12 | 2025 | 14-12-2025 | 14-12-2025 | Pass |
12 | 15 | 13 | 2025 | Invalid Input | Invalid Input | Pass |
13 | 15 | 6 | 1999 | Invalid Input | Invalid Input | Pass |
14 | 15 | 6 | 2000 | 14-6-2000 | 14-6-2000 | Pass |
15 | 15 | 6 | 2001 | 14-2-2001 | 14-2-2001 | Pass |
16 | 15 | 6 | 2049 | 14-6-2049 | 14-6-2049 | Pass |
17 | 15 | 6 | 2050 | 14-6-2050 | 14-6-2050 | Pass |
18 | 15 | 6 | 2051 | Invalid Input | Invalid Input | Pass |
19 | 15 | 6 | 2025 | 14-6-2025 | 14-6-2025 | Pass |