Connect with us

Testing Tools

How to Write Email Validation Test Cases

Published

on

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

What are the test cases for email address validation?

Positive Scenarios:

  1. Verify the input field accepts a valid email address. Some examples:
    1. example@email.com
    2. example.first.middle.lastname@email.com
    3. example@subdomain.email.com
    4. example+firstname+lastname@email.com
    5. example@234.234.234.234
    6. example@[234.234.234.234]
    7. “example”@email.com
    8. 0987654321@example.com
    9. example@email-one.com
    10. _______@email.com
    11. example@email.name
    12. example@email.museum
    13. example@email.co.jp
    14. example.firstname-lastname@email.com
    15. Valid Email Addresses that appear at glance to be invalid
    16. extremely.”odd\unusual”@example.com
    17. extremely.unusual.”@”.unusual.com@example.com
    18. very.”(),:;<>[]”.VERY.”very@\\ “very”.unusual@strange.email.example.com
  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 <example@email.com>
    5. example.email.com
    6. example@example@email.com
    7. .example@email.com
    8. example.@email.com
    9. example…example@email.com
    10. おえあいう@example.com
    11. example@email.com (John Doe)
    12. example@email
    13. example@-email.com
    14. example@email.web
    15. example@111.222.333.44444
    16. example@email…com
    17. CAT…123@email.com
    18. ”(),:;<>[\]@email.com
    19. obviously”not”correct@email.com
    20. example\ is”especially”not\allowed@email.com

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.

Continue Reading
Click to comment

Leave a Reply

Your email address will not be published.