lecture 10 of 210 completed

Testing a form's edges

A form can pass your tests and still fail at its edges: at its limit, behind another error, on the second try, after Cancel, or when sent with Enter.

What you'll learn

  • How to test a limit with the values on each side of it
  • Why one invalid field at a time keeps a broken rule visible
  • Why a retry test stays on the same form instead of reloading
  • Why a test that a field clears types in it first, and why Enter needs its own test

A swimming pool's booking form accepts groups of 1 to 6 swimmers, because one lane holds six. You write two tests. One books 3 swimmers and sees the confirmation. The other tries 20 swimmers and sees an error. Both pass.

Then a developer writes count < 6 where they meant count <= 6. The sign < means "less than", and <= means "less than or equal to". Now the form refuses a group of 6. Your tests still pass, because 3 is still allowed and 20 is still too many. A family of six sees an error and books somewhere else. Nobody reports a bug, so nobody fixes it.

full course

Keep reading with the full course

The Foundations track and the first lessons in each framework are free. This lesson needs full course access. A course plan includes all lessons for Playwright, Cypress and Selenium.

See course plans →