← Back Published on

The Testing Pyramid


Purpose

Code Quality forms a strong foundation to deliver an impressive product that satisfies the end user's requirements. Quality Engineering sculptures the code quality from the start through the testing pyramid strategy. 

The test automation strategy must follow the Test Pyramid giving more importance to Unit Tests and Integration tests before automating the UI Layer...

Mirror Effect

If Unit, Integration and UI tests are not in right proportion, the team will face major issues which are expensive to fix.

Unit Tests and Integration tests provide more isolation and they are very close to the source code which makes it very faster. The errors spotted in these layers are more cheaper to fix than the ones found on UI Layer.

Unit Tests target testing a class or a method and its very granular. These tests run really fast as this is all about testing the behaviour of the method for various inputs and validating the data returned. 

Integration Tests are all about analysing the behaviour of the product with an area that is not under our control. Integration tests can be API/Service Layer tests to verify how the system behaves when interacting with the third party APIs.

UI tests are more functional testing and helps to validate the end-to-end business flow of any scenario. UI tests tend to be more flaky as they depend more on the front end and they do not serve efficient on all cases. UI tests are not advised to be exhaustive, instead only limited scenarios are chosen to be automated on UI layer.

The Right Balance

I have experienced this myself through my various roles and understood that Test Pyramid is all about finding the right balance. Inject more number of tests into Units and keep them decreasing in Integration(service layer) and UI. Adding visual testing into UI layer is also a great idea.