MsCorEE

JeffGonzalez : IScalable

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]

Comments

bharathiraja said:

hi iam facing a problem while using mbunit task with cruise control.iam giving the error message please help me...

[CCNet Server:ERROR] Exception: Unable to instantiate CruiseControl projects from configuration document. Configuration document is likely missing Xml nodes required for properly populating CruiseControl configuration.Cannot convert from type System.String to ThoughtWorks.CruiseControl.Core.ITask for object with value: ""

iam giving ccnet.config also

<UsingTask

         TaskName="MbUnit.MSBuild.Tasks.MbUnit"

         AssemblyFile="MbUnit.MSBuild.Tasks.dll"

   />

     <ItemGroup>

       <TestAssemblies Include="D:\BLFWVSS\FrameworkSolution\UnitTestCases\bin\Debug\ReleaseTestCases.dll" />

     </ItemGroup>

<Target Name="Tests">

       <MbUnit

        Assemblies="@(TestAssemblies)"

        ReportTypes="Xml;Text;Html;Dox"

        ReportFileNameFormat="myreportname{0}{1}"

        ReportOutputDirectory="C:\Program Files\CruiseControl.NET\server\Starwars\WorkingDirectory"

         />

     </Target>

# April 5, 2007 3:16 AM

marko rangel said:

You may also want to check out this page for information: http://tinyurl.com/2su3q3

# May 22, 2007 3:22 PM
Leave a Comment

(required) 

(required) 

(optional)

(required)