Unit Tests and Integration Tests with JUnit, Mockito, and Espresso
In this chapter, you will learn about testing on the Android platform and how to create unit tests, integration tests, and UI tests. You will see how to create each of these types of tests, analyze how they run, and work with frameworks such as JUnit, Mockito, Robolectric, and Espresso.
You will also learn about test-driven development (TDD), a software development practice that prioritizes tests over implementation. By the end of this chapter, you will be able to combine your new testing skills to work on a realistic project.
In previous chapters, you learned about how to load background data and display it in the UI and how to set up API calls to retrieve data. But how can you be sure that things work well? What if you’re in a situation where you have to fix a bug in a project that you haven’t interacted much with in the past? How can you know that the fix you are applying won’t trigger...