Learning Objectives
By the end of this lesson you will be able to:
- Design a complete "required field" test checklist
- Verify that error messages are specific and helpful (not just present)
- Test the distinction between "field missing" and "field empty" in HTTP requests
The Complete Required Field Test Checklist
Required fields seem simple to test. They're not. Here's the full checklist:
Absence Tests
- [ ] Submit without the field at all (HTTP POST without the key)
- [ ] Submit with the field present but value as empty string (
"")
Whitespace Tests
- [ ] Single space (
" ") - [ ] Multiple spaces (
" ") - [ ] Tab character (
"\t") - [ ] Newline character (
"\n") - [ ] Mixed whitespace (
" \t \n ")
Near-Empty Tests
- [ ] Single printable character (
"a") — should be accepted if no minimum length - [ ] Single digit (
"1")
Error Message Quality
- [ ] Does the error message identify which field failed?
- [ ] Does it explain what's wrong (e.g., "Name is required" vs. "Field cannot be empty")?
- [ ] Is it shown in the right place (near the field, not just at the top of the page)?
Testing Error Message Quality
A good error message tells the user:
- What: Which field has a problem
- Why: What the problem is (required, too short, invalid format)
- How: What they need to do to fix it (implicitly clear from the why)
Bad: "Error occurred. Please try again." Good: "First name is required." Better: "First name is required. Please enter your first name."
As a tester, document the exact error message text in your bug reports — if it's unhelpful, that's a defect in itself.
Testing Field Independence
When a form has multiple required fields, test each one independently:
- Fill all fields correctly → submit → should succeed
- Empty Field A, fill others correctly → submit → should show error only for Field A
- Empty Field B, fill others correctly → submit → should show error only for Field B
- Empty all fields → submit → should show errors for all required fields
If the form only shows the first error and hides subsequent ones ("fix this first"), that's a UX bug worth flagging.
Pro Tip: Always test the "all required fields empty at once" case. Many forms have a bug where they only validate the first empty field and silently ignore the rest until each is corrected in sequence.
Key Takeaways
- Required field testing requires at least 7–8 test cases to be thorough
- Whitespace-only values are the most commonly missed case
- Error message quality is a testable and reportable requirement
- Test each required field in isolation and all together