The test pyramid: why most of my tests are boring on purpose
When people hear "test automation", many picture a robot clicking through a website like a user. It looks impressive, but it's the most expensive kind of test there is.
I stick to the test pyramid:
- The base: lots of fast unit tests. They check small pieces of logic and run in seconds. When one fails, you see exactly where.
- The middle: API and integration tests. They check that the parts of the system talk to each other correctly. There are fewer of them, and they are slower.
- The top: a few end-to-end tests through the interface. Only the most important user journeys. They are slow, moody and costly to fix.
The idea is simple: put every check at the lowest level that can still catch the problem. The lower it sits, the faster the feedback and the fewer false alarms.
Here's how it looks on a platform with money and private content. The rule "paid content is never available without payment" I want to verify where the decision is made, not only by eye in a browser. And I keep the end-to-end test for the whole main journey: "a person paid and got access".
A common mistake is the "ice cream cone": an upside-down pyramid where almost everything rests on end-to-end tests. The suite gets heavy and flaky, and the team stops trusting it. A test nobody trusts is worse than no test.
What share of your automated tests are end-to-end through the UI? Tell me in the comments.
📞 Have a QA question? Book a free 15-min call with me via the widget on my profile, or just message me in chat.