M is for Monkey – the evilest testing tool around

I do a heaps of Android development and whilst it appears straightforward there are quite a lot of subtleties, particularly when dealing with threads and UI updates, that generate all sorts of app crashes.

Unfortunately these race conditions are often very hard to reproduce. Thankfully (and evilly) we have the monkey testing tool. Set it loose and it frantically taps and swipes away, switching activities, causing mayhem and inevitably crashing your app.

Running monkey is really easy just, run the adb tool with the following parameters:

adb shell monkey -p your.package.name -v 500

Also make sure you run monkey on your app, on different versions of Android, especially if you use the support libraries which don’t always behave the same way on different OS versions. You will be surprised at what goes wrong.

Let loose the monkey and despair ☺