Android Studio for Retrieving Logs in Mobile Apps Testing

No votes yet.
Please wait...

Introduction

Application development is quite difficult and labor-consuming process which cannot be considered without such an important component as software testing. Android applications development is not an exception.

The article deals with Android Studio tool and its applying in application testing.

So, what is Android Studio?

The definition is taken from the official site and means the following: Android Studio – is an official integrated Android application development environment (IDE), based on IntelliJ IDEA. The given IDE allows to develop applications for any devices using Android OS, such as smartphones, tablets, watches, glasses and so on. Being a development tool, an application has a rich feature set to be in service for a software tester.

System requirements

Here is what the official website tells:

* Windows

– Microsoft® Windows® 8/7 / Vista / 2003 (32 or 64-bit)
– 2 GB of RAM minimum, 4 GB of RAM is recommended
– 400 MB on hard drive + at least 1 GB for Android SDK, system image emulator, and cashes
– 1280 x 800 minimum screen resolution
– Java Development Kit (JDK) 7
– In addition, to speed up the emulator : Intel® processor supporting Intel® VT- x , Intel® EM64T (Intel® 64 ) and Execute Disable (XD) Bit functionality

* Mac OS X

– Mac® OS X® 10.8.5 or higher, to 10,9 (Mavericks)
– 2 GB of RAM minimum, 4 GB of RAM is recommended
– 400 MB of free space on hard drive
– at least 1 GB for Android SDK, system image emulator, and cashes
– 1280 x 800 minimum screen resolution
– Java Runtime Environment (JRE) 6
– Java Development Kit (JDK) 7
– In addition, to speed up the emulator : Intel® processor supporting Intel® VT- x , Intel® EM64T (Intel® 64 ) and Execute Disable (XD) Bit functionality. In Mac OS, launch the Android- Studio with Java Runtime Environment (JRE) 6 to optimize the work with fonts. Then you can configure the project to using the Java Development Kit (JDK) 6 or JDK 7 .

* Linux

– GNOME or KDE desktop
– The GNU C Library (glibc) 2.11 or later version
– 2 GB of RAM minimum, 4 GB of RAM is recommended
– 400 MB of free space on hard drive
– At least 1 GB for Android SDK, system image emulator
– 1280 x 800 minimum screen resolution
– Oracle® Java Development Kit (JDK) 7

Peculiarities of Android Studio

New functions appear with each new version of Android Studio. The following can be singled out:

  • Extended layout editor: WYSIWYG, ability to work with UI components with the help of Drag-and-Drop, layout preview function on multiple configurations of the screen.
  • Application build, based on Gradle.
  • Various kinds of builds and generation of multiple .apk files.
  • Code refactoring
  • The static code analyzer (Lint), which allows to find performance problems, incompatibility of versions and so on.
  • Inbuilt ProGuard and utility for application subscription.
  • Templates of main layouts and Android components.
  • Developing of applications for Android Wear and Android TV support.
  • Inbuilt support of Google Cloud Platform, which includes integration with Google Cloud Messaging and App Engine services.
  • Android Studio 2.1 supports Android N Preview SDK, and it means that the developers can start the creation of new software platform.
  • The new version of Android Studio 2.1 is able to work with an updated compiler Jack, and it has gained an improved support for Java 8 and improved Instant Run feature.
  • Platform-tools 23.1.0 for Linux became exclusively 64 -bit , even when you try to install the 32 – bit version . In other words, Android Studio is no longer working ( gives fatal errors ) in 32 – bit versions.

Installation

Before starting familiarizing and using, we need to download and install the following components:

JDK (Java Development Kit) – is an applications developer’s set on Java. The set includes: complier java (javak), standard libraries of java classes , documentation , examples , executive java system (JRE), as well as the various utilities. In simple terms, Android Studio won’t work without JDK ( the package must be downloaded in accordance with your operating system and its digit. The package is installed first. There is nothing complicated in installation, just follow the instructions of the installer.

And the second component is Android Studio itself. There is also nothing difficult in the installation.

The workflow

One of the main product requirements is the possibility to review application’s logs, which can give more complete information about detected bugs/errors. Android Studio allows to do it, but there are some nuances.

*Be sure that there is USB debugging on the tested device.

*If your device will not be recognized after starting IDE, it would be necessary to update the drivers (it is especially important for Windows OS users).

Viewing of logs

So, if everything is ready, now it’s just a small deal to be done. Start Android Studio and create new project. Then connect your device to the PC with USB and tap “OK” on the device in “Debugging via USB” window. Actually, that’s all.

In the lower part of IDE an “Android monitor” bar is situated, there you can find “logcat” tab, in which you can start tracking logs. Note that at the top of the panel there is a field to select the device currently connected to your PC .

There is also the menu on the “Android monitor” bar that allows to switch between the types of the displayed logs (Log level), so you can view all logs, or only those, that describe certain states, and a little more about each point of the menu:

Verbose – to show all logs ( the default value).

Debug – to show debug log messages

Info – to show logs of constant use

Warn – to show possible problems, that are not problems yet

Error – to show the errors caused by problems

Assert – to show problems that shouldn’t appear


Taking screenshots

One more ability of “Android monitor” is taking screenshots in PNG format on the connected device or emulator. To take a screenshot press   button, after which the Screenshot Editor will be opened. That all that is necessary to know. You can edit and save the image like in the majority of usual editors.

Recording video

“Android monitor” allows to record videos with the device for up to 3 minutes. This is analogous to taking screenshots. For opening recording window press   and set the bit rate and resolution. Start and stop recording by pressing the corresponding Start/Stop Recording buttons.

Testing in Android Studio

Besides the basic functions for detecting bugs Android Studio provides a comprehensive framework, which will validate all aspects of your application. The platform includes tools and API for setting and launching testing application in emulator or real device. Wide range for automated testing of application. Here you can find more information about the principles of testing in Android Studio.

Comparison with competitors

Before exploring Android Studio I didn’t have an opportunity to deal with similar IDE, except for Eclipse, that’s why I can hardly compare objectively, and you can find comparison in the Internet.

Personal impressions

Powerful and user-friendly tool with nice design made for Android platform, which is, in my opinion, its main advantage and disadvantage. Works quickly, at least I haven’t faced any problems. The important fact, that the product is based on IntelliJ IDEA, I worked with JetBrains products before, they are always at the top.

Summary

A great tool for everyday use for a tester who performs manual and automated testing of Android applications. IDE includes large functionality, beginning with such a simple thing like taking screenshot up to writing and executing automated tests. The application is free it it is quite often updated.

Comments are closed.