First steps in Android Studio for testers

iteo
6 min readOct 21, 2022

--

Android Studio is the official IDE software designed specifically for creating Android apps. It can also be used for efficient and smooth testing of Android mobile applications by QA. Basically it is the most used integrated development environment and probably a big amount of apps on our Android devices are made and effectively tested with this tool.

What makes the Android Studio very easy to set up Android development is the Gradle-based build support. Besides that, it provides built-in support for Google Cloud Platform, enables integration with Firebase and Google App Engine. Excellent graphic user interface is also worth to mention as it makes the process of creating an app even more accessible and enjoyable. Except Java and Kotlin, Android Studio supports other programming languages like C++ and provides all what can be needed for users.

However, there is a lot to talk about all functionalities in Android Studio, I’d like to focus on testers’ perspective. Android Studio provides a few very useful features when it comes to testing our mobile app. Have you ever needed more devices to test your app, wanted to see logs or inspect the layout of your app? Say no more, the Android Studio gives you exactly what you need, and those solutions are splendid.

The very first step before we start using Android Studio is to download and install the IDE. The Android Studio is free and can be used on macOS, Windows and Linux. Fortunately, the installation process is easy, comfortable and couldn’t cause any problems for anybody. Simply follow the setup wizard and install any recommended SDK packages.

Once we installed everything correctly, it is time to start a new project. Android Studio makes it even easier than we could expect. We are able to choose a template for our app. We can start from many available templates. This is very intuitive as each template image shows us the approximate design of our future app. There is also the possibility to start from scratch or ‘No Activity’ which creates only a files structure.

Next step is naming our project, choosing the language for development and minimum SDK. If the project we create is simply for learning, the language and SDK are not as important as it is when it comes to creating a business app. Once we correctly finish previous steps, we can finally move to a QA perspective.

Android Virtual Device

AVD can simulate a lot of devices with Android, so we are able to test our application and Android API levels without actual need of any physical device. It is very flexible as the emulator has plenty of options like Android phones, tablets, Wear OS or even Android TV’s. Besides that, testing our app on an emulator can be easier and faster than on a real device connected through USB.

For creating a virtual device, simply start by clicking Tools > Device Manager.

On the Device Manager window, click on Create device. Now we have to choose from categories: TV, phone, wear OS, Tablet, Automotive, and pick specific device. We will also be able to set new hardware profile or import existing one.

The next step is to select API level and navigate to the last step. If everything is correct click Finish, in other case we can change AVD properties here.

To launch a newly created virtual device, open Device Manager and click Run.

As an alternative, we can run the emulator through the command line. Below basic command line syntax for launching AVD.

$ emulator -avd avd_name [ {-option [value]} … ]

Or

$ emulator @avd_name [ {-option [value]} … ]

On MacOS command line will look similar as follows:

$ /Users/user_name/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full

For displaying a list of AVD names, type:

$ emulator -list-avds

Logcat

In the Logcat window, we will see plenty of system messages from our device. It displays all messages in real time and keeps a history, so we will be able to look into older messages.

If we need specific information, we can create filters, modify the amount of displayed messages and set priority levels.

To open the Logcat window, click View > Tool windows > Logcat or click on Logcat in the bottom tool window bar.

The Logcat shows the logs for selected device (emulator or physical device) or selected app.

Every log message has a tag and a priority. The tag is a short string that shows where the message comes from. The priority is one of the following values:

  • V: Verbose (lowest priority)
  • D: Debug
  • I: Info
  • W: Warning
  • E: Error
  • A: Assert

The very helpful thing is that we can control how many messages will be prompted in Logcat. From the log level type one from values below:

  • Verbose: the default — displays all logs
  • Debug: displays debug logs, useful during development
  • Info: displays expected log messages for regular usage
  • Warn: displays issues that can possible cause errors
  • Error: displays issues that have caused errors
  • Assert: displays issues that the developer expects should never happen.

Layout inspector

This functionality is another one which can help testing our app. The Layout Inspector lets us debug the layout of our app simply by displaying a view hierarchy and letting us test and inspect properties of each view. The Inspector visualization is interactive, so we can easily check any components’ attributes. To launch the Inspector, run our app on an emulator or connected physical device, then click Tool > Layout Inspector in Android Studio.

The Layout Inspector displays Component Tree, Layout Display and Attributes.

The Component Tree displays — in real time — our app’s hierarchy. It can help debug layout as we can see the elements within our app and values connected with them.

The Layout Display renders the exact layout of our app as it can be seen on our device. For working with more complex layouts, we can pick and isolate a specific individual view so that only a subset will be shown in the Component Tree or Layout Display.

The Layout Display supports an advanced 3D visualization, which can help when our app has more overlapping components. The feature can be easily used by clicking the 3D Mode button.

The last thing worth mentioning is that we can compare our app layout with images like design mockups. Select Load Overlay from the Inspector toolbar.

The overlay will be scaled to fit the layout, which is even more user-friendly.

Final thoughts

As a summary, I can tell, Android Studio can be very helpful and enjoyable while testing our apps. Entry threshold is not as high as we could expect and even with lack of experience or some knowledge it can be easily learnt while using Android Studio. If you haven’t tried it yet, then there is nothing to stop you from starting to use it now.

--

--

iteo

iteo is an international digital product studio founded in Poland, that helps businesses benefit from technology better. Visit us on www.iteo.com