mercredi 28 janvier 2015

Latest best practices for CI and testing Android

There's quite a lot info out there on testing your Android applications however quite a lot of it is a bit outdated. In addition there seems to be a lot of various libraries hacked together to "help" running tests. This makes the situation even worse as some of them are no longer needed/supported and it's confusing if you're not sure where to start in the first place. Also not particularly helpful the fact that Google has yet to update the Testing documentation to include Android Studio.


I was hoping someone could recommend some best practices around CI/Testing on Android? What I've gathered so far:


1) Robolectric seems like a great tool that can mock up Android classes and allow running tests outside of a device/emulator (i.e. faster turnaround). However, it supports only up to SDK 18 and if you want to test against anything later than that - you're out of luck.


2) Android Test Framework requires having a device/emulator so it's slower than Robolectiric cause the apk needs to be installed etc, and will lack some of the cool functions you get from shadow classes. However, should run on all version of SDK and should be ok for UI/Regression/Functional/Integration test suits (i.e. anything but Unit tests).


3) There's always JUnit - if the app contains a lot of pure Java code.


So what would be a good pattern? Robolectric/JUnit for unit testing, then Android Test Framework for covering latest SDKs and real devices? Any thoughts/recommendations?


Aucun commentaire:

Enregistrer un commentaire