NUnit3 Class

MSBuild Extension Pack

NUnit3 Class MSBuild Extension Pack Help 4.0.12.0
Executes Test Cases using NUnit (Tested using v3.0.5610.33199)
Inheritance Hierarchy

SystemObject  Microsoft.Build.UtilitiesTask
    Microsoft.Build.UtilitiesToolTask
      MSBuild.ExtensionPack.CodeQualityNUnit3

Namespace: MSBuild.ExtensionPack.CodeQuality
Assembly: MSBuild.ExtensionPack (in MSBuild.ExtensionPack.dll) Version: 4.0.0.0

The NUnit3 type exposes the following members.

Constructors

  NameDescription
Public methodNUnit3
Top
Properties

  NameDescription
Public propertyAssemblies
Gets or sets the assemblies.
Public propertyConfiguration
Sets the Project configuration (e.g.: Debug) to load
Public propertyDomain
DOMAIN isolation for test assemblies. Values: None, Single, Multiple. If not specified, defaults to Separate for a single assembly or Multiple for more than one.
Public propertyErrorOutputFile
Sets the File to receive test error output
Public propertyErrors
Gets the Errors count
Public propertyExcludeCategory
Comma separated list of categories to exclude.
Public propertyFailOnFailures
Set to true to fail the task if this.Failures > 0. Helps for batching purposes. Default is false.
Public propertyFailures
Gets the Failures count
Public propertyFramework
FRAMEWORK type/version to use for tests. Examples: mono, net-3.5, v4.0, 2.0, mono-4.0. If not specified, tests will run under the framework they are compiled with.
Public propertyIgnored
Gets the Ignored count
Public propertyIncludeCategory
Comma separated list of categories to include.
Public propertyInconclusive
Gets the Inconclusive count
Public propertyInvalid
Gets the Invalid count
Public propertyLabels
Specify whether to write test case names to the output. Values: Off, On, All
Public propertyNoShadow
Disable shadow copy when running in separate domain. Default is false.
Public propertyNotRun
Gets the NotRun count
Public propertyOutputFile
File to receive test output
Public propertyOutputXmlFile
Sets the OutputXmlFile name
Public propertyProcess
PROCESS isolation for test assemblies. Values: Single, Separate, Multiple. If not specified, defaults to Separate for a single assembly or Multiple for more than one.
Public propertySkipped
Gets the Skipped count
Public propertyTeamCity
Turns on use of TeamCity service messages.
Public propertyTest
Name of the test case(s), fixture(s) or namespace(s) to run
Public propertyTestTimeout
Set timeout for each test case in milliseconds
Public propertyTotal
Gets the Total count
Public propertyUse32Bit
Run tests in an x86 process on 64 bit systems.
Public propertyVersion
The version of NUnit to run. Default is 3.0.5610
Public propertyWorkerThreads
Number of worker threads to be used in running tests. If not specified, defaults to 2 or the number of processors, whichever is greater.
Top
Examples

<Project ToolsVersion="4.0" DefaultTargets="Default" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <TPath>$(MSBuildProjectDirectory)\..\MSBuild.ExtensionPack.tasks</TPath>
    <TPath Condition="Exists('$(MSBuildProjectDirectory)\..\..\Common\MSBuild.ExtensionPack.tasks')">$(MSBuildProjectDirectory)\..\..\Common\MSBuild.ExtensionPack.tasks</TPath>
  </PropertyGroup>
  <Import Project="$(TPath)"/>
  <PropertyGroup>
    <ToolPath>D:\Program Files (x86)\NUnit 3.0.5610\bin\net-4.0</ToolPath>
  </PropertyGroup>
  <Target Name="Default">
    <ItemGroup>
      <Assemblies Include="d:\a\*.dll"/>
    </ItemGroup>
    <!-- Run an NUnit Project -->
    <MSBuild.ExtensionPack.CodeQuality.NUnit Assemblies="d:\a\Project1.nunit" ToolPath="$(ToolPath)">
      <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>
    <Message Text="ResultTotal: $(ResultTotal)"/>
    <Message Text="ResultNotRun: $(ResultNotRun)"/>
    <Message Text="ResultFailures: $(ResultFailures)"/>
    <Message Text="ResultErrors: $(ResultErrors)"/>
    <Message Text="ResultInconclusive: $(ResultInconclusive)"/>
    <Message Text="ResultIgnored: $(ResultIgnored)"/>
    <Message Text="ResultSkipped: $(ResultSkipped)"/>
    <Message Text="ResultInvalid: $(ResultInvalid)"/>
    <!--- Run NUnit over a collection of assemblies -->
    <MSBuild.ExtensionPack.CodeQuality.NUnit Assemblies="@(Assemblies)" ToolPath="$(ToolPath)" OutputXmlFile="D:\a\NunitResults2.xml">
      <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>
    <Message Text="ResultTotal: $(ResultTotal)"/>
    <Message Text="ResultNotRun: $(ResultNotRun)"/>
    <Message Text="ResultFailures: $(ResultFailures)"/>
    <Message Text="ResultErrors: $(ResultErrors)"/>
    <Message Text="ResultInconclusive: $(ResultInconclusive)"/>
    <Message Text="ResultIgnored: $(ResultIgnored)"/>
    <Message Text="ResultSkipped: $(ResultSkipped)"/>
    <Message Text="ResultInvalid: $(ResultInvalid)"/>
  </Target>
</Project>
See Also

Reference