Book Image

Testing and securing android studio applications

Book Image

Testing and securing android studio applications

Overview of this book

Table of Contents (18 chapters)
Testing and Securing Android Studio Applications
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

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:

  1. Install the application under test on a device (real device or an emulator).

  2. Analyze the UI components of the application under test, employing the uiautomatorviewer tool.

  3. Create a Java test project to implement your test cases using the uiautomator API.

  4. Compile the test project into a JAR...