How to Write Email Validation Test Cases
In this how-to, we will walk through how to write sample email validation test cases. Many applications collect your email id. Some examples of applications include purchasing on eCommerce websites, scheduling an appointment, or buying tickets to a concert. As a result, creating email address field validation test scenarios applies to all testers. Follow along with this how-to and finish your application’s first test case by creating your account in our free test case management tool. Before starting our test case, we need to define the Acceptance Criteria.
What are the Acceptance Criteria for email address validation test cases?
As discussed in our requirements post, we must have functional requirements. So let’s go ahead and define them as such:
Description: “User must be able to enter their email id while registering their account.
Abbreviated Acceptance Criteria:
- Validate the email address must be entered in the expected format.
- Validate error messages are thrown when invalid data is entered.
What are the Test Cases for Email Address Validation?
- Verify the input field accepts a valid email address. Some examples:
- Valid Email Addresses that appear at glance to be invalid
- very.”(),:;<>”.VERY.”very@\\ “very”.email@example.com
- Verify email id can contain a dot in the address field.
- Verify email id can contain a dot in the subdomain field.
- Verify email id can contain a plus sign.
- Verify email id can contain an IP address in square bracket.
- Verify email id can contain quotes.
- Verify email id can contain digits.
- Verify email id can contain an underscore.
- Verify email id with a valid top-level domain name is valid.
- Verify top-level domain can contain a dot.
- Verify email id with a dash is considered valid.
As with all test scenarios, there do exist some negative scenarios you will want to verify. Namely:
- Verify an email id cannot exceed 254 characters.
- Verify the missing @ symbol in the email id field.
- Verify the missing domain in the email id field.
- Verify gibberish or garbage is not accepted in the email id text box.
- Verify the missing username in the email id field.
- Verify encoded HTML within the email id field is invalid.
- Verify leading dot in the email id text box is invalid.
- Verify trailing dot in the email id text box is invalid.
- Verify multiple dots in the email field.
- Verify unicode char in the address in the email text box.
- Verify invalid IP address format in the email text box.
- Verify multiple dots in the domain is invalid.
- Verify invalid email addresses like these:
- John Doe <firstname.lastname@example.org>
- email@example.com (John Doe)
- example\ is”especially”not\firstname.lastname@example.org
Testing Diminishing Returns:
Keep in mind there are diminishing returns to testing, and developers should be using a thoroughly tested library or regex for this functionality. Here are some tests some folks might be tempted to run, but are not needed.
- Verify too many at symbols (@).
- Verify all top-level domains.
- Verify non-existent top-level domains.
The best thing you can do as a tester is discuss, with the developer, what the library code is doing and what it is not doing. Another quick sanity check is to review your developer’s code check-in for the story you are working on. Doing so can help target your testing efforts when testing email address.
Writing Sample Test Scenarios
In this future section, we will go into detail on how to write valid email test scenarios. If you already have your free AccelaTest test management account and want to be added to this complete test case, please email us at email@example.com.
Conclusion for Email Address Field Validation Test Cases
Tags: email id test cases , Test cases for email field , Email field test cases , email test cases , email address field validation test cases , email id field test cases , how to write test cases for email id