Understanding the types of testing
In this section, we will go over some of the ways of organizing and classifying tests inside an Android project and what types of libraries we can use for each category.We will start at the bottom of the pyramid (see Figure 9.1), which is represented by unit tests, move upward through integration tests, and finally reach the top, which is represented by end-to-end tests (UI tests). Throughout this chapter, you will work with the tools that aid in wiring each of these types of tests, however, here’s a brief overview of what each tool does:
Mockito
andmockk
help mainly in unit tests and are useful for creating mocks or test doubles in which we can manipulate inputs so that we can assert different scenarios. A mock or test double is an object that mimics the implementation of another object. Every time a test interacts with mocks, you can specify the behavior of these interactions.Robolectric
is an open source...