samedi 3 janvier 2015

What are the best, up-to-date tools/frameworks/libraries for Android unit and integration testing?

I'm starting to write unit and integration tests for my Android app. However, it's quite hard to get good, up-to-date info on this topic.


There is a series of "Best practices for testing" and "Testing fundamentals" articles on Android Developer but they seems to be really outdated - there are references to Eclipse only and no mention of some very popular frameworks like Robolectric or even Google's own Espresso.


I was looking for some guide, comparison or StackOverflow question pointing me in the right direction but again - up-to-date is main requirement. Even if information is up-to-date is either too brief or doesn't compare much.


For now, my main candidates for implementing unit tests are:



  • AndroidTestCase - because of general opinion on unit tests on Android I think I will just pass on this one

  • Robotium - from what I read it seems to be outpaced by...

  • Robolectric - which runs directly on JVM, what makes testing faster

  • Espresso - rather for UI/integration testing, I presume? Code structure looks really nice

  • Roboguice - not for testing per se, but its mocking capabilities seems to really appeal to testing crowd

  • Mockito - similar to Roboguice, used with Dexmaker (another dependency) supports Dalvik runtime

  • Hamcrest - not Android specific, but I've seen it a few times with Android context.


All above are just my brief thoughts, for now I'd go with Robolectric, Roboguice and Mockito - just because they seem to be supported and popular. But I created this question to get your experience. I'm just a beginner in the topic so all suggestions are welcome.


Did I miss something? Did you try some tool/framework that was really painful to work with? Or maybe you have some very positive experience?


There was a similar question with almost 800 upvotes and despite many complains - it was closed. I think it's really helpful to have a piece of advice for Android testing beginners here.


Aucun commentaire:

Enregistrer un commentaire