Android Application Testing Guide

Testing appears to be the least popular topic in Android development circles based on the relatively few books on Android app testing. Most tend to focus on development because, unfortunately (but true), application testing isn’t be something most developers think much about, or if they do, they don’t do it systematically (I’m guilty of this as well). This book has allowed me to expand my horizon by learning from the pros.

The “Android Application Testing Guide” is a very practical book introducing available frameworks and most widely used tools & techniques to improve the quality of Android applications by engaging in quality control and testing throughout the development cycle, not just testing at the end. The Agile development concept, called the Test Driven Development (TDD), relies on repeatable short cycles to catch and address potential defects (i.e., bugs) as early as possible.

The first chapter explains what’s involved in the different stages of testing in Android development including unit tests, integration tests, functional or acceptance tests, system tests and performance tests. It introduces the Android testing framework extending JUnit which provides the complete testing framework suitable for the end-to-end testing strategies.

Chapter 2 deals with testing with JUnit which is the default framework for any Android testing project and is supported by Eclipse , the most widely-used IDE for Android development. The chapter jumps right into a step-by-step on how to create an Android test project separate from the development project being tested. The test project will have an independent structure and a set of its own components. Having a separate project is the best practice because from a production build’s standpoint, testing codes will not be included in the actual build, thus it will be not be in the APK.

Chapter 3 dives into individual building blocks in the Android SDK tool. This covers Assertions, TouchUtils class (to simulate the touch events), Mock objects (to simulate mock objects in order to isolate the tests), TestCase class, and Instrumentation. There is an extensive explanation of each individual component accompanied by code samples.

Chapter 4 talks about the concept of Test Driven Development. Again, it is the strategy of performing tests along the development process – not at the end as in the traditional approach. This even includes writing test cases (and test codes) right after studying the requirements, and then writing the actual code to satisfy (having attained “pass” results) the test cases. The author claims that creating test cases early on will help ensure that tests will be performed. Delaying testing makes it highly possible tests will forgotten or ignored. I agree with the concept, but in reality, this may not work for projects. Even the author advises to use judgment and expertise in applying the approach wherever suitable. The latter part of the chapter shows examples of applying TDD in step-by-step sample applications and tests, which makes the case very compelling.

Chapter 5 introduces the Android Virtual Device (AVD), the next best thing to real devices. The obvious advantage of AVD is the ability to create a variety of Android configurations to run tests. The Headless Emulator is also mentioned. This enables automating tests via command line with no windows. I really enjoyed the samples of what you can do with command-lines, especially simulating different device conditions including network bandwidth throttling, different locales, etc. Later in the chapter, it talks about the support of the Monkey application (you can read more about Monkey Theorem here) which allows random event generation. It also demos the server-client setup and test scripting with Monkeyrunner.

Chapter 6 discusses the Behavior Driven Development approach, which according to author is considered the evolution of TDD and a need for Acceptance Testing. The approach emphasizes not only business or end users in testing, but also to use non-technical terms in the test cases that business or end users would understand. Personally, I think the concept is more abstract than practical. However, the introduction of Fitnesse and Slim tools point out this concept’s usefulness especially in terms of “Wiki”-style test cases and test result documentation.

Chapter 7 contains practical, real-world samples of the disciplines and techniques you can use in different situations. This includes testing activities and applications, databases and Content Providers, UIs, exceptions, parsers and memory leaks. A couple of tools are introduced here including EasyMock which provides mock objects for interfaces, and Hamcrest which is a library of matcher objects for comparison.

Chapter 8 expands on the Agile technique with continuous integration. Similar to continuous testing, the author suggests that integration should be done frequently and early in the process in small steps. The most common practice is to trigger the build process after every submission to the source code repository. The chapter goes into detail on how to setup an automation building process using ant, version control repository using Git, continuous integration with Hudson, and test result analysis using nbandroid-utils.

Chapter 9 discusses one of the most critical components in designing Android applications – performance. As we all know, mobile devices are unique and balancing between performance and effective use of resources is something developers must keep in mind when designing an Android application. The chapter contains an outline of tools and techniques for performance testing. This includes using traditional LogCatlogging, extending Instrumentation, Traceview, dmtracedump, and Caliper microbenchmarks.

