Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dotCover runner for Xunit2 #965

Merged
merged 2 commits into from
Oct 7, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions src/app/FakeLib/DotCover.fs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ open Fake
open System
open System.IO
open System.Text
open Fake.Testing.XUnit2

type DotCoverReportType =
| Html = 0
Expand Down Expand Up @@ -179,6 +180,35 @@ let DotCoverNUnit (setDotCoverParams: DotCoverParams -> DotCoverParams) (setNUni

traceEndTask "DotCoverNUnit" details

/// 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
///
/// !! (buildDir @@ buildMode @@ "/*.Unit.Tests.dll")
/// |> DotCoverXUnit2
/// (fun -> dotCoverOptions )
/// (fun nUnitOptions -> nUnitOptions)
let DotCoverXUnit2 (setDotCoverParams: DotCoverParams -> DotCoverParams) (setXUnit2Params: XUnit2Params -> XUnit2Params) (assemblies: string seq) =
let assemblies = assemblies |> Seq.toArray
let details = assemblies |> separated ", "
traceStartTask "DotCoverXUnit2" details

let parameters = XUnit2Defaults |> setXUnit2Params
let args = buildXUnit2Args assemblies parameters

DotCover (fun p ->
{p with
TargetExecutable = parameters.ToolPath
TargetArguments = args
} |> setDotCoverParams)

traceEndTask "DotCoverXUnit2" details


/// Runs the dotCover "cover" command against the MSpec test runner.
/// ## Parameters
///
Expand Down
2 changes: 1 addition & 1 deletion src/app/FakeLib/UnitTest/XUnit/XUnit2.fs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ let XUnit2Defaults =
Silent = false
Wait = false }

let internal buildXUnit2Args assemblies parameters =
let buildXUnit2Args assemblies parameters =
let formatTrait traitFlag (name, value) =
sprintf @"%s ""%s=%s""" traitFlag name value
let appendTraits traitsList traitFlag sb =
Expand Down