Testing the UI
The UI can be evaluated using the white-box testing or black-box testing. In the white-box testing, UI components are checked in the activities that manage them. Activity testing will be explained in the next chapter, that is, Chapter 9, Unit and Functional Tests. The black-box testing is based on the uiautomator
API. This API includes classes to capture and manipulate components in the application under test. This type of test does not require you to know the internal implementation of the application.
Android Studio does not directly support the uiautomator framework, but since it is available in the Android SDK, we can use it anyway. The steps to complete the testing process are as follows:
Install the application under test on a device (real device or an emulator).
Analyze the UI components of the application under test, employing the uiautomatorviewer tool.
Create a Java test project to implement your test cases using the uiautomator API.
Compile the test project into a JAR...