Ensuring Quality with Test Pyramid
What is a test pyramid?
Test Pyramid is a framework developed to match the testing to the stages of development, to ensure the quality of the product is achieved at every stage.
Adhering to this framework allows the development team to identify any failures due to updating the code at an early stage which reduces the cost of fixing these defects significantly.
There are many variations of the test pyramid implemented depending on the development cycle and team requirement. We will be focusing on the testing pyramid that can be implemented in an Agile Development team.
Unit Testing and Component Testing
Unit Testing is a type of software testing where individual units based on the test design specification. Component testing are testing components based on the test requirements.
Most of the times, a component includes several units of codes and for best coverage both these testing methods should be combined. This is mainly carried out using White box testing where the code is tested covering the code branches, decision steps and statements.
Test Pyramid requires high coverage of unit tests to identify the defects at an early stage.
Unit Tests can be automated using tools like DevMate which is available as Plugins to existing IDEs to simply create many test cases for each of the testing components.
Integration Testing
Once the units/components are tested and released, integration between these components are tested. Sanity testing is done at this phase to verify the stability of any other affected components from the developed features.
We focus on API Testing here as API services are used as means of connection between 2 components. API Testing tools such as Postman, Apache JMeter can be used to automate the API flows that are required to test. JMeter though used as a Performance testing tool, includes API automating capabilities such as Assertions, Caching, Test Data and CI capabilities
System / End to End Testing
As the components and integration are tested, UI will include less number of test cases.
The reason for this is UI is continuously changed which will again change the automation suite which is not ideal for an agile project.
UI Tests are carried out only to validate the end to end system flows. End to End flows includes testing multiple components together to ensure the business requirement is available.
Many tools like Selenium, Cypress are used for End to End Automation Flows. The frequency of the execution of UI tests in the pipeline is also less compared to that of Integration tests.
Manual / Exploratory Testing
Once the above tests are carried out and the relevant test criteria is met, the features/deliverables are ready for release. Before release there can be smoke or exploratory testing on some areas which includes ad-hoc type testing which is done manually.
Focus on preventing bugs not finding bugs
Inverting the test pyramid can find bugs from the UI but these are costly to fix. Good Testing Framework should focus on preventing defects which can be achieved by the Testing Pyramid.
We can extend the testing pyramid based on the automation requirement. Automation feasibility study and strategy should be created to implement a solution to cater your requirement.