You are on page 1of 2

Consider a program for determining the previous date.

Its input is a triple of day, month


and year with the values in the range
1 ≤ month ≤ 12
 
1 ≤ day ≤ 31
 
1900 ≤ year ≤ 2025

Question- The possible outputs would be previous date or invalid input date. Design the
boundary value test cases.

https://www.niecdelhi.ac.in/uploads/Notes/btech/4sem/cse/21378403-Software-
Engineering-By-K-K-Aggarwal-YogeshSingh-Full-Notes.pdf

The Previous date program takes a date as input and checks it for validity. If valid, it
returns the previous date as its output.

With single fault assumption theory, 4n+1 test cases can be designed and which are
equal to 13.

Test Case Month Day Year Expected output


1 6 15 1900 14 June, 1900
2 6 15 1901 14 June, 1901
3 6 15 1962 14 June,1962
4 6 15 2024 14 June, 024
5 6 15 2025 14 June, 2025
6 6 1 1962 31 May, 1962
7 6 2 1962 1 June, 1962
8 6 30 1962 29 June, 1962
9 6 31 1962 Invalid date
10 1 15 1962 14 January, 1962
11 2 15 1962 14 February, 1962
12 11 15 1962 14 November, 1962
13 12 15 1962 14 December, 1962

If any one condition out of C1, C2 or C3 fails, then this function produces an output
“value of month not in the range 1…12”.
Since many combinations of dates can exist, hence we can simply displays one
message for this function : “Invalid Input Date”.

Complexities in Next Date

FunctionA very common and popular problem occurs if the year is a leap year. We have
taken into consideration that there are 31 days in a month. But what happens if a month
has 30 days or even 29 or 28 days ?

A year is called as a leap year if it is divisible by 4, unless it is a century year. Century


years are leap years only if they are multiples of 400. So, 1992, 1996 and 2000 are leap
years while 1900 is not a leap year.

Furthermore, in this Next Date problem we find examples of Zipf’s law also, which
states that “80% of the activity occurs in 20% of the space”. Thus in this case also,
much of the source-code of Next Date function is devoted to the leap year
considerations.

The Next Date program takes date as input and checks it for validity. If it is valid, it
returns the next date as its output.

Here we have three inputs for the program, hence n = 3.

Since BVA yields (4n + 1) test cases according to single fault assumption theory, hence
we can say that the total number of test cases will be (4*3+1)=12+1=13.

The boundary value test cases are

Test Case ID Month (mm) Day (dd) Year (yyyy) Expected Output
1 6 15 1900 16 June, 1900
2 6 15 1901 16 June, 1901
3 6 15 1962 16 June, 1962
4 6 15 2024 16 June, 2024
5 6 15 2025 16 June, 2025
6 6 1 1962 2 June, 1962
7 6 2 1962 1 June, 1962
8 6 30 1962 1 July 1962
Invalid Date as June has 30
9 6 31 1962
Days
10 1 15 1962 16 January, 1962
11 2 15 1962 16 February, 1962
12 11 15 1962 16 November, 1962
13 12 15 1962 16 December, 1962

This is how we can apply BVA technique to create test cases for our Next Date
Problem.

You might also like