What options are available to run unit tests with MonoTouch ? That was one of the first question I asked myself when I started working on MonoTouch (xTouch at the time). In my limitless dreams I imagined people using one (or both) of two strategies.
1) Run your unit tests on your main, development, computer.
- Easy (use the tools you know) and fast (many cores/Ghz are available);
- If you share code (with other .NET desktop, web, [Silver|Moon]light, Mono for Android… applications) then sharing tests is the next logical step.
2) Run your unit tests on your devices (and simulator), because:
- some API are only present in iOS (and at some point mocking is not option anymore);
- MonoTouch has some limitations (e.g. no code generation) and missing API (e.g. reflection.emit) that you want your code tested against;
Since I knew option #1 would always be available I starting looking for a iOS unit test runner. Surprisingly I did not find anything – even after asking on stackoverflow (and yes the number of votes I got surprised me too).
So the hacker in me started forking. First NUnitLite for the unit test framework, next Miguel’s MonoTouch.Dialog for UI and finally a (very small) bit of my own logic to glue them together: Touch.Unit was born.
It’s plain KISS and I don’t plan a lot of extra features (just fork it but it allows developers to easily create “test runner applications” and have them executed (and debugged) on the iOS simulator and devices – and that’s makes me happy and you’re welcome to join me in my happiness.