Does The Test Pyramid Maintain Its Relevance Today?
In 2009, Mike Cohn published "Succeeding with Agile: Software Development Using Scrum," a book that featured the introduction of the test pyramid. Cohn introduced the test pyramid as a graphic representation of the ideal distribution of various test types in a testing strategy. Since then, agile development approaches and the test pyramid have been increasingly popular and extensively used. The test pyramid, which has a lot of unit tests at the bottom, fewer integration tests in the middle, and even fewer end-to-end or user interface tests at the top, visualizes the ideal distribution of different test types in a testing strategy.
Layers Of Test Pyramid
The test pyramid was created with the goal of highlighting the significance of having a solid foundation for unit tests. Unit tests are often quick, isolated tests that offer granular coverage of individual parts or units of code. Unit tests ensure that individual units are proper, detect issues at their source early, and facilitate simpler refactoring.
The middle layer of the pyramid is occupied by integration tests, which confirm how various components or modules interact. These tests make sure that a system's integrated components function properly together and aid in spotting any problems that might develop as a result of the integration of various modules.
End-to-end tests, also known as UI tests, are at the top of the pyramid since they replicate user interactions and validate the system as a whole. When compared to unit and integration tests, these tests are usually slower and more prone to errors. They are helpful in testing crucial workflows and user-facing features, but they should only be employed seldom because of their greater maintenance costs.
Changing Landscape: From 2000 to 2023
But is the test pyramid still applicable to modern software testing techniques?
Well, this merits discussion. Large groups of followers may still vouch for its efficacy, while others may denounce it as an outdated practice that is no longer relevant. I am attempting to be more honest about my observations and viewpoint in this article. In order to better prepare you for the conclusion, let me first give you a broad overview of the technological landscape during the 2000’s and 2023.
|Internet||Desktop computers were used to access the Internet most frequently. Although web technology was developing, websites were still quite basic by today’s standards.||The internet has developed into a vibrant and engaging medium. Rich multimedia experiences and real-time communication are made possible by the practically universal availability of high-speed internet connections.|
|Mobile||Calls and text messages were the main uses for mobile devices. Mobile internet was slow and had few options because smartphones, as we know them today, had not yet been developed.||Smartphones are now commonplace and offer strong processing power, quick internet connection, and a variety of applications. Additionally, wearables, smart home, and Internet of Things (IoT) gadgets have become more popular.|
|Software Development||Traditional software development methodologies predominated the market with lengthy development cycles and waterfall-style methods. The adoption of agile approaches was only beginning.||Faster development cycles, continuous integration and deployment, and collaboration between development and operations teams are now made possible by the widespread adoption of agile techniques, and DevOps practices.|
|AI/ML||In comparison to now, AI and ML technologies were not as developed or widely used. The amount of computing and data that could be used to train complicated models was constrained.||The availability of massive data, improved algorithms, and more computer power have propelled the advancement of AI and ML technologies. Automation, predictive analytics, and personalized experiences are all made possible by the increasing use of AI-powered applications across many industries.|
|Cloud Computing||In 2000, cloud computing was still in its infancy. The majority of businesses relied on on-premises infrastructure at a time when the idea of using the internet to access computer and storage resources was still in its infancy.||The foundation of contemporary infrastructure is cloud computing, which offers scalable and adaptable resources to enterprises. Edge computing has grown in popularity because it enables faster data processing and real-time analysis at the network edge.|
Test Pyramid: Then and Now
It's crucial to keep in mind that the technology landscape is constantly changing, and novel trends and inventions appear frequently. To keep up with these every changing trends, test engineering and test practices should evolve accordingly. Revisiting the test pyramid, slicing each layer one at a time.
Even more so than before, this is still true for the current scenarios. It makes more sense than ever to have as many complex unit tests as possible, especially as more and more companies use microservice design. The co-creation model leading to integration with outside apps just adds up to another factor. These integration operations ought to be airtight, sealing the bugleaks. I agree with Mike Cohn about finding bugs at its source and strengthening the Foundational elements.
Two decades ago, the scope of integration tests was solely verifying the interaction between different software components or modules. From a testing perspective, the challenge was to develop custom test harnesses and scripts to simulate the interactions between components and validate their integration. Mocking/simulation of dependencies was not as prevalent. In the present scenario, integration tests encompass a broader scope due to the complex and distributed nature of software systems. The validations are for the software components and across various services, APIs, and external dependencies. There are powerful tools for designing, executing, and managing integration tests in the present scenario.
Integration testing is now more effective and repeatable thanks to containerization technologies like Docker and virtualization technologies like virtual machines that have made it simpler to develop and manage isolated test environments. With the rise of microservices architecture, API testing and contract testing have gained prominence.
Integration tests are equally important in the present technological landscape as unit tests aim to test an application from several other parameters. I believe that integration tests are equally important covering multiple aspects of an application and not just focusing on application functionality.
Regarding front-end test automation, the unanimous agreement is flaky, and I am not contesting against that. However, frontend testing (UI testing) has undergone tremendous changes and technological advancements. Two decades ago, the whole purpose of a frontend was to provide a touchpoint for a customer, creating an opportunity for them to interact with the application. The internet also wasn’t mature enough. However fast forward 20 years, today front end development is an ocean in itself.
The Internet is stronger than before, offering multiple application optimization options. Today, all businesses are more towards user centric designs, making every touchpoint of an application to be a great experience no matter the device or location used to interact. Whether a B2B or a B2C application, user experience will be at the heart of development. As we are growing to be digitally inclined, organizations are taking a stand towards digital inclusion where Accessibility guidelines become mandatory routine. Thanks to many country laws for enforcing this as compliance.
In today’s game of the internet, frontend development directly affects SEO by influencing website structure, performance, mobile-friendliness, user experience, and content optimization. There is a need to accommodate multifold layers of tests when it comes to the frontend, and is no longer restricted to functional checks. In my perspective, UI tests are as important as unit and integration tests.
I believe the test structure moved from the Pyramid to the Sandwich structure.
Although we can't entirely dismiss the test pyramid, Even while we can't completely discount the test pyramid, it fits if the test automation plan is developed from the end user's standpoint. However, the complexity of testing all aspects of an application has grown today. Technical, user, functional, and last but not least, how well the application functions online to keep up with its SEO score.