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.
Yet another approach for testing Android applications is UI Automator. This is designed for integration testing, both how your app components integrate with one another (e.g., activities starting activities) and how your app components integrate with the rest of a device, including other applications.
In early 2015, Google released version 2.0 of the UI Automator framework. This update ties UI Automator into the same instrumentation testing engine that is used for JUnit4 testing. This also makes it possible to run UI Automator tests through Android Studio and Gradle for Android, which previously had been difficult.
This chapter assumes that you have read the chapter on JUnit4.
UI Automator, as the name suggests, automates UIs. It simulates user input, in the form of tapping on items and the like. It does so without modifying your process’ contents. Tests run by UI Automator are implemented in JUnit, and those tests have limited access to the widgets inside of a UI. Such access not only allows for directing simulated user input (e.g., “click the OK button”), but also for asserting that various test conditions are true (e.g., “does the list have five rows?”). In this respect, UI Automator behaves like traditional Android JUnit testing.
The preview of this section was accidentally identified as an Android 'tasty treat' by the Cookie Monster.
The preview of this section will not appear here for a while, due to a time machine mishap.
The preview of this section is sleeping in.
The preview of this section was stepped on by Godzilla.
The preview of this section is en route to Mars.
The preview of this section is being chased by zombies.