The Testing Pyramid, devised by Mike Cohn, is a guide for the types of automated tests to favour in a project’s test suite. It points at the unreliability, slow and costly nature of end-to-end tests by placing them at the top smaller section of the pyramid and the quick, cheap and isolated unit tests at the bottom, largest section.
However, remember the Testing Pyramid is only a guide, as the Practical Test Pyramid article perfectly sums up:
Still, due to its simplicity the essence of the test pyramid serves as a good rule of thumb when it comes to establishing your own test suite. Your best bet is to remember two things from Cohn’s original test pyramid:
- Write tests with different granularity
- The more high-level you get the fewer tests you should have