Skip to content
RED SAGSkills
mediumFull Stack Developer interview question

What is your testing strategy for a full-stack feature such as "invite a teammate by email"?

What the interviewer wants to hear

  • Unit tests for pure logic such as validation and token rules
  • Integration tests for API routes against a real test database
  • Mock external services like email at the boundary
  • A few end-to-end tests for the critical user journey
  • Run tests in CI on every pull request and keep them fast and reliable

Model answer

I follow a testing pyramid or trophy shape. Unit tests cover the pure logic: email validation, invite token generation and expiry rules, and the permission check for who can invite. Most of my confidence comes from integration tests that call the real API route against a real PostgreSQL test database, for example in a Docker container in CI, checking that an invite row is created, duplicates are rejected and a viewer gets 403. External services like the email provider are mocked at the boundary, so I assert that an email was requested with the right link without sending one. Then I write one or two Playwright end-to-end tests for the main journey: admin sends an invite, the invitee opens the link and joins the team. Everything runs in CI on each pull request, and I fix flaky tests quickly rather than adding retries.

Can you answer it under time pressure?

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

Start mock interview

More medium Full Stack Developer questions