Android

Four practical tips for testing your Android apps

Android fragmentation makes testing apps even more of a challenge. Read one Android developer's app testing suggestions.

AndroidFragmentationShankland_thumb_100113.jpg
One of the most difficult aspects of programming for Android devices is supporting the massive number of display sizes, operating system versions, and processors on the market. According to a July 2013 Gizmodo article by Peter Ha, there are nearly 12,000 different Android devices available, running eight versions of the operating system. Compare that with iOS, where a developer can count the number of devices he or she must target without running out of fingers, and you begin to understand the challenge that is unique to Google's smartphone operating system.

Recently, I released a game for Kindle Fire. At the time, I tested the application on a 1st generation Kindle, a 2nd generation Kindle, a Kindle Fire HD 7, and a Kindle Fire HD 8.9. Now, less than a month later, there are three more Kindle Fire devices with very different computing capabilities, two of which also boast increased screen resolution.

Android developers dub this phenomenon as the F word, which stands for fragmentation.  Google has made an honest effort to help reign in fragmentation, most recently by packaging OS type functionality into the Google Play app. But if Google takes away the control it has given to the OEM and device manufacturers, the company loses a significant tactical advantage against competing and manufacturer-grown operating systems.

All of this puts a big burden on Android developers, particularly those of us who are working alone or as part of a small team. I cannot overstate the importance of testing your app on actual hardware. The emulators Google provides are great, especially for debugging, but there is no substitute for getting your app on myriad devices before it goes to Google Play.

These are tips I've compiled over the last four years testing my Android apps. Feel free to share your suggestions in the discussion.

1. Own at least two different Android devices.

If you don't have at least two Android development devices, get on eBay and buy one or more devices -- it's money well spent. I keep at a minimum a 2.3 device, a 3.1 tablet, and a 4.x device on hand.

2. Enlist your friends and family to help test.

I have a son and six nieces and nephews, and they all have an Android phone or tablet. All of them are more than pleased to try out different versions of my apps in exchange for a testing credit on the About screen that they can show their friends when the app becomes available.

3. Make friends on the Android Developers forums.

You don't have to sit face-to-face with someone to get feedback about how your app performs (or fails to perform) on a particular device, especially if the person testing your app is also an Android developer. I keep in touch with several developers I met online, and we swap APKs so we can test apps on our combined hardware set. It usually only takes a few minutes to determine if an app looks or behaves wonky on a particular device.

4. Visit your neighborhood electronics store.

The sales guys at my local Best Buy know me. They see me frequently at the tablet display, pen and paper in hand, loading an app and testing it on the latest and greatest hardware. One nice thing about Android devices is you can side-load an app pretty much anyplace there is access to the Internet. I recommend spending a few bucks a month to get an FTP site to house your APKs in progress and take advantage of Android's flexible application loading model.

Read more about Android fragmentation on TechRepublic

About

William J Francis began programming computers at age eleven. Specializing in embedded and mobile platforms, he has more than 20 years of professional software engineering under his belt, including a four year stint in the US Army's Military Intellige...

3 comments
patrickwalters
patrickwalters

While I agree that Fragmentation is a significant problem, it is a reproduction of the problems faced by Windows PC users 15 years ago.  Imagine you have 5 display adapters, 4 Network Cards, 3 Sound Cards, and 2 modems.  How many separate tests (at a minimum) would you need to test Setup?

It is the attitude of letting friends and family test your apps that again puts Testing in the discarded, unimportant pile it is so often found.  As a professional software tester for the last 15 years, I can say with certainty that (most) friends and family cannot possibly test accurately, reliably, and with the proper amount of memory or detail to find all of the most significant bugs and workarounds to shorten the amount of time the developer spends searching to fix the issues.  To me, it is as ridiculous as saying, "Because you are on a small team, let family and friends alter your code themselves to better fit the MVC or MVVM model.  It will save time and energy."  Are family and friends (most of them) competent to do so?  

Your small team needs a professional software tester, who wants you to succeed, but knows he or she is there to find your bugs and report them in a way that lets you find the issues quickly and fix them.

authorwjf
authorwjf

@patrickwalters 

Thanks for the comments.  I agree that unit testing is important.  I sure didn't mean to give the impression that friends and family can replace that level of testing.  That said, there are so many issues that you simply don't see until you get the app on a device.  I can't say why that is for sure, having been a part of writing PC applications 15 years ago, I can only say I run into more compatibility issues in the mobile space.  So the more devices I can get an app on before release  the better.  For me, getting everyone I know to try the app on their device is an inexpensive way to do that.  In my experience, if you are writing your code and tests responsibly as you go along, these device specific bugs are the ones that will slip through your safety nets.  And no amount of MVC or MVVM or JUNIT testing is going to help with that.