Who should read it: It is for you if you are looking for an overview of this topic for a project, to conduct/appear in an interview, or in general. As we learn more, we will update this article.
What is Test Pyramid: Test Pyramid is a way to plan the testing efforts on an application. As per this concept, efforts are:
- Highest in unit Testing
- Middle level in Service testing
- Lowest in UI testing
These are key points:
- Write tests with different granularity.
- The more high level we go, we should have less test cases.
Different types of tests:
Unit Tests: Stick to one test class per production class. Test the public interface of the class.We can ignore private methods.
Integration Tests: Testing the applications end-to-end.
Contract Tests: It means testing different services via certain interfaces. Contract testing is a way to ensure different services can communicate with each other. Some examples of contract testing tools are OpenAPI, Pact, Postman collections, RAML, and API Blueprint.
UI Tests: Typically, it means a web interface in the context of web applications.
End-to-End Tests: User interface end-to-end tests. REST API end-to-end tests.
Reference: https://martinfowler.com/articles/practical-test-pyramid.html