O'Reilly logo

Android Application Testing Guide by Diego Torres Milano

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Introducing Robolectric

Robolectric (http://pivotal.github.com/robolectric/) is a unit test framework that intercepts the loading of Android classes and rewrites the method bodies. Robolectric re-defines Android methods so they return default values, like null, 0, or false, and if provided it forwards method calls to shadow objects giving Android behavior.

A large number of shadow objects are provided, but this is far from complete coverage, however it is improving constantly. This should also lead you to treat it as an evolving Open Source project, for which you should be ready to contribute to make it better, but also to depend on it with caution because you may discover that what you need for your tests has not been implemented yet. This is ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required