Skip to content
RED SAGSkills
mediumFrontend Developer interview question

What testing strategy would you use for a frontend application?

What the interviewer wants to hear

  • Unit tests for pure logic and utilities
  • Component tests that test behaviour like a user would
  • End-to-end tests for critical user journeys
  • Mock network at the boundary, for example with MSW
  • Run tests in CI, keep them fast and not flaky
  • Add accessibility and visual checks where useful

Model answer

I use a mix, sometimes called the testing trophy. Pure logic, like formatting and validation, gets fast unit tests with Vitest. Most of the value comes from component and integration tests with React Testing Library, where I render a component and interact with it like a user, finding elements by role and label rather than class names. I mock the network at the boundary with MSW so tests use realistic responses. For the few critical journeys, like sign-up, login and checkout, I write end-to-end tests with Playwright against a real build. Everything runs in CI on each pull request. I keep tests independent and avoid fixed waits to prevent flakiness, and I add automated accessibility checks like axe on key pages.

Can you answer it under time pressure?

Take a timed medium round and get scored on every answer.

Start mock interview

More medium Frontend Developer questions