Friday, November 15, 2024
Google search engine
HomeGuest BlogsEquivalence Class Testing- Next date problem

Equivalence Class Testing- Next date problem

Equivalence class testing (Equivalence class Partitioning) is a black-box testing technique used in software testing as a major step in the Software development life cycle (SDLC). This testing technique is better than many of the testing techniques like boundary value analysis, worst case testing, robust case testing and many more in terms of time consumption and terms of precision of the test cases. Since testing is done to identify possible risks, equivalence class testing performs better than the other techniques as the test cases generated using it are logically identified with partitions in between to create different input and output classes. This can be shown from the next-date problem which is stated below:

Given a day in the format of day-month-year, you need to find the next date for the given date. Perform boundary value analysis and equivalence-class testing for this.

Conditions :

D:  1<Day<31
M:  1<Month<12
Y:  1800 <Year <2048 

Boundary Value Analysis:

No. of test Cases (n = no. of variables) = 4n+1 = 4*3 +1 =13 

Test Cases:

Test Case ID Day Month Year Expected Output
1

1 6 2000 2-6-2000
2 2 6 2000 3-6-2000
3 15 6 2000 16-6-2000
4 30 6 2000 1-7-2000
5 31 6 2000 Invalid Date
6 15 1 2000 16-1-2000
7 15 2 2000 16-2-2000
8 15 11 2000 16-11-2000
9 15 12 2000 16-12-2000
10 15 6 1800 16-6-1800
11 15 6 1801 16-6-1801
12 15 6 2047 16-6-2047
13 15 6 2048 16-6-2048

Equivalence Class Testing:

Input classes:

Day:
D1: day between 1 to 28
D2: 29
D3: 30 
D4: 31
Month:
M1: Month has 30 days
M2: Month has 31 days
M3: Month is February
Year:
Y1: Year is a leap year
Y2: Year is a normal year 

Output Classes:

Increment Day
Reset Day and Increment Month
Increment Year
Invalid Date

Strong Normal Equivalence Class Test Cases:

Test Cases:

Test Case ID Day Month Year Expected Output
E1 15 4 2004 16-4-2004
E2 15 4 2003 16-4-2003
E3 15 1 2004 16-1-2004
E4 15 1 2003 16-1-2003
E5 15 2 2004 16-2-2004
E6 15 2 2003 16-2-2003
E7 29 4 2004 30-4-2004
E8 29 4 2003 30-4-2003
E9 29 1 2004 30-1-2004
E10 29 1 2003 30-1-2003
E11 29 2 2004 1-3-2004
E12 29 2 2003 Invalid Date
E13 30 4 2004 1-5-2004
E14 30 4 2003 1-5-2003
E15 30 1 2004 31-1-2004
E16 30 1 2003 31-1-2003
E17 30 2 2004 Invalid Date
E18 30 2 2003 Invalid Date
E19 31 4 2004 Invalid Date
E20 31 4 2003 Invalid Date
E21 31 1 2004 1-2-2004
E22 31 1 2003 1-5-2003
E23 31 2 2004 Invalid Date
E24 31 2 2003 Invalid Date

So from this problem it is clearly seen that equivalence class testing clearly checks for many cases that boundary value did not considered like that of February which has 28-29 days, leap year which lead to variation in number of days in February and many more.

Hence the above example proves that equivalence partitioning generates more efficient test cases that should be considered during risk assessment.

Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!

RELATED ARTICLES

Most Popular

Recent Comments