The Test Automation Pyramid is a framework and guiding principle, for organizing and structuring software testing efforts in terms of automation. It visually represents the types of tests that should be included in a test suite with the detailed tests at the bottom and broader tests at the top.
According to the Test Automation Pyramid, a successful approach to test automation should be built upon three layers or levels of tests each serving a purpose and providing feedback;
- Unit Tests:
- These are the most detailed types of tests and should be automated for each individual section of code in the application.
- They are quick to execute and focus on testing units.
- Typically created and executed by developers, they aim to identify defects in the development process.
- Unit tests provide feedback. Help ensure that individual code units function correctly.
- Service Tests:
- These tests primarily focus on interactions and integration between various components or services within your application.
- Their purpose is to verify that different components of your software system can successfully interact and collaborate as intended.
- They help identify issues related to data flow, communication protocols, and API agreements.
- They play a role, in maintaining the integrity and consistency of data across components.
- UI (User Interface) Tests:
- The top tier of the pyramid is made up of UI tests.
- These tests simulate user interactions with the application’s graphical user interface.
- These tests aim to ensure that the application functions, from an end user perspective.
- Because these tests are slower and more brittle than unit and service tests, they should be used sparingly and only to confirm high-level behaviors.