Android Testing

Efficient Testing Android app – Tools

Alex Zhukovich 3 min read
Efficient Testing Android app – Tools
Table of Contents

Efficient UI testing series

Layout Inspector

Let us start with a tool which is a part of Android Studio; it is called "Layout Inspector". It's a powerful tool which allows us to compare mockups from a UI/UX team with a screen from our application. You can find information about each view on the screen. It means that we can use it for getting additional information about each view on the screen.

As Layout Inspector is a part of Android Studio, we should move to required screen on device or emulator and click "Tools -> Layout Inspector" in Android Studio. Next step is choosing a device/emulator. Afterwards, Layout Inspector captures a snapshot and saves it in *.li file. It allows us to compare different versions of the screen from the app.

Note: If you want to capture screenshot from any application, you should install it on a rooted device or an emulator without Google Play. In this case, you should choose "Show All Processes" and select the required process.

Note: It's the reason why you can have additional *.li files in the capture folder.

Layout Inspector demo

As you can see from the screenshot, visually, this tool has got 3 sections:

  • View Tree provides a hierarchy of views in the layout;
  • Interactive Screenshot shows a screenshot of your app with layout bounds of each view;
  • Properties Table allows you to check any property connected with each view on the screen.

UI Automator Viewer

The UI Automator Viewer tool provides a screenshot of an active application on a device or emulator. We can scan and analyse a screen of any application which is installed on the device. This application is not a part of Android Studio; it means that we should run it from {ANDROID-SDK}/tools/bin folder.

Layout Inspector demo

As you can see, this tool splits into 3 sections: screenshot, view tree and properties table. These sections are the same as in case of "Layout Inspector" tool. However, we have not got too many properties in comparison with the Layout Inspector. However, we can scan any application from the device or emulator.

The Layout Inspector and UI Automator Viewer tools allow us to get the required information about views from a different screen in others application if you need this information.

Different parts of our application cannot be tested inside the application, like Notifications, App shortcuts, and so forth. We can use "UI Automator Viewer" for getting information about different applications (if we use not rooted device or emulator with Google Play, otherwise we can get information about any application use "Layout Inspector" and "UI Automator Viewer", like the launcher, to navigate to your application and verify app shortcuts feature for the developing application.

We can use these tools for getting information about views on the screen which can is needed for UI testing.

Mobile development with Alex

A blog about Android development & testing, Best Practices, Tips and Tricks

More from Mobile development with Alex
Not all UI tests are the same
Android Testing

Not all UI tests are the same

The article explores different types of UI testing, such as end-to-end testing, UI testing with fake data, pixel perfection testing, and accessibility testing. The article also includes information on how to get started with UI testing in any project.
Alex Zhukovich 8 min read
How to test Android App Shortcuts
Android Testing

How to test Android App Shortcuts

The "App Shortcuts" feature allows users to access a specific part of the application from the device's home screen. Users can see all available shortcuts by long pressing on the icon of the applications. In this article, we will learn how to test app shortcuts in Android apps.
Alex Zhukovich 5 min read
How to group Android tests
Android Testing

How to group Android tests

Nowadays, mobile apps have many screens so that the projects can have many UI tests. When a project is large, we can have hundreds or thousands of UI tests, and running them locally can be time-consuming. In this article, we will explore different ways of grouping test cases.
Alex Zhukovich 17 min read

Great! You’ve successfully signed up.

Welcome back! You've successfully signed in.

You've successfully subscribed to Mobile development with Alex.

Success! Check your email for magic link to sign-in.

Success! Your billing info has been updated.

Your billing was not updated.