“Jose Cortes”

Testing in Android with Mockito

As I mentioned in my previous article about testing [Android testing with Robolectric], I have this little obsession with unit testing. Using Robolectric allows me to run the test in the local JVM instead of having to run an emulator or run the test on a real device. Now, Mockito allows me to mock, stub and spy classes to verify different behaviours in the code. We are currently using Mockito to test the Android library we are developing in the…

Unit testing in Android with Robolectric (Gradle edition)

One of the things I was always obsessed with, when developing in Android, was unit testing. The very first thing I like doing when starting a new android project is setting up Robolectric. “Robolectric is a unit test 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.” Because before Robolectric, unit test on android meant launch the emulator and run the test…