Back to library

🧪Unit vs Integration Testing

Stop arguing about whether something is a unit or integration test — get a sharp shared vocabulary, write the same feature at three test levels, and walk away with a written test strategy for a real service.

Applied14 drops~2-week path · 5–8 min/daytechnology

Phase 1Defining the Test Levels

Define unit, integration, and end-to-end without hand-waving

4 drops
  1. A unit test isn't about size — it's about isolation

    6 min

    A unit test isn't about size — it's about isolation

  2. Integration tests prove the wires connect

    6 min

    Integration tests prove the wires connect

  3. End-to-end tests answer one question: does the user's path work?

    6 min

    End-to-end tests answer one question: does the user's path work?

  4. The test boundary is a design choice, not a discovery

    7 min

    The test boundary is a design choice, not a discovery

Phase 2The Same Feature at Three Levels

Write the same feature at three different test levels

5 drops
  1. Pick one feature and freeze it for the week

    5 min

    Pick one feature and freeze it for the week

  2. The unit test: fast, focused, and lying about the world

    6 min

    The unit test: fast, focused, and lying about the world

  3. The integration test: slower, sharper, and proves the seam

    7 min

    The integration test: slower, sharper, and proves the seam

  4. The end-to-end test: slow, valuable, and used sparingly

    7 min

    The end-to-end test: slow, valuable, and used sparingly

  5. Three tests, three trade-offs, one feature shipped with confidence

    6 min

    Three tests, three trade-offs, one feature shipped with confidence

Phase 3Pyramids, Feedback Loops, and Flake

Connect the pyramid to feedback loops and flake

4 drops
  1. The integration suite that takes 40 minutes

    7 min

    The integration suite that takes 40 minutes

  2. The flaky end-to-end test nobody can fix

    7 min

    The flaky end-to-end test nobody can fix

  3. The PR that touches every test in the codebase

    7 min

    The PR that touches every test in the codebase

  4. Choosing between coverage and confidence

    7 min

    Choosing between coverage and confidence

Phase 4Plan a Real Test Strategy

Draft a real test strategy for a service you own

1 drop
  1. Write the test strategy for a service you actually ship

    20 min

    Write the test strategy for a service you actually ship

Frequently asked questions

What's the actual difference between a unit test and an integration test?
This is covered in the “Unit vs Integration Testing” learning path. Start with daily 5-minute micro-lessons that build from fundamentals to hands-on application.
Should I mock the database in unit tests or use a real one?
This is covered in the “Unit vs Integration Testing” learning path. Start with daily 5-minute micro-lessons that build from fundamentals to hands-on application.
Why does the test pyramid say to write fewer end-to-end tests?
This is covered in the “Unit vs Integration Testing” learning path. Start with daily 5-minute micro-lessons that build from fundamentals to hands-on application.
How do I decide what level to test a feature at?
This is covered in the “Unit vs Integration Testing” learning path. Start with daily 5-minute micro-lessons that build from fundamentals to hands-on application.
What makes integration tests so flaky and how do I fix it?
This is covered in the “Unit vs Integration Testing” learning path. Start with daily 5-minute micro-lessons that build from fundamentals to hands-on application.