Test Cases For Date of Birth Field - Test Scenarios For DOB

.

 Test Cases For Date of Birth Field- How to Write Test Cases for Date of Birth Feld (DOB)

Requirements (Acceptance Criteria): DOB Field 

The field Should accept the Date in DD/MM/YYYY.
Future date not accepted. 

Test Cases :

Here!!! Some of the important Test Cases for Date of Birth Field...

  • Verify whether the date of birth field is enabled or not.
  • Check that User is able to click on the date field or not.
  • Check whether that field is a date picker or a normal date field.
  • Check that the date picker is getting open or not when users click on the date of birth field (for the date picker)
  • Check that user is able to select the date from the date picker or not.
  • Verify the date picker functionality (next, previous, day months year) user is able to change and selected the date accordingly or not.
  • Check that when the user types the date manually.
  • Verify the date of birth field when the user enters the date in the valid format DD/MM/YYYY format.
  • Check that when the user enters the date in invalid format MM/DD/YYYY format.
  • Verify whether the alert message showing or not when the user enters the date in an invalid format.
  • Verify whether the alert message showing as per requirement or not when a user enters the date in an invalid format.
  • Check that when the user enters the future date.
  • Check that when the user enters the date as 00/00/0000.
  • Verify the range (Max and Min ) Date. If the requirement is there.
  • Check that when the user pastes the valid date in the date field.
  • Check that when the user pastes the date in an invalid format.
  • Check that when the user tried to enter the alphabet in the date of birth field.
  • Check that when the user changes the machine date and tries to add the date of birth.
  • Verify the Adult and Minor conditions if the requirement is there.


Hope!!! The above Test cases for date of birth field are helpful for you...

Team,
QA acharya 

Java Script: Validate a Birth Date 
How to Validate birth date in javascript?

Use below Javascript code to validate the date of birth


The following code validates a birth date where the minimum age is 18 years and the maximum age is 80 using the YYYY-MM-DD format.

'use strict'; const validateBirthday = (birthday) =&gt; { if(!/^\d{4}-\d{2}-\d{2}$/.test(birthday)) { return -1; } let parts = birthday.split('-'); let now = new Date(); let year = parseInt(parts[0], 10); let currentYear = now.getFullYear(); let month = ( parts[1][0] === '0') ? parseInt(parts[1][1], 10) : parseInt(parts[1], 10); let day = ( parts[2][0] === '0') ? parseInt(parts[2][1], 10) : parseInt(parts[2], 10); if(year >= currentYear) { return -1; } if( (currentYear - year) < 18 || (currentYear - year) > 80) { return -1; } if( month < 1 || month > 12) { return -1; } if( day < 1 || day > 31 ) { return -1; } return 0; };

Tags: How to Test Date of birth Field, Date of birth Field Test Cases, Test Cases for DOB, DOB Test Cases ,birth date javascript 

Test Cases for Date of Birth Field



.

Post a Comment

0 Comments