Simon Harriyott

Using MSBuild and the build machine for integration testing

My build machine has been very useful in running unit tests for the various components of the project I'm working on, but having recently spent several days trying to integrate a couple of components to run on a clean machine, I realised that unit testing isn't enough. There were three components that I wanted to use on a clean machine:
These components all have passing unit tests that are automatically run a couple of times a day. There are, by definition, no unit tests that run the three components together. So today I wrote an MSBuild task to automate the integration testing of these components. There was a little pre-work, like creating a merge module for each component, and an installer, and tweaking the configuration files that are installed by default. (Annoyingly, we're still using Beta 2 of .NET, so there's no MSBuilding the .vdproj files yet.)

The MSBuild task took about 3 hours to write and perfect, and in order:
Creating an MSBuild task is really straightforward. Derive a class from Task, add some public properties, and code the stuff. For some slightly more technical details, see Barry Dorrans' presentation and code samples from the last DeveloperDeveloperDeveloper event.

I then created a new MSBuild project file, which:
This worked beautifully, so I added it at the end of the main build script using an MSBuild task. So now I have integration testing running on the daily build machine.