Connect with us

Testing Tools

How to Write Email Validation Test Cases

Published

, on

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

What are the test cases for email address validation?

Positive Scenarios:

  1. Verify the input field accepts a valid email address. Some examples:
    1. [email protected]
    2. [email protected]
    3. [email protected]
    4. [email protected]
    5. [email protected]
    6. example@[234.234.234.234]
    7. “example”@email.com
    8. [email protected]
    9. [email protected]
    10. [email protected]
    11. [email protected]
    12. [email protected]
    13. [email protected]
    14. [email protected]
    15. Valid Email Addresses that appear at glance to be invalid
    16. extremely.”odd\unusual”@example.com
    17. extremely.unusual.”@”[email protected]
    18. very.”(),:;<>[]”.VERY.”very@\\ “very”[email protected]
  2. Verify email id can contain a dot in the address field.
  3. Verify email id can contain a dot in the subdomain field.
  4. Verify email id can contain a plus sign.
  5. Verify email id can contain an IP address in square bracket.
  6. Verify email id can contain quotes.
  7. Verify email id can contain digits.
  8. Verify email id can contain an underscore.
  9. Verify email id with a valid top-level domain name is valid.
  10. Verify top-level domain can contain a dot.
  11. 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:

  1. Verify an email id cannot exceed 254 characters.
  2. Verify the missing @ symbol in the email id field.
  3. Verify the missing domain in the email id field.
  4. Verify gibberish or garbage is not accepted in the email id text box.
  5. Verify the missing username in the email id field.
  6. Verify encoded HTML within the email id field is invalid.
  7. Verify leading dot in the email id text box is invalid.
  8. Verify trailing dot in the email id text box is invalid.
  9. Verify multiple dots in the email field.
  10. Verify unicode char in the address in the email text box.
  11. Verify invalid IP address format in the email text box.
  12. Verify multiple dots in the domain is invalid.
  13. Verify invalid email addresses like these:
    1. plaintext address
    2. @#@@##@%^%#$@#$@#.com
    3. @email.com
    4. John Doe <[email protected]>
    5. example.email.com
    6. example@[email protected]
    7. [email protected]
    8. [email protected]
    9. example…[email protected]
    10. おえあいう@example.com
    11. [email protected] (John Doe)
    12. example@email
    13. [email protected]
    14. [email protected]
    15. [email protected]
    16. example@email…com
    17. CAT…[email protected]
    18. ”(),:;<>[\]@email.com
    19. obviously”not”[email protected]
    20. 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.

  1. Too many symbols (@). must be verified
  2. Verify all domains at the top.
  3. 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.

author avatar
Alex
Over the past 8 years, I have realised that the most important weapon we have as tech enthusiasts is information. Information that I can share and actually help you solve some of your life problems. Of course, I'm going to lose some of that because of AI, but it's making me more productive today!
Click to comment

Leave a Reply

Your email address will not be published. Required fields are marked *

Trending