Testing Tools
How to Write Email Validation Test Cases
This tutorial will show you how to create email validation test cases. Many applications will collect your email ID. You can purchase tickets, schedule an appointment, and book online on eCommerce sites. All testers should be able to create validation scenarios for email addresses.
The email field is where you send a message to someone. The subject usually includes the sender’s name and the receiver’s. This field can also be used to write other messages or images.
Before we can start our test case, it is important to establish the Acceptance Criteria
What is the Acceptance Criteria in email address validation cases?
We must have functional requirements, as we discussed in requirements post. Let’s define them.
Description: The user must be able enter their email id when they register their account.
Abbreviated Acceptance Criteria
- Validate the email address must be entered in the expected format.
- Invalid data can result in valid error messages.
What are the test cases for email address validation?
Positive Scenarios:
- Verify the input field accepts a valid email address. Some examples:
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- example@[234.234.234.234]
- “example”@email.com
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- Valid Email Addresses that appear at glance to be invalid
- extremely.”odd\unusual”@example.com
- extremely.unusual.”@”[email protected]
- very.”(),:;<>[]”.VERY.”very@\\ “very”[email protected]
- 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.
Negative Scenarios:
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:
- plaintext address
- @#@@##@%^%#$@#$@#.com
- @email.com
- John Doe <[email protected]>
- example.email.com
- example@[email protected]
- [email protected]
- [email protected]
- example…[email protected]
- おえあいう@example.com
- [email protected] (John Doe)
- example@email
- [email protected]
- [email protected]
- [email protected]
- example@email…com
- CAT…[email protected]
- ”(),:;<>[\]@email.com
- obviously”not”[email protected]
- example\ is”especially”not\[email protected]
Test Diminishing Returns
Remember that testing has diminishing returns and developers should use a well-tested library or regex to test this functionality. These are just a few tests that people might want to run but they are not necessary.
- Too many symbols (@). must be verified
- Verify all domains at the top.
- Verify that there are no top-level domains.
As a tester, it’s important to discuss with the developer what the library code does and doesn’t do. This will help you target your testing efforts for testing email addresses.
FAQ
What is the validation for email?
Email validation is a method to determine if an email address can be reached and is valid. It quickly detects typos and determines whether they are genuine errors or intentional misdirection. It checks whether an email address is associated to a trusted domain.