INFO

This API documentation is for FAKE version 5.0 or later. The old API documentation can be found here for migration or here for fake 4

This is part of the Fake.DotNet.Testing.DotCover module.

DotCover

Contains a task which can be used to run DotCover on .NET assemblies.

Nested types and modules

TypeDescription
MergeParams
Params

The dotCover parameter type for running coverage

ReportParams
ReportType

Functions and values

Function or valueDescription
DotCover.merge(setParams)
Signature: setParams:(MergeParams -> MergeParams) -> unit

Runs the dotCover "merge" command. This combines dotCover snaphots into a single snapshot, enabling you to merge test coverage from multiple test running frameworks

Parameters

  • setParams - Function used to overwrite the dotCover merge default parameters.

Sample

1: 
2: 
3: 
4: 
merge (fun p -> { p with 
                    Source = [artifactsDir @@ "NUnitDotCoverSnapshot.dcvr"
                              artifactsDir @@ "MSpecDotCoverSnapshot.dcvr"]
                    Output = artifactsDir @@ "dotCoverSnapshot.dcvr" }) 
DotCover.report(setParams)
Signature: setParams:(ReportParams -> ReportParams) -> bool -> unit

Runs the dotCover "report" command. This generates a report from a dotCover snapshot

Parameters

  • setParams - Function used to overwrite the dotCover report default parameters.

Sample

1: 
2: 
3: 
4: 
report (fun p -> { p with 
                    Source = artifactsDir @@ "dotCoverSnapshot.dcvr"
                    Output = artifactsDir @@ "dotCoverReport.xml"
                    ReportType = ReportType.Xml })
DotCover.run(setParams)
Signature: setParams:(Params -> Params) -> unit

Runs the dotCover "cover" command, using a target executable (such as NUnit or MSpec) and generates a snapshot file.

Parameters

  • setParams - Function used to overwrite the dotCover default parameters.
DotCover.runMSpec(...)
Signature: setDotCoverParams:(Params -> Params) -> setMSpecParams:(MSpecParams -> MSpecParams) -> assemblies:seq<string> -> unit

Runs the dotCover "cover" command against the MSpec test runner.

Parameters

  • setDotCoverParams - Function used to overwrite the dotCover report default parameters.
  • setMSpecParams - Function used to overwrite the MSpec default parameters.

Sample

1: 
2: 
3: 
4: 
5: 
6: 
!! (buildDir @@ buildMode @@ "/*.Unit.Tests.dll") 
    |> runMSpec 
        (fun dotCoverOptions -> { dotCoverOptions with 
                Output = artifactsDir @@ "MSpecDotCoverSnapshot.dcvr" }) 
        (fun mSpecOptions -> { mSpecOptions with
                Silent = true })
DotCover.runMSTest(...)
Signature: setDotCoverParams:(Params -> Params) -> setMSTestParams:(MSTestParams -> MSTestParams) -> assemblies:seq<string> -> unit

Runs the dotCover "cover" command against the MSTest test runner.

Parameters

  • setDotCoverParams - Function used to overwrite the dotCover report default parameters.
  • setMSTestParams - Function used to overwrite the MSTest default parameters.

Sample

1: 
2: 
3: 
4: 
!! (buildDir @@ buildMode @@ "/*.Unit.Tests.dll") 
    |> runMSTest 
        (fun  -> dotCoverOptions )
        (fun MSTestOptions -> MSTestOptions) 
DotCover.runNUnit(...)
Signature: setDotCoverParams:(Params -> Params) -> setNUnitParams:(NUnitParams -> NUnitParams) -> assemblies:seq<string> -> unit

Runs the dotCover "cover" command against the NUnit test runner.

Parameters

  • setDotCoverParams - Function used to overwrite the dotCover report default parameters.
  • setNUnitParams - Function used to overwrite the NUnit default parameters.

Sample

1: 
2: 
3: 
4: 
5: 
6: 
!! (buildDir @@ buildMode @@ "/*.Unit.Tests.dll") 
    |> runNUnit 
        (fun dotCoverOptions -> { dotCoverOptions with 
                Output = artifactsDir @@ "NUnitDotCoverSnapshot.dcvr" }) 
        (fun nUnitOptions -> { nUnitOptions with
                DisableShadowCopy = true })
DotCover.runNUnit3(...)
Signature: setDotCoverParams:(Params -> Params) -> setNUnitParams:(NUnit3Params -> NUnit3Params) -> assemblies:seq<string> -> unit

Runs the dotCover "cover" command against the NUnit test runner.

Parameters

  • setDotCoverParams - Function used to overwrite the dotCover report default parameters.
  • setNUnitParams - Function used to overwrite the NUnit default parameters.

Sample

1: 
2: 
3: 
4: 
5: 
6: 
!! (buildDir @@ buildMode @@ "/*.Unit.Tests.dll") 
    |> runNUnit3 
        (fun dotCoverOptions -> { dotCoverOptions with 
                Output = artifactsDir @@ "NUnit3DotCoverSnapshot.dcvr" }) 
        (fun nUnit3Options -> { nUnit3Options with
                DisableShadowCopy = true })
DotCover.runXUnit2(...)
Signature: setDotCoverParams:(Params -> Params) -> setXUnit2Params:(XUnit2Params -> XUnit2Params) -> assemblies:seq<string> -> unit

Runs the dotCover "cover" command against the XUnit2 test runner.

Parameters

  • setDotCoverParams - Function used to overwrite the dotCover report default parameters.
  • setXUnit2Params - Function used to overwrite the XUnit2 default parameters.

Sample

1: 
2: 
3: 
4: 
!! (buildDir @@ buildMode @@ "/*.Unit.Tests.dll") 
    |> runXUnit2 
        (fun  -> dotCoverOptions )
        (fun nUnitOptions -> nUnitOptions)