One minute reads: has the Test Pyramid outlived its use?

1minuteread_T_L-1

In the context of recent advances in Test Automation, we need to address the relevance of the Test Pyramid. First popularised by Mike Cohn, for a decade and a half, this model has been invaluable in illustrating the benefits of a bottom-up approach to test automation. The model was born out of necessity of the time, where end-to-end tests were driven by external commands to the browser and were understandably, expensive and inherently flaky.

Tools such as Cypress and Puppeteer that execute from within the browser now require us to re-evaluate our use of end-to-end tests. Written correctly, the reliability of such tests becomes a non-issue. Yes, these tests tend to be slower to run than unit and integration tests, but the coverage they achieve is unparalleled. The ability to manipulate state in your tests, for example bypassing a login form by making a network request before a test or mocking dependencies, allows you to exercise the areas you want to verify while eliminating those you don’t.

If the Test Pyramid is no longer the gold standard, what is? 

There’s no easy answer but I would say whatever works for you. One suggestion, put forward by Kent C Dodds, the Testing Trophy iterates upon the Testing Pyramid but I would advise against a one-size-fits-all solution. Models are useful in illustrating a general approach but we’ve moved beyond their effectiveness in shaping our automation strategy through them. Modern tools are freeing us up to tailor our approach to the application under test - bespoke automation strategies must replace a model-based approach going forwards.

If you're still here, you might want to read more of our content, or even check out the current positions we're hiring for.

Sign up to Badger News