Tutorial-7: To Generate Equivalence Class Test Cases-For the Next Date Function
“Next Date” is a function consisting of three variables like: month (mm), date (dd) and year (yyyy). It returns the date of next day as output. It reads current date as input date.
The conditions are
C1: 1 ≤ month ≤ 12
C2: 1 ≤ day ≤ 31
C3: 1812 ≤ year ≤ 2012
Thus based on valid values, the equivalence classes are:
M1= {month: 1 <- month <- 12}
D1 = {day: 1 <-day<<-31}
Y1= {year: 1812 <- year <- 2012}
And the invalid equivalence classes are:
M2 = {month : month < 1}
M3 = {month : month > 12}
D2 = {day : day < 1}
D3 = {day : day > 31}
Y2 = {year: year < 1812}
Y3 = {year : year > 2012}
Objective of this Tutorial: To apply the four techniques of equivalence class partitioning one by one & generate appropriate test cases?
1) & 2) Weak Normal & Strong Normal Equivalence Class: Since the number of valid classes equals the number of independent variables, only one weak normal equivalence class test case occurs and it is identical to the strong normal equivalence class test case WN1 & SN1
Test Case ID | Month (mm) | Day (dd) | Year (yyyy) | Expected Output |
WN1, SN1 | 6 | 15 | 1912 | 6/16/1912 |
Hence we get the above test case on the basis of valid classes � M1, D1 and Y1 described above.
3) Weak Robust Equivalence Class: Test Cases falling under this category are as under
Test Case ID | Month (mm) | Day (dd) | Year (yyyy) | Expected Output |
WR1 | 6 | 15 | 1912 | 6/16/1912 |
WR 2 | -1 | 15 | 1912 | Invalid Value of Month, as Month cannot be -ve |
WR 3 | 13 | 15 | 1912 | Invalid Value of Month, as Month is always < 12 |
WR 4 | 6 | -1 | 1912 | Invalid Value of Day, as Day cannot be -ve |
WR 5 | 6 | 32 | 1912 | Invalid Value of Day, as we cannot have 32 days in any month |
WR 6 | 6 | 15 | 1811 | Invalid Value of Year, as the rage is 1812 to 2012 only |
WR 7 | 6 | 15 | 2013 | Invalid Value of Year |
Hence we get 7 test cases based on the valid and invalid classes of the input domain as described above.
4) Strong Robust Equivalence Class: Test Cases falling under this category are
Test Case ID | Month (mm) | Day (dd) | Year (yyyy) | Expected Output |
SR1 | -1 | 15 | 1912 | Invalid Value of Month, as Month cannot be -ve |
SR 2 | 6 | -1 | 1912 | Invalid Value of Day, as Day cannot be -ve |
SR 3 | 6 | 15 | 1811 | Invalid Value of Year |
SR 4 | -1 | -1 | 1912 | Invalid Value of Month & Day as Month & Day cannot be -ve |
SR 5 | 6 | -1 | 1811 | Invalid Value of Day & Year |
SR 6 | -1 | 15 | 1811 | Invalid Value of Month & Year |
SR 7 | -1 | -1 | 1811 | Invalid Value of Month, Day & Year |
Modified Equivalence Class for this Problem
We need the modified classes as we know that at the end of a month, the next day is 1 and the month is incremented. At the end of a year, both the day and the month are reset to 1 and the year is also incremented. Finally, the problem of leap year makes determining the last day of a month interesting.
With all the above in mind, we describe the following equivalence classes
M1 = {month : month has 30 days}
M2 = {month : month has 31 days}
M3 = {month : month is February}
D1 = {day : 1 ≤ day ≤ 28}
D2 = {day : day = 29}
D3 = {day : day = 30}
D4 = {day : day = 31}
Y1 = {year :year = 2000}
Y2 = {year : year is a leap year}
Y3 = {year : year is a common year}
So, now let us again identify the various equivalence class test cases:
1) Weak Normal Equivalence Class: As done earlier as well, the inputs are mechanically selected from the approximate middle of the corresponding class.
Test Case ID | Month (mm) | Day (dd) | Year (yyyy) | Expected Output |
WN1 | 6 | 14 | 2000 | 6/15/2000 |
WN2 | 7 | 29 | 1996 | 7/30/1996 |
WN3 | 2 | 30 | 2002 | 2/31/2002 (Impossible) |
WN4 | 6 | 31 | 2000 | 7/1/2000 (Impossible) |
The random / mechanical selection of input values makes no consideration of our domain knowledge and thus we have two impossible dates. This will always be a problem with ‘automatic’ test case generation because all of our domain knowledge is not captured in the choice of equivalence classes.
2) Strong Normal Equivalence Class: The strong normal equivalence class test cases for the revised classes are:
Test Case ID | Month (mm) | Day (dd) | Year (yyyy) | Expected Output |
SN1 | 6 | 14 | 2000 | 6/15/2000 |
SN2 | 6 | 14 | 1996 | 6/15/1996 |
SN3 | 6 | 14 | 2002 | 6/15/2002 |
SN4 | 6 | 29 | 2000 | 6/30/2000 |
SN5 | 6 | 29 | 1996 | 6/30/1996 |
SN6 | 6 | 29 | 2002 | 6/30/2002 |
SN7 | 6 | 30 | 2000 | 6/31/2000 (Impossible) |
SN8 | 6 | 30 | 1996 | 6/31/1996 (Impossible) |
SN9 | 6 | 30 | 2002 | 6/31/2002 (Impossible) |
SN10 | 6 | 31 | 2000 | 7/1/2000 (Invalid Input) |
SN11 | 6 | 31 | 1996 | 7/1/1996 (Invalid Input) |
SN12 | 6 | 31 | 2002 | 7/1/2002 (Invalid Input) |
SN13 | 7 | 14 | 2000 | 7/15/2000 |
SN14 | 7 | 14 | 1996 | 7/15/1996 |
SN15 | 7 | 14 | 2002 | 7/15/2002 |
SN16 | 7 | 29 | 2000 | 7/30/2000 |
SN17 | 7 | 29 | 1990 | 7/30/1996 |
SN18 | 7 | 29 | 2002 | 7/30/2002 |
SN19 | 7 | 30 | 2000 | 7/31/2000 |
SN20 | 7 | 30 | 1996 | 7/31/1996 |
SN21 | 7 | 30 | 2002 | 7/31/2002 |
SN22 | 7 | 31 | 2000 | 8/1/1996 |
SN23 | 7 | 31 | 1996 | 8/1/2000 |
SN24 | 7 | 31 | 2002 | 8/1/2002 |
SN25 | 2 | 14 | 2000 | 7/15/2000 |
SN26 | 2 | 14 | 1996 | 2/15/1996 |
SN27 | 2 | 14 | 2002 | 2/15/2002 |
SN28 | 2 | 29 | 2000 | 3/1/2000 (Invalid Input) |
SN29 | 2 | 29 | 1996 | 3/1/1996 |
SN30 | 2 | 29 | 2002 | 3/1/2002 (Impossible Date) |
SN31 | 2 | 30 | 2000 | 3/1/2000 (Impossible Date) |
SN32 | 2 | 30 | 1996 | 3/1/1996 (Impossible Date) |
SN33 | 2 | 30 | 2002 | 3/1/2002 (Impossible Date) |
SN34 | 6 | 31 | 2000 | 7/1/2000 (Impossible Date) |
SN35 | 6 | 31 | 1996 | 7/1/1996 (Impossible Date) |
SN36 | 6 | 31 | 2002 | 3/1/2002 (Impossible Date) |
So, three month classes, four day classes and three year classes results in 3 * 4 * 3 = 36 strong normal equivalence class test cases. Furthermore, adding two invalid classes for each variable will result in 150 strong robust equivalence class test cases.
It is quite difficult to describe all such 150 classes here.
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.
Nothing I could say would give you undue ceridt for this story.