Search code examples
msbuildmsbuild-taskmsbuild-4.0msbuildextensionpack

NUnit Extension Pack task stop after failed tests


I am running msbuild nunit task from extension pack that has 1 test which fails:

 <Target Name="Tests">
    <MSBuild.ExtensionPack.CodeQuality.NUnit 
      Assemblies="$(DropsDir)\$(Configuration)\$(TestPrj)\$(TestPrj).dll" 
      ToolPath="$(NUnitPath)"
      ContinueOnError="False">
      <Output TaskParameter="Total" PropertyName="ResultTotal"/>
      <Output TaskParameter="NotRun" PropertyName="ResultNotRun"/>
      <Output TaskParameter="Failures" PropertyName="ResultFailures"/>
      <Output TaskParameter="Errors" PropertyName="ResultErrors"/>
      <Output TaskParameter="Inconclusive" PropertyName="ResultInconclusive"/>
      <Output TaskParameter="Ignored" PropertyName="ResultIgnored"/>
      <Output TaskParameter="Skipped" PropertyName="ResultSkipped"/>
      <Output TaskParameter="Invalid" PropertyName="ResultInvalid"/>
    </MSBuild.ExtensionPack.CodeQuality.NUnit>
  </Target>

output:

enter image description here

How can I prevent the next target to be executed? "Zip-Projects" ? I am using MSBuild.Extension.Pack.March.2015.zip and framework 4.0


Solution

  • I solved it using an Error task and reading both output variables ResultErrors and ResultFailures.

    <Error Condition="$(ResultErrors) > 0 Or $(ResultFailures) > 0" Text="Unit Tests didn't pass *****" />