When we started preparing our development infrastructure for the RadControls for Windows Phone 7 suite one of the interesting challenges that we faced was the automation of the unit tests execution. Of course, each developer could run the tests on their local machine manually, but this approach is rather cumbersome, especially when the amount of unit tests grows as the project evolves. Therefore we decided to take some time and research the possibilities for running our unit tests on the Windows Phone emulator automatically by integrating them with our MSBuild projects.
The idea we came up with is quite simple in theory, but it contains some trickery regarding its implementation. Basically, the approach is to utilize a custom MSBuild task which is executed after a successful build. The task would take the already built unit test application, install it on the emulator and run the tests. After the test execution finishes, the task will read the results and import them in the MSBuild log that will be output to the developer in Visual Studio. The following diagram visualizes the automation process:
With this blog post series I am going to thoroughly cover the whole execution chain in details by providing explanations of the ‘gotcha’ moments I have come across during the development. The currently planned blogs withing this series are:
Introduction - what you are currently reading
Overview – a brief explanation of the whole infrastructure
The test runner MSBuild task – a technical overview of the custom MSBuild task that runs the tests, acquires the results, and integrates them into the MSBuild log
The Windows Phone unit test application – details about the Windows Phone unit test application and the way it aggregates the unit test results and passes them to the build task
The Unit Tests Results Communication Web Service – used by the unit tests application and the MSBuild task to store and read unit tests information
So, if you are interested in learning a possible way to speed up and enhance your Windows Phone development, check out what I have to share with you within the next weeks!
Happy Windows Phone development!