← Back to Week 5

The Testing Pyramid

Three layers of automated tests — most should be at the bottom. Click a layer to see what it tests, how long it runs, and how many you should have.

End-to-End Integration Unit Tests
Bottom: many, fast Top: few, slow
Speed
How many?
Cost to run

What it tests

Examples

    Why a pyramid, not a square? Unit tests are cheap, fast, and find most bugs before they spread. End-to-end tests are slow, brittle, and expensive — you want a few to confirm the whole thing works, but you don't want to lean on them. Most of what you write in this course will be unit tests — one test class per application class, lots of small focused scenarios.
    ← Cohesion & Coupling JUnit Setup in IntelliJ →