MSBuild, MbUnit 2.4 and CruiseControl.NET
Getting all of these technologies synced up was pretty neat to see in
action. I hadn't really done much more than a very vanilla
installation of CruiseControl in the past. I have had a good chunk of
time to dedicate to this project so I wanted to add some bells and
whistles.
At first getting MSBuild and MbUnit to place nicely was a challenge.
For whatever reason, unless you have the MbUnit dlls in the framework
folder and in the bin folder where your test dll is located, MSBuild
will not execute the MbUnit task correctly.
It feels like a hack, but I guess I can live with it. I do hope it
gets some attention in a future release of MbUnit, but if I understand
the problem correctly, it might have to wait for a bit.
I ended up writing this utility MSBuild target to make sure this got
done during a build. This target checks to see if the each of the
MbUnit files needed to execute properly is not present in the
Framework folder. If it isn't found (this condition is only satisfied
on the very first run of the build), we copy the files to the
framework folder.
<Target Name="CopyMbUnitToFramework">
<Copy SourceFiles="$(LibraryFolder)\$(MbUnitFrameworkDll)" DestinationFiles="$(FrameworkPath)\$(MbUnitFrameworkDll)" Condition="!exists('$(FrameworkPath)\$(MbUnitFrameworkDll)')"/>
<Copy SourceFiles="$(LibraryFolder)\$(QuickGraphDll)" DestinationFiles="$(FrameworkPath)\$(QuickGraphDll)" Condition="!exists('$(FrameworkPath)\$(QuickGraphDll)')"/>
<Copy SourceFiles="$(LibraryFolder)\$(QuickGraphAlgorithmDll)" DestinationFiles="$(FrameworkPath)\$(QuickGraphAlgorithmDll)" Condition="!exists('$(FrameworkPath)\$(QuickGraphAlgorithmDll)')"/>
<Copy SourceFiles="$(LibraryFolder)\$(ReflyDll)" DestinationFiles="$(FrameworkPath)\$(ReflyDll)" Condition="!exists('$(FrameworkPath)\$(ReflyDll)')"/>
<Copy SourceFiles="$(LibraryFolder)\$(TestFuDll)" DestinationFiles="$(FrameworkPath)\$(TestFuDll)" Condition="!exists('$(FrameworkPath)\$(TestFuDll)')"/>
</Target>
Once I had MsBuild and MbUnit successfully integrated, it was a simple
matter of merging the report xml from my tests into the ccnet server
config.
[tags: msbuild, mbunit, cruisecontrol,continuousintegration continuous
integration, ccnet, cruisecontrol.net]