O'Reilly logo

Learning Android Application Testing by Paul Blundell, 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://robolectric.org) 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, such as null, 0, or false. If available, it forwards method calls to shadow objects, mimicking 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 not in any ...

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