For completeness I thought I would add the following to this post. The
msbuild script above will not fail a cruise control build if the unit
tests fail, due to running NCover and NCoverExplorer tasks with
ContinueOnError="true". This is necessary in order to complete the
test run and collate the results even if some of the tests fail.
However, to fail the build in Cruise Control I added the following
target. It uses tasks from the msbuild community targets.

  <Target Name="ReturnBuildStatus" DependsOnTargets="RunTests">
    <CreateItem Include="$(RootSourceFolder)\Build\ci\unitTests
\*.xml">
      <Output TaskParameter="Include" ItemName="UnitTestFiles" />
    </CreateItem>

    <XmlQuery
      XmlFileName="%(UnitTestFiles.Identity)"
      XPath="sum(//report-result/counter/@failure-count)">
      <Output TaskParameter="Values" ItemName="FailureCounts" />
    </XmlQuery>

    <Math.Add Numbers="@(FailureCounts)">
      <Output TaskParameter="Result" PropertyName="FailureCount" />
    </Math.Add>

    <Message Text="FailureCount $(FailureCount)"/>

    <Error Condition=" '$(FailureCount)' > '0' "
           Code="1"
           Text="$(FailureCount) Unit tests failed" />
  </Target>

I know this is more of a Cruise Control feature but I thought it worth
adding to this thread.

Andrew


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"MbUnit.User" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/MbUnitUser?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to