Trying to do test driven development for Android applications can be a painful process and cause an already receding hairline to accelerate. The Android Test framework is slow, and requires either an emulator or a physical device to test upon. There are other solutions like Robotium or UIAutomator but these lend themselves to writing tests that drive the UI and lean toward Integration tests. While these are necessary part of testing, they don't provide quick feed back to the developer. In this talk David Carver will discuss lessons learned from using Robolectric 2.3 and Mockito to bring some sanity to unit testing Android applications. Allowing for a true test driven development with fast test execution and fast developer feedback of failures. We will review some dos and don'ts when using Robolectric, and when Mockito may be a better fit. Examples will be shown from using these frameworks to provide unit test coverage for an Android TV application, but the same techniques can be used for any Android application.
David Carver has over 20 years in software development, ranging from the big old Mainframe to mobile applications. His primary expertise are in E-Commerce and business to business development and deployment. He is a co-creator of the XSL Tools project at eclipse, and has been a committer on several eclipse projects including Vex, XQuery Tools. He is creator of Serenity for Android a Plex Media Server client focused on the 10 foot viewing experience for Android TV, Google TV, and Amazon Fire TV devices. At the Eclipse Foundation he is a member of the Eclipse Architecture Council. He is currently working for Manifest Solutions doing Android and Eclipse development.