Guia de entrevista · Testing

Difference between unit, integration, and e2e tests?

do caderno de estudos · atualizado em 2 de outubro de 2026
Para quem vai encarar entrevista de Testing2 min

Faz parte do material de Testing que eu montei a partir das minhas entrevistas. Abaixo, a resposta em inglês e, quando existe, a pegadinha mais comum.

A resposta, como você fala na entrevista

Unit: exercise a small behavior with deterministic inputs. Keep useful real collaborators. Replace external boundaries such as network, clock, or filesystem when isolation requires it.
Integration: multiple modules together (e.g., controller hitting a real database).
E2E: simulate real user flows through the whole system.
The testing pyramid is a starting distribution, not a quota. Integration tests catch SQL, serialization, and wiring mistakes that mocked unit tests miss. Keep a small set of reliable end-to-end checks for critical user journeys. Choose the smallest test boundary that can expose the actual risk.

Ler é o primeiro passo. No app, essa pergunta vira flashcard com repetição espaçada, e o módulo tem quiz e simulado para testar o que ficou.

Treinar essa pergunta no app