Chapter 10 states that alternative testing tactics are not for most Android developers as it involves building Android from source code, and introduces more testing tools. Even though it is very technical, it is still a good read.


I have to say that as a novice Android developer I learned a lot from reading the Android Application Testing Guide. Best-in-class testing techniques commonly practiced in Agile development are covered in this book. These include Test Driven Development, Behavior Driven Development, Continuous Integration as well as others. The traditional approach of testing and integration at the end of development cycle is generally opposed. However, as the author states in the book, there are no silver bullets in software development – the suggested testing approaches might not apply to certain needs or projects. It is clear that for a large, complex project, applying the methods and techniques as described will likely increase the productivity and quality of your apps.

Numerous tools are introduced in this book. This may be one of the big issues for those who are less-advanced in Android development. Since there is no common repository for these tools, extended knowledge of a variety of open-source tools, and the ability to incorporate them in the development process are vital. I wish that there were a consolidated repository for all testing tools or even better – all required testing functionality would be built-in in the SDK. But while we wait for that to happen, the Android Application Testing Guide is one of a few reference books I’m aware of that has the complete collection of Android testing topics.


Ittichai has been involved in many aspects of Oracle database technologies including RAC, ASM, Data Guard and Streams. He enjoys working on database and SQL performance tunings. He’s also interested in rapid web development using Oracle APEX.

He is currently an IT technical manager and data warehouse architect with Motorola Solutions.

Ittichai Chamavanijakul
Ittichai has been involved in many aspects of Oracle database technologies including RAC, ASM, Data Guard and Streams. He enjoys working on database and SQL performance tunings. He’s also interested in rapid web development using Oracle APEX.He is currently an IT technical manager and data warehouse architect with Motorola Solutions.

The Related Post

Whether Or Not You Have a Mobile App You’re walking down the street. You see something interesting, and you want to know more about it. What do you do? Do you wait until you get home, open up your laptop, and type “” into your search bar?
Great mobile testing requires creativity to find problems that matter. I’d like to take you through the thought process of testers and discuss the types of things they consider when testing a mobile app. The intention here is to highlight their thought processes and to show the coverage and depth that testers often go to.
Steps that will enable you to identify the weaknesses of your new app, its vulnerabilities and strengths. So you’ve just finished developing a nifty, customisable app that can help farmers track their produce from source to market via their mobile phone. You’re elated and want to get started marketing it right away. Not to burst ...
LogiGear Magazine December 2012 – Mobile Test Automation  
LogiGear Magazine – November 2011 – Mobile Application Testing Issue
A sampling of some free, online, and easy-to-use mobile device emulators that can help get you started with testing. ScreenFly A free, customizable tool to test your website on any screen size, including desktops, tablets, televisions, and mobile phones.
The outbreak of smartphones and tablets forces us to be digitally available with speed. Keeping pace with communication tool developments, Lindiwe Vinson defines the methods used at Organic, Inc. where she leads her team discovering bugs using various key programs for both PC and Mac platforms.
The most significant facet of mobile testing is understanding the mobile ecosystem. Mobile applications are growing in use and sophistication along with the speed of the networks and the increasing power of the devices. To be sure, mobile application testing can be done with minimal automation, but a high level of test automation will help ...
In the last issue on testing the SMAC stack we talked about the social and mobile aspects of testing. We will be referring to them in this article. In this issue part 2, we focus on the Analytics and Cloud aspect. The goal of this article is to understand a simple landscape of analytics and cloud.
Devices matter. We don’t yet trust the mobile devices like we trust desktops and laptops. In the course of testing traditional web applications, rarely do you have to think about the model of the actual machine. In mobile, however, the behavior of an application can vary from device to device. You can no longer just ...
25% of Americans own a tablet. Up from 11% of U.S. adults in July of 2011 to 18% in January of 2012. – Pew Internet & American Life Project Nigeria has close to 100 million mobile phone lines, making it Africa’s largest telecoms market. – Nigerian Communications Commission Google plans to sell 200 million Android ...
A fully integrated test automation platform for mobile testing Mobile application testing is taking on greater significance as just about everything done on the desktop is transitioning to mobile. It’s taken a while for mobile testing in the consumer space to be made much of a priority. Now that sensitive data is being passed back ...

Leave a Reply

Your email address will not be published.

Stay in the loop with the lastest
software testing news