Kata: Simple Android App

One of my favorite tools for creating polished apps is Robolectric, which allows you to unit test directly in your IDE — fancy debugging and everything.

I’ve been kicking around the idea for a while to create katas to practice technique and help others start out with the tool. I didn’t want them to go through the same pain of spending several minutes (or hours) trying to piece together disparate suggestions for how to test something simple!

One of these days I may write Robolectric the Missing Manual, but in the meantime, I created a kata that covers some basic test types:

  • Presence of views and non null-ness
  • Correct string and drawable resources
  • Presence of fragments
  • Button functionality
  • Toast functionality
  • Starting a new activity

It’s designed so that you can do it over and over again to get comfortable with the basics of unit testing in Android Studio. There’s also a solution.

Hope you find it useful!

P.S. If you want to practice your own katas without fussing with the integration of Robolectric — check out: http://github.com/colabug/AndroidKatas.

P.P.S. Check out my book for an entire test driven app.

Leave a Reply

Your email address will not be published. Required fields are marked *