XUnit

Contains tasks to run xUnit v1 unit tests.

Nested types and modules

TypeDescription
XUnitParams

The xUnit parameter type.

Functions and values

Function or valueDescription
xUnit setParams assemblies
Signature: setParams:(XUnitParams -> XUnitParams) -> assemblies:seq<string> -> unit

Runs xUnit unit tests in the given assemblies via the given xUnit runner. Will fail if the runner terminates with non-zero exit code for any of the assemblies.

The xUnit runner terminates with a non-zero exit code if any of the tests in the given assembly fail.

This task runs xUnit once per assembly specified, prepending the assembly file name to the output report filenames to ensure that there is a unique report file for each assembly tested.

Parameters

  • setParams - Function used to manipulate the default XUnitParams value.
  • assemblies - Sequence of one or more assemblies containing xUnit unit tests.

Sample usage

The sample below will generate HTML reports in testDir with names following the pattern xUnit.Test.Example.dll.html.

1: 
2: 
3: 
4: 
Target "Test" (fun _ ->
    !! (testDir @@ "xUnit.Test.*.dll")
      |> xUnit (fun p -> {p with HtmlOutputPath = testDir @@ "html"})
)
XUnitDefaults
Signature: XUnitParams

The xUnit default parameters.

Defaults

  • HtmlOutputPath - None
  • XmlOutputPath - None
  • NUnitXmlOutputPath - None
  • IncludeTraits - []
  • ExcludeTraits - []
  • ShadowCopy - true
  • ErrorLevel - Error
  • ToolPath - The xunit.console.clr4.exe path if it exists in a subdirectory of the current directory.
  • WorkingDir - None
  • TimeOut - 5 minutes
  • ForceTeamCity - false
  • Silent - false
xUnitSingle setParams assembly
Signature: setParams:(XUnitParams -> XUnitParams) -> assembly:string -> unit

Runs xUnit unit tests in the given assemblies via the given xUnit runner. Will fail if the runner terminates with non-zero exit code for any of the assemblies.

The xUnit runner terminates with a non-zero exit code if any of the tests in the given assembly fail.

Parameters

  • setParams - Function used to manipulate the default XUnitParams value.
  • assemblies - Sequence of one or more assemblies containing xUnit unit tests.

Sample usage

1: 
2: 
3: 
Target "Test" (fun _ ->
    xUnit (fun p -> {p with HtmlOutputPath = testDir @@ "xunit.html"}) "xUnit.Test.dll"
)