The test pyramid
A very useful way of thinking about different kinds of tests is by using the test pyramid. It is a simple graphical representation of the different kinds of tests we need around our code and the relative numbers of each. This section introduces the key ideas behind the test pyramid.
The test pyramid in graphic form looks as follows:
Figure 10.2 – The test pyramid
We can see from the previous graphic that tests are divided into four layers. We have unit tests at the bottom. Integration tests are layered on top of those. The pyramid is completed by end-to-end and user acceptance tests at the top. The graphic shows unit tests in our system are the highest in number, with fewer integration tests and the least number of acceptance tests.
Some of these kinds of tests are new to this book. Let’s define what they are:
- Unit tests
These are familiar. They are the FIRST tests we have been using up until now. One...