Testing in Android is tricky. First off, the emulator is a wonderful development tool but that is where it stops. It should never substitute testing on actual devices. That wasn’t apparent to me until recently. The HTC Evo, for example, handles pre-main activity launches much better then the MyTouch 4G. The Nexus S has got a super processor which may encourage race conditions to show up. HTC Sense devices don’t handle redirects. Emulator is perfect. Devices not so much.
Another testing revelation is slowing the machine down for network tests. I have been using wi-fi to get through my tests quickly and 3G/4G are still pretty quick. A neat trick is to do that on the computer the device is connected via wi-fi or USB to.
Set a pipe to something really slow:
sudo ipfw pipe 1 config bw 5KByte/s
Set that pipe to port 80:
sudo ipfw add 1 pipe 1 src-port 80
When done delete it:
sudo ipfw delete 1
When testing I’ve made a habit of uninstalling the app and then reinstalling it. The DDMS is quite annoying but it disconnects much less frequency when using an actual device rather than the emulator. Unfortunately, the file interface doesn’t always allow us access to delete files. The OI File Manager is an easy tool to get onto the device and manage cache files, etc.
Using the ADB Monkey tester has its share of things you can discover about your app. The Google documentation suggests using static classes and boy have those come to haunt me. Monkey has helped a lot in that it backgrounds your app in ways you’d never think to test. This can help destroy references which you are relying on giving you an opportunity to discover and fix issues before loosing your creation upon the world.