Testing Pyramid
What is Testing Pyramid?
Testing Pyramid is a strategy that can help both Development and Automation teams create high-quality and reliable test software. It reduces the time required for the teams to identify if a change they introduced breaks the system by offering immediate feedback.
Pyramid Testing which operates at three levels helps reduce the amount of time automation team spends in execution of Test cases by categorizing each new feature into one or all of the below Tests and managing the sequence and frequency of the tests. Below are the 3 levels
- Unit tests
- Integration tests
- End-to-End tests
Level 1 – Unit Tests
TDD (Test-driven development) approach is recommended for simple, bug free and clean code which helps to validate if the individual components or functionalities are working as expected in isolation. It is important to run a number of scenarios in unit tests – happy path, error handling, etc.
Keep in mind that the number of unit tests will increase as more features are added. This test suite needs to be run every time a new feature is added. Consequently, developers receive immediate feedback on whether individual features are working as they are meant to.
Level 2 – Integration Tests
Unlike Unit tests which verify small pieces of a codebase in isolation, Integration tests need to be run to validate the interaction of a piece of code with external components. These components can range from databases, external services (APIs) and the like.
Integration Tests should not be run as frequently as unit tests as they test how a feature communicates with external dependencies and expected to run slower than unit tests. They also require a preproduction environment in which to run.
Level 3 – End-to-End Tests
At the top of the pyramid are the end-to-end tests. These ensure that the entire application is functioning as required. BDD (Behavior driven design) , End-to-end tests do exactly what the name suggests, test that the application is working flawlessly from start to finish.
When running these tests, it is important to imagine the user’s perspective. How would an actual user interact with the app? How can tests be written to replicate that interaction?
End-to-end tests take the longest to run. They can also be fragile since they have to test a large variety of user scenarios. Like integration tests, these tests may also require the app to communicate with external dependencies, thus adding to possible bottlenecks in completion.
Manual Tests
Any testing that doesn't fall in the above Levels , can be categorized as Manual which should be very minimal as its a over head to testing example : checking of the font size, color on the user interface , checking email notifications etc.
Why should Agile Teams use the Testing Pyramid?
- Agile processes emphasize speed and efficacy. The testing pyramid offers by streamlining the testing process. With a clear progression and logic introduced to the testing pipeline, work gets done faster. Since the pyramid is built to run the easiest tests at the beginning, testers manage time better, get better results and essentially make life easier for everyone involved.
- The pyramid provides automation engineers with the right priorities. If test scripts are written with a greater focus on the UI, then chances are that core business logic and back-end functionality is not sufficiently verified. This affects product quality and leads to more work for the team. Also, since TAT (turn around time) of UI tests is high, it leads to lower test coverage overall. By implementing the pyramid, such situations are completely avoided.
In automated testing , tools and frameworks like selenium execute scripted tests on a software application or component to ensure it is working as expected. Its entire objective is to reduce human effort and oversight.
The test automation pyramid strives to do this by organizing and structuring the test cycle. This streamlines the entire processes, brings efficient time management into the picture and gives testers a time-tested blueprint to shape their projects.
Spark the learning in you
-----------------------------------------------------------------------------------------------Aruna Sydu
Good article Aruna. The testing pyramid is a must for any agile app to build and deploy with confidence. Good insights and looking forward for the next one .. Keep them coming
Good one Aruna