Unit testing and MonoTouch ?

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.

This slideshow requires JavaScript.

About these ads

About spouliot

Xamarin Hacker, Mono Contributor, Open Source Enthusiast with strong interests in Code Analysis, Cryptography and Security. Presently working on MonoTouch, previous projects were Moonlight and libgdiplus and a lot of the cryptographic work done on Mono.
This entry was posted in mono, monotouch, touch.unit, xamarin. Bookmark the permalink.

16 Responses to Unit testing and MonoTouch ?

  1. Awesome, like freaking Christmas. Was hoping you’d start an open source project like this when I saw the SO question. I probably won’t be able to sleep tonight!

  2. Prashant says:

    Thank you for this. Do you have any plans to port it to Mono for Android?

  3. Pingback: Linker vs Backing Fields | surprisingly unimpressed

  4. Seth says:

    You should probably make that the accepted answer on SO :)

    Nice work

  5. Pingback: Andr.Unit joins the family | surprisingly unimpressed

  6. ianvink says:

    This is an excellent summary, thanks for taking the time.

  7. Pingback: Linker vs Linked Away exceptions | surprisingly unimpressed

  8. Pingback: Andr.Unit features parity | surprisingly unimpressed

  9. Pingback: Touch.Unit getting closer to you | surprisingly unimpressed

  10. Pingback: Touch.Unit Automation Revisited | take a bit, get a byte

  11. Pingback: It's the Tests » Blog Archive » NUnitLite 0.7 Release

  12. Pingback: Touch.Unit vs NUnitLite 0.7 | take a bit, get a byte

  13. Pingback: Graphics vs Resolution Independance | take a bit, get a byte

  14. Pingback: Mono for Android–Beyond getting started | roundcrisis.Find<Solution>()

  15. Pingback: Touch.Unit vs NUnitLite 1.0 | take a bit, get a byte

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s