Skip to content
Preptima
hardConceptDesignScenarioMidSeniorStaffLead

Where do you draw the line between a unit test and an integration test, and how do you keep a few thousand of them under ten minutes?

6 min readUpdated 2026-08-15

Answer

Short answer

Draw the line by what the test is allowed to touch - a unit test stays in-process, an integration test crosses a real boundary. Mock collaborators, never the component under test.

Was this answer helpful?

Likely follow-ups

  • Which defects can a test running against an in-memory database never catch?
  • Why does Mockito's strict stubbing fail a test that used to pass, and is that a good thing?
  • How would you share one database container across every integration test in a build?
  • Which tests would you move out of the pull-request build entirely, and what would you run them on instead?

Related questions

Further reading

Related Topics