O'Reilly logo

Android Application Development with Maven by Patroklos Papapetrou, Jonathan LALOU

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

Real unit testing with Robolectric

So far, we saw how to run Android unit tests using Maven in an emulator or a real device (smart phone, tablet, and so on). If you have followed the examples provided in this chapter, you should have noticed by now that running activity unit tests is quite slow. Every time we need to follow the cycle of building the project, then deploy this to the device/emulator, and finally launch the application and run the tests. This automatically is done by Maven, but it is clearly not according to one of the core concepts of Unit testing: Run tests fast!

There must be a more clever way to do this, and it has a name from the future: Robolectric (http://robolectric.org/) is an Android unit testing framework that lets us run ...

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