Testing your Android app

Android App Passed InspectionIt can be very tempting to release your Android app immediately after you finish it.  You want it to be available for download on the Android Market as soon as possible, right?

On the other hand, you don’t want to get a lot of bad reviews because you left in a lot of bugs.  It is much better to find and fix bugs before you release your app than to have your users find them for you.

How should you go about testing, then?  There are several types of testing that you should do.

Testing your basic use cases

First, do some testing in the emulator. Fire up your favorite AVD (or create one if needed – see the Android developer site for detailed instructions). Verify that it indeed looks as you intended.

Your layouts should look correct in the emulator, including any ads you are showing (such as MobFox).  If so, everything is working! It is important to test different resolutions and orientations to verify that it always looks as you expect. Test all activities that you have set up to show ads.

Go through the normal use of your application and verify that everything works and looks as you intended, and that the ads haven’t affected the operation of the app.

Automated testing

A more robust test than just pressing a few buttons is to use the automated testing program for Android, called the Monkey. This simulates any number of random actions that you select, allowing you to see if bad behavior can trigger a crash. This is much better than your own testing, because you’re not likely to intentionally do things “wrong”. Users, however, may not know the correct way to use your app and can do very unpredictable things.

You should always use the Monkey before releasing your app, and verify that it can’t cause your app to force close. Read the instructions here to use the Monkey:

https://developer.android.com/studio/test/monkey.html

Testing on real devices

Before deploying your app, it is also important to test on a real device. Test all of the functionality on this device as well, to ensure that it behaves the same as on the emulator.

For each target device that you don’t have access to, be sure to create an AVD with the same settings. For example, how does your app behave on different Android versions, or with different screen sizes? How about a WiFi-only device?

I discovered the hard way, after I got a Xoom tablet, that my app force-closed every time on the tablet. Why? I hadn’t tested on any WiFi-only device configurations. Luckily the bug was easy to fix, but I’ll never know how many tablet users saw that crash and uninstalled my app forever. See here for more details on that adventure.

By the way, you don’t need to purchase Google’s official developer phones to have a test device. They can be rather expensive. You can find a selection of unlocked devices to buy for testing.

Testing by others

Another good option is to get friends and colleagues to help you test your app.  Extra pairs of eyes can help spot things that you don’t.

Going further, there are services that will perform testing for you.  I haven’t reviewed these services yet, so I can’t give you specific advice on how well they work.  I’ll work on getting information on these services in a future post.

Now it’s time for release

After fixing all issues you find in any of these tests, you should have a great deal more confidence that your app will work for the myriad of devices and configurations that users of your app could have.  Now it’s time to move on to the next step.

Posted in Android permalink

About ProjectJourneyman

I am a software engineer that escaped the cubicle world at a large company to go solo with Android app development. My attention to detail and quality applies both to my apps and to my research on how to make money with Android. Now that I have the freedom to work on my own projects, I am documenting my efforts in the hopes that it will help other current or aspiring independent Android developers get the income they desire.

Comments

Testing your Android app — 2 Comments

  1. Good points on an important and difficult topic. Your app can get a bad reputation from the start if it fails on even one device. Users are much more eager to report bad experiences than good ones from my experience. At the same time there are almost 500 different Android devices out there with different screen densities and formats – a testing nightmare for small developer entities. Compare that to iPhone’s 2 versions…

    Another “tool” for testing that I use quite heavily is app stores that have a validation/testing process before accepting a new release. For example Amazon. Some app stores even provide a full test report and list of devices that failed testing. It’s only drawback is that it takes time and holding back a release that feels ready can be quite frustrating.

    Another thing to consider is the release schedule e.g. where to publish updates/new releases first. I tend to put out the latest releases on the low download sites first to get some early feedback and then gradually move the release to the main ones over a period of a few days.

    • That’s a neat strategy. I haven’t utilized the app store validations like that yet (mostly because I’m excited to put my release out as soon as possible), but will consider a more structured release plan.

      Another app store that does validation is the Motorola Shop4Apps, although I haven’t had much success with getting many downloads from their app store.