The following is the first few sections of a chapter from The Busy Coder's Guide to Android Development, plus headings for the remaining major sections, to give you an idea about the content of the chapter.
Basic JUnit4 instrumentation tests are fine for testing non-UI logic. They even work acceptably for some basic UI testing. The more complex your UI testing gets, though, the more likely it is that you will find plain JUnit4 instrumentation tests to be limiting and tedious.
In particular, running tests across activities can be tricky with
ActivityTestRule is designed for testing a single
activity in isolation, and crafting your own rule that transcends
a single activity may be difficult.
Espresso is designed to simplify otherwise-complex UI testing scenarios, such as:
ListViewrow in one activity correctly launches a detail activity associated with the model object for that row
In this chapter, we will explore how to set up basic Espresso tests and how to employ them as part of your overall testing implementation.
This chapter assumes that you have read the chapter on JUnit4.
The preview of this section is off trying to sweet-talk the Khaleesi into providing us with a dragon.
The preview of this section was eaten by a grue.
The preview of this section was traded for a bag of magic beans.
The preview of this section was whisked away by a shark-infested tornado.
The preview of this section was the victim of a MITM ('Martian in the middle') attack.
The preview of this section apparently resembled a Pokémon.