[WEB/SOFTWARE TESTING CHECKLISTS] Date Fields - What are the Test Cases to be considered while testing a date field?

| | 2 min read

While testing any website, be it Drupal / non-Drupal, one would often have to test Date fields.
Following are the test cases to be considered / checked for, while testing a date field:

01. Ensure that the date field accept dates in the specified format ie dd/mm/yy or mm/dd/yy or yyyy.
02. Ensure that the date field does not accept characters.
03. Ensure that the day field accepts values between 1 and 30/31 according to the month.
04. Ensure that the day field does not accept any values less than 1 or greater than 31. For example; day field should not accept 0 and 32 or more.
05. Ensure that the day field does not accept 30/31 for the second month(February).
06. Ensure that the day field does not accept 29 for the second month(February) unless it is a leap year.
07. Ensure that the day field and month field accepts the format 1 and 01.
08. Ensure that the month field accepts value between 1 and 12.
09. Ensure that the month field does not accept 0 and 13 or more.
10. Ensure that the year field does not accept 0000.
11. Ensure that the year field does not accept 'yy' (12) if the required format is 'yyyy'(2012).
12. Ensure that the day,month and year are separated by – or /.
13. Ensure that the date field cannot be left blank if the field is set as mandatory.

Further, if the date field is set with a calendar then,

14. Ensure that a calendar pops up on clicking the date field.
15. Ensure that the user is able to select the desired date on the calendar.
16. Ensure that the calendar disappears after a date is selected.
17. Ensure that the selected date is displayed on the date field.