A coding kata is a way to practice something to get better at it — just like the karate counterpart. I also use katas to get familiar with new tools and approaches.
In Android, it’s difficult to get started with TDD because JUnit isn’t supported natively in the JVM. Robolectric gets around this restriction, but must be configured each time.
I started using Robolectric when creating the HowAboutWe app. I learned how to incorporate TDD in my daily practice, but the project was already set up when I arrived on the team.
When the contract completed, I distilled what I learned for other newbies. The first step was learning how to configure the tool in a reproducible way. I used maven and wrote instructions that broke it down step by step. Once I had these instructions, I used them as a kata to become fully comfortable with the tool.
I held off on switching to Gradle for a long time, mostly because it was too difficult to use Robolectric inside Android Studio. Most approaches didn’t include the debugging and visual tools that the IDE gives you — which was a deal breaker.
Finally, late last year, instructions were published for getting it working in Android Studio (configuration and IDE integration). Although these instructions are a great starting point, they don’t take you all the way.
Eventually I mixed two different approaches and turned my detailed notes into the “Hello Robolectric” chapter of the Android Activity Book. The beta version of the book (already at 239 pages!) is available now. Note: You receive free updates as they are published.
What do you use katas for? Let me know in the comments.