I’m exploring driving the implementation of TDD on Android and am finding it quite difficult to justify. While I’m a firm believer in TDD, and have used it in other design, I’m facing several key issues:
-
The emulators are slow and unreliable. It feels necessary to test on device to get good information.
-
Testing on-device is typically too slow to be done with alternation between writing a basic snippet of code an a single test case.
I’m experimenting with an alternative approach of writing a full unit-test suite, writing a unit of code, and (if necessary) editing the test-suite to get full coverage of the unit.
The main question I have is: What approaches/modifications to TDD are you using in the mobile space, and are you finding they work effectively?
Feel free to include any recommended frameworks, although this isn’t the primary impetus of the question as there are good answers elsewhere.
Take a look at the RoboElectric project. It enables you to run tests outside of the emulator, so its meant to make Android TDD practical.
I will also try to separate out non-Android dependent code into a library/project that can be tested independently.