What to test
Within a software project, we can do several types of tests to ensure the quality of the product. In this discipline, it is very common to categorize tests using a pyramid.
Figure 10.1 – Test pyramid
At the base of the pyramid, we have unit tests, whose objective is to verify the quality of the smallest elements within a software project, such as functions or methods of a class. Due to their narrow scope and atomic nature, they are quickly executed by tools and should ideally make up the majority of an application’s tests.
In the middle layer, we have integration tests, which are focused on verifying how the project components interact with each other, being able, for example, to test an API through an HTTP request. Because these tests use more elements and need certain environmental requirements, they are less performant and have a higher execution cost, which is why we see them in smaller quantities compared to unit tests...