The testing pyramid - the canonical shape of tests that defined what types of tests we need to write to make sure the app works - is ... obsolete. In this presentation, Roman Sandler and Gleb Bahmutov argue what the testing shape works better for today's web applications.
Testing Pyramid Makes Little Sense, What We Can Use Instead
FAQ
The main criticisms are that it overemphasizes the quantity of unit tests and does not adapt well to different contexts or needs of a project. The high-level tests, while slower and more expensive, may offer better integration coverage and real-world bugs catching.
Roman suggests using 'testing metrics' which consider both the confidence provided by a test and the effort required to maintain it, advocating for optimizing maximum confidence with minimum effort rather than strictly adhering to a fixed structure like the pyramid.
They recommend considering testing at every step of the development process, from planning to coding and deployment, to ensure that the testing strategy aligns with the team's needs and the project requirements.
They argue that focusing solely on how fast a test runs ignores other important factors such as the time it takes to write, debug, and maintain the tests, which can ultimately be more significant in terms of overall project health and efficiency.
Key factors include the effort required to write, debug, and maintain tests, as well as the confidence each test provides. It's also important to consider the tool's documentation and the team's familiarity with it.
The testing pyramid is a concept that suggests automated tests should be divided into three parts: unit tests, service tests, and UI tests, with the largest portion being unit tests. It was introduced by Mike Cohen in his book 'Succeeding With Agile'.
The testing trophy, introduced by Ken C. Dodds at Assert.js in 2018, suggests that the core of the test suite should be integration tests rather than unit tests. This model shifts the focus from having many small unit tests to fewer, but more crucial, integration tests.
Comments