This is the last section which we are going to cover in terms of testing framework. Let us have a quick glance on this testing sibling also.
13.10.1 Introduction to UI testing
UI stands for user interface. We should test the behavior of our application’s user interface (UI) when it is running on a real device. User interface is the presentation face of your application. This ensures that our application returns the correct UI output in response to a series of user actions. The user actions may include keyboard input or pressing toolbars, menus, dialogs, images, etc. Black-box UI testing does not require testers to know the internal implementation details or coding details of the app. It only deals with expected output when a user does a specific action or enters a specific input. It intelligently separates development and testing framework.
Android SDK have tools which support this sort of testing. The uiautomatorviewer is a graphical user interface tool. It scans and analyzes the UI components of an Android application. uiautomator is a Java library. It consists of APIs to create customized functional UI tests. It contains an execution engine which automates and run tests.
We should also ensure that we validate the same UI functions on our application across the different types of devices that our application may run on. We need to test our UI against general scenarios such as incoming phone calls, user-initiated switching to other applications, and network interruptions
We can use the uiautomatorviewer tool to take a snapshot of the foreground UI screen on any Android device which is connected to our machine used for development. It provides a convenient visual interface. We can inspect the layout hierarchy and view the properties of the individual UI components which are displayed on the test device. It is important to analyze our application. We need to identify the UI components in the application that you want to test. before starting analyzing. UI components that are visible and that users can interact with are eligible candidates for extensive testing of user interface. We have to ensure that application is accessible. Some applications use custom view components. This in turn provides a richer user experience. This accessibility support which is provided by the standard Android UI components is not available with such custom views.
We are done with this section. Hope you enjoyed this section. Next section is related to publishing and other real world tips. See you in next chapter. Till then keep practicing. Happy App DevelopingJ!!