RoboGuice and Robolectric are pretty great you guys

Had this blog been in existence a couple of months ago then there would be many posts related to my Android angst.

Coming into Android from a C# world, well, it makes you take back every bad thing you’ve ever said against Microsoft.  Everything .NET gives you for free you have to pay for in blood in Android.

One of many complaints is how hard it is to do anything test driven.  You have to use JUnit 3, so all your tests has to have the word “test” in it


And it takes for ever to run each test.  For a little while there I was wondering if it were actually possible to do test first.  And then…magically from the internet ether I read a blog post.  If you’ve got anything to do with Android programming you owe it to yourself to go and read that.  I won’t rehash all the setup in that post, just what the outcomes are.

1.  Tests now run in the JVM, so they run quickly.  The 130 odd tests we’ve got written so far are all done in about 30 seconds.

2.  Robolectric has loads of really nice little features (more details in future posts)

3. RoboGuice is a really nice injection framework – and with a bit of setup, is very easy to hook in with some mocks and Robolectric (all detailed in the previously mentioned post)

I have read some complaints that RoboGuice has quite  bit of overhead in terms of space and start up time.  Fortunately for us, we’re writing something that will be essentially a kiosk, run all day long, so start up time is of no concern.  That being said we’ve also not face any problems with this yet at all.