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

To help testers gain an edge, here’s a list of free resources Mobile testing is making leaps and bounds of progress in the overall testing space. As this field is highly dynamic, a tester must constantly evolve and improvise his or her knowledge of mobile testing. To help software testers gain an edge, I have compiled the following list ...
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 ...
LogiGear Magazine, September 2015: Mobile Testing
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.
Gal Tunik explains the necessity of test automation in mobile applications, citing the unique challenges that that platform raises, including the intricate differences between mobile and desktop interfaces, and performance test results for applications as well as mobile networks. It is no surprise in this day and age of instant-on gratification that mobile devices are ...
The mobile application ecosystem is very dynamic. OEMs are launching new devices and new customization, and new OS versions are delivered every now and then. This is the constant challenge that most enterprises face.
Organizations need to implement automated testing strategies designed specifically for mobile applications. Mobile device usage continues to gain momentum at increasing speed. Enterprises that delay mobile adoption face the danger of becoming competitively disadvantaged. But, before jumping in headlong, you need to be fully aware of the unique challenges that can arise when developing and implementing ...
This article will cover 10 common mobile app testing mistakes to avoid when you are a software tester working in a mobile app testing and development environment. The 10 points may help you to start your mobile testing activities if you are new to mobile testing or they may help you to recap your existing mobile testing ...
CEO and founder of mVerify Corporation, Robert V. Binder tackles questions from field testers regarding such issues as strategic considerations when dealing with single stack apps versus globalized enterprise mobile apps, and methods and tools that developers and testers should be aware of. He also offers his own advice from lessons learned from experience. 1. ...
I’ve spent the last six months or so testing mobile apps for both iOS and Android. Here’s eight of my key lessons learned: Automated UI testing tools for mobile apps are immature: whilst tools like WebDriver for automated UI testing of web apps are very mature, automated UI testing of native mobile apps is the ...
Drawing from the Greek mythology of the lotus eaters, Anne-Marie Charrett warns testers to be weary of enjoying early success too soon upon finding high impact bugs.
Don’t make the mistake of assuming too many similarities. It is common knowledge that mobile applications don’t function in the same way as their web-based counterparts. The user experience is affected by a few other factors such as device and network capability. If you are building out a performance testing strategy for your mobile website ...

Leave a Reply

Your email address will not be published.

Stay in the loop with the lastest
software testing news