Robolectric : Android Unit Testing Framework
Robolectric is an Android unit testing framework that de-fangs the Android SDK jar so you can test -drive the development of your Android app. Tests run inside the JVM on your workstation in seconds. Robolectric handles inflation of views, resource loading, and lots of other stuff that’s implemented in native C code on Android devices, allowing tests to do most things you could do on a real device. You can also provide your own implementation for specific SDK methods, so you could simulate error conditions or real-world sensor behavior. Robolectric lets you run your tests on your workstation, or on a Continuous Integration environment in a regular JVM, without an emulator. This saves time by eliminating various steps that are otherwise necessary such as dexing, packaging, and installing-on-the emulator.