Skip to content

FlashcardNot attempted

Maintainable tests

Recall it before you reveal

What habits keep a test suite maintainable?

Space to reveal
Show answer & explanation
  • Descriptive test names that read like requirements; group with describe.
  • Arrange, Act, Assert structure, one behaviour per test.
  • No complex logic (loops, conditionals) inside tests.
  • Query like a user (role, label, text); use data-testid only as a last resort.
  • Control time and randomness (fake timers, seeded data).
  • Delete or fix flaky tests promptly: a suite nobody trusts is worse than none.