For effective testing of applications it is important to adopt a test pyramid when building test cases. The test pyramid represents different types of testing, their proposed share in all of the test cases that you want to run, and their return on investment (ROI).
The test pyramid has three distinct sections:
Unit tests: These tests are performed at the unit level, which forms the base of the test pyramid. They must occupy approximately 70% of all of the test cases that you intend to run, because they are more robust and take less time.
Integration tests: These tests ensure that the integration between various components of the application is functioning correctly. Integration tests are mostly functional API-based tests, which constitute the middle layer of the test pyramid and consist of approximately 20% of all test cases. The use of integration tests should be limited, or used far less frequently than Unit tests. The cost associated with designing and executing integration tests is higher compared to unit tests.
Acceptance test: These tests are performed to ensure that the application works correctly from end-to-end. Most acceptance tests are carried out using the application's own UI, and constitute the top layer of the test pyramid - approximately 10% of all intended test cases. These tests are both time-consuming and unreliable, resulting in a high maintenance overhead. Therefore, because of changing requirements, it is a challenge to keep these tests current.
Check your knowledge with the following interaction: