Touch.Unit Automation

I’ve been hinting about automation but so far it was not easy to run Touch.Unit unattended. That’s improving with the latest committed bits.

First you can set (e.g. inside AppDelegate.cs) the test runner AutoStart property to true to ensure the unit tests execution will start their execution once the application is loaded.

runner.AutoStart = true;

You can also use the runner TerminateAfterExecution property to end the application once all tests have been executed. Note that this is kind of bad (using a private API) – i.e. don’t do this in your own applications because Apple won’t accept such behavior in it’s AppStore.

runner.TerminateAfterExecution = true;

Finally you can also override the default Console.out (or optional network) logger by providing your own TextWriter to be used.

runner.Writer = new TcpTextWriter ("hostname", 16384);

You can reuse the provided network logger or supply your own implementation. E.g. use the new iOS5 (available in MonoTouch 5) Twitter API to give you updates 😉

What do you gain from the above ?

You can automate the build and deployment of several applications. E.g. several runner with different tests or several runners with the same tests but different configurations – like LLVM or SGEN builds.

Once deployed to the device you can quickly run every test runner app by clicking on each of them (since you’ll get back to springboard once execution is over) while every log is being sent to (and kept in) your main computer.

That’s not a fully automated setup, the building/deploying bits needs more love, but that as much as Touch.Unit can do by itself. Feel welcome to share tips on how you can automate the rest of the process 🙂

There’s really not much more I want to add to Touch.Unit (TODO is pretty empty, few FIXME), I think it will serve it’s purpose well. OTOH I’m thinking of one more blog post and/or screencast to show how it can be used (wrt other tools, not itself).

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.

2 Responses to Touch.Unit Automation

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

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

Leave a Reply

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

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

Google photo

You are commenting using your Google 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 )

Connecting to %s