Junior
How to test an email address input field?
sobes.tech AI
Answer from AI
The email address input field testing includes checks:
- Format validation:
- Correct formats (name@domain.zone, name.surname@subdomain.domain.zone, etc.).
- Incorrect formats (missing @, no domain, multiple @, forbidden characters, spaces).
- Special characters in local part and domain.
- Domain names of various lengths.
- IP address as domain (
user@[192.168.1.1]).
- Field length:
- Minimum allowed length.
- Maximum allowed length.
- Exceeding maximum length.
- Field mandatory:
- Submitting form with empty field.
- Case sensitivity:
- Is the field case-sensitive (usually no for domain part).
- Cross-browser and cross-platform testing:
- Correct display and behavior across different browsers and devices.
- Security testing:
- XSS attacks (script input).
- SQL injections (if the field interacts directly with a database).
- Performance:
- Response time when entering long/complex addresses (if real-time validation is enabled).
Test case examples:
| ID | Test case description | Input data | Expected result | Actual result | Status |
|---|---|---|---|---|---|
| TC-001 | Valid email format | test@example.com |
System accepts email, no error message. | ||
| TC-002 | Invalid format (missing @) | testexample.com |
System displays format error message. | ||
| TC-003 | Invalid format (multiple @) | test@example@com |
System displays format error message. | ||
| TC-004 | Empty field (mandatory) | (empty) | System displays message that the field is required. | ||
| TC-005 | Long email | a*250 + @example.com |
System correctly handles an email of permissible length. |
Example of automated test (Python with Selenium):
# test_email_field.py
from selenium import webdriver
from selenium.webdriver.common.by import By
def test_valid_email_input():
driver = webdriver.Chrome() # or another driver
driver.get("http://your-app-url.com") # replace with your app URL
email_field = driver.find_element(By.ID, "email") # replace with your field locator
email_field.send_keys("test@example.com")
# Check for absence of error message
error_message = driver.find_elements(By.ID, "email-error") # replace with your error message locator
assert len(error_message) == 0, "Error message appeared for correct email"
driver.quit()
def test_invalid_email_input():
driver = webdriver.Chrome()
driver.get("http://your-app-url.com")
email_field = driver.find_element(By.ID, "email")
email_field.send_keys("invalid-email")
# Check for error message display
error_message = driver.find_element(By.ID, "email-error") # replace with your error message locator
assert error_message.is_displayed(), "Error message did not appear for incorrect email"
driver.quit()