Testing Your Android Apps for QA, Page 2
But How Do I Test An Android App?
There are a number of ways to approach Android app testing. You can create automated tests to exercise your application systematically. You can tackle it from a white box perspective, diving into the guts of how the application works and debugging at the code level. You can approach it from a black box perspective, using the application exactly as a user might (e.g. randomly). (This is hard for the developers and designers to do - they tend to want to use it how it was designed.) Or you can combine these approaches as best to suit your team, your product, your time and your budget. After all, there's no such thing as 100% test coverage. You just do the best you can with what you've got.
What's a Basic Setup for Automated Testing an Android App?
You've got a couple of choices for automated testing. To start, there is the unit test framework built into the Android SDK. You can use it to develop robust test suites in Java to verify specific functionality available within your application. There is also a set of python APIs called monkeyrunner for automated testing of applications. You can write scripts that install and run applications, send specific keystrokes and take screenshots. There's also the Exerciser Monkey tool that, while similarly named, is for much more random testing. You can think of it as a virtual monkey mashing at the screen and keys.
What's a Basic Setup for White Box Testing an Android App?
There are also a lot of tools you can use to test different aspects of your application. Many of these tools fall into the white box testing category:
- The Eclipse development environment and its debugger
- The Android SDK and related plugin for Eclipse
- The Android emulator
- Android devices enabled for development and debugging, with appropriate USB drivers as necessary
What's a Basic Setup for Black Box Testing an Android App?
To black box test an Android app simply need access to the target devices to test on, as well as some mechanism for accessing the application package file and installing it on each device. This could be an internal website, or via USB, or what have you. Here are some more important Android tools that can help with black box testing:
- The Android Debug Bridge (ADB) tool can be used for communicating and interacting with devices and emulators. It has a shell interface, which can be useful for installing and uninstalling applications, copying files to and from devices, capturing log output without the hassle of having a development environment set up, inspecting app databases, etc.
- The http://developer.android.com/guide/developing/tools/monkey.html Exerciser Monkey stress testing tool can help hammer your application with input.
- The Hierarchy Viewer and
layoutopttools can help diagnose problems with user interfaces.
What if I Cannot Get a Hold of a Specific Android Target Device?
Sometimes you want to target devices that are not yet released or difficult to get a hold of. There are companies and developer programs (often through manufacturers or carriers) that provide device lab time for you to test your apps. You can also use the Android emulator to create and perform scenarios that are not easily reproduced in the real world, for one reason or another. Just remember that the emulator is only a software representation of the device, and will not behave exactly as a real device.
There are also a variety of programs from manufacturers, carriers, and third-party companies that provide remote access to devices. These usually allow you to load apps onto devices via a Web service or application, and then control the device remotely. The level of control depends on the service. So does the cost. One example is Samsung's Lab.dev.
Any Other Testing Options I Should Know About?
There are also third-party testing companies out there that specialize in testing of mobile applications. They range from full testing teams to Web tools to test your app on a variety of devices. If you don't have the time or resources to hire and manage an in-house test team, these options may work better for you.
Quality assurance is a much overlooked area of Android and should be considered essential part of the mobile application development process. The Android SDK provides many resources to support the different kinds of testing approaches out there, including automated testing, black box and white box testing, as well as performance and stress testing. Really, there's little excuse not to test your applications thoroughly and it's one of the most straightforward ways to ensure your reaches "killer app" status.
About the Authors
|Shane Conder and Lauren Darcey--Contributing Editors, Mobile Development--have coauthored two books on Android development: an in-depth programming book entitled Android Wireless Application Development (ISBN-13: 978-0-321-62709-4) and Sams Teach Yourself Android Application Development in 24 Hours (ISBN-13: 978-0-321-67335-0). When not writing, they spend their time developing mobile software at their company and providing consulting services.|
Page 2 of 2