Sunday, December 18, 2011

Redirect Console Output in C#

I've been writing some tools that will duplicate behavior that I get for free in Visual Studio's MSTest framework for MonoTouch. One of the last pieces of the puzzle was the fact that MSTest will log any output to the console as part of the test results XML file. However, it does it intelligently, so that the output for each test is saved with the test results, and any output that is emitted outside of a test goes to the console. So, how could I redirect console output temporarily?

Wednesday, December 14, 2011

Automated Testing with MonoTouch on an iPad

Lately, my work has been focused on a brand new iPad application.  My team consists of around 10 members, and the project, while not containing a single line of code before December 1, will eventually grow to be quite large.  I took it upon myself to ensure that we had a solution for automated testing and continuous integration for the project.  Normally, Apple's tools for automated testing would fit the bill perfectly.  However, we happen to be using MonoDevelop and MonoTouch.  So far, I've enjoyed using these tools greatly.  But there was one issue that made automated testing a huge problem: it is impossible to automatically launch an application on an iPad using any of Xamarin's tools!

Update, 2/17/2012

As of version 5.2.3, Xamarin has added a --launchdev switch to mtouch, allowing you to programmatically launch an application on a device, and potentially making the following steps unnecessary. I am still using them myself, as they give me a way to pass information to my test application on the device, such as the IP address of the build server the device should report back to. But if you don't need that kind of functionality, or have a different method for communicating with your application, --launchdev will certainly make your life easier!