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

Share
More from Mobile development with Alex

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.