SimuVedaSystem Design Lab Open in the lab

Testing and reliability / Beginner / 5 min / Updated

Test pyramid: unit vs integration vs end-to-end tests

Choose how many unit, integration and end-to-end tests to write. See suite time, flaky runs and which bugs still reach users.

Start the simulation → Change the load, break a part, watch what happens. Free, no sign-up.

In short

What is test pyramid?

Many fast unit tests, fewer integration tests and a few end-to-end tests for the main user journeys.

Why does it matter?

Tests are how a poorly designed system shows its flaws before users do, but only if the suite is fast and trusted.

What is the trade-off?

End-to-end tests are realistic but slow and flaky; unit tests are fast but miss bugs between parts.

How do you explain it in an interview?

"Unit tests per module, integration tests at each boundary (DB, queue, API), a handful of end-to-end smoke tests on deploy."

Check yourself

Why should most automated tests be unit tests?

Answer: They run in milliseconds and never fail at random, so feedback is fast and trusted. Fast, stable tests get run on every change; slow flaky ones get ignored.

A team has 150 end-to-end tests and few unit tests. What usually happens?

Answer: The suite is slow and often red for no reason, so people stop trusting it. This is the ice-cream cone: every end-to-end test is slow and a little flaky.

Which bug does no unit, integration or end-to-end test find?

Answer: The service falling over at 3x normal traffic. Capacity problems need a load test.

See it happen in the simulation →

test pyramidunit testsintegration testsend-to-end testsflaky testsqasoftware testingtesting and reliability

More in testing and reliability