SpinTheMic
Pro

Interview practice question

Tests break on every refactoring

Backend Engineering · Testing · Beginner

Whenever you refactor internal code without changing behaviour, dozens of tests fail. Why, and how do you fix it?

What a strong answer covers

Your AI report card counts how many of these ideas you cover.

  • Tests coupled to implementation details.
  • Over-mocking internal calls.
  • Test public behaviour/outcomes.
  • Mock only at boundaries.
  • Fewer, more meaningful assertions.
Practise this topic

Start without signing up. Sign in free to get an AI report card on your answer.

See all topics