Great work!

XP to next level

BugEater

Testing Required Fields

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:

  1. What: Which field has a problem
  2. Why: What the problem is (required, too short, invalid format)
  3. 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:

  1. Fill all fields correctly → submit → should succeed
  2. Empty Field A, fill others correctly → submit → should show error only for Field A
  3. Empty Field B, fill others correctly → submit → should show error only for Field B
  4. 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

Quiz

A "first name" field is marked required. Which set of test inputs gives the BEST coverage?

Why should a tester bypass the browser form and send a direct API request with a null "email" field?

A form displays a required field with a red asterisk (*). A tester submits the form via curl without that field in the request body. The server returns HTTP 200. What is the bug?

Which HTTP status code is MOST appropriate when a required field is missing from the request?