Test Components Like a User

Talk it through out loud with your AI coach.

The problem

  • medium
  • Pro

A component's tests check its internal state values and break every time it's refactored, even when nothing changes for users. Explain how you'd test a login form component the way a user uses it.

What a strong answer covers

  • Finding elements the way a person would.
  • Simulating real typing and clicking, and checking what's shown.
  • What not to assert on.
  • Why this makes tests sturdier, with a bonus for accessibility.

Common mistake: Asserting on internal state, so tests break on every refactor but miss real bugs.

Knowing this is half of it. Saying it clearly out loud is the part the coach helps you practise.

Practise it out loud