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

Update Pickles helper to reflect the latest changes to pickles #1236

Merged
merged 3 commits into from
May 11, 2016
Merged
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
72 changes: 48 additions & 24 deletions src/app/FakeLib/PicklesHelper.fs
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,29 @@ open Fake

(*
.\packages\Pickles.CommandLine\tools\pickles.exe --help
Pickles version 2.3.0.0
-f, --feature-directory=VALUE
directory to start scanning recursively for
features
-o, --output-directory=VALUE
directory where output files will be placed
--trfmt, --test-results-format=VALUE
the format of the linked test results
(nunit|xunit)
--lr, --link-results-file=VALUE
the path to the linked test results file (can be
a semicolon-separated list of files)
--sn, --system-under-test-name=VALUE
the name of the system under test
--sv, --system-under-test-version=VALUE
the version of the system under test
-l, --language=VALUE the language of the feature files
--df, --documentation-format=VALUE
the format of the output documentation
-v, --version
-h, -?, --help
Pickles version 2.6.1.0
-f, --feature-directory=VALUE
directory to start scanning recursively for
features
-o, --output-directory=VALUE
directory where output files will be placed
--trfmt, --test-results-format=VALUE
the format of the linked test results
(nunit|xunit)
--lr, --link-results-file=VALUE
the path to the linked test results file (can be
a semicolon-separated list of files)
--sn, --system-under-test-name=VALUE
the name of the system under test
--sv, --system-under-test-version=VALUE
the version of the system under test
-l, --language=VALUE the language of the feature files
--df, --documentation-format=VALUE
the format of the output documentation
-v, --version
-h, -?, --help
--exp, --include-experimental-features
whether to include experimental features
*)

/// Option which allows to specify if failure of pickles should break the build.
Expand All @@ -41,7 +43,14 @@ type PicklesErrorLevel =
/// The format of the test results
type TestResultsFormat =
| Nunit
| NUnit
| NUnit3
| XUnit
| XUnit2
| MSTest
| CucumberJSON
| SpecRun
| VSTest

type DocumentationFormat =
| DHTML
Expand Down Expand Up @@ -74,6 +83,8 @@ type PicklesParams =
TimeOut : TimeSpan
/// Option which allows to specify if failure of pickles should break the build.
ErrorLevel : PicklesErrorLevel
/// Option which allows to enable some experimental features
IncludeExperimentalFeatures : bool option
}

/// The Pickles default parameters
Expand All @@ -91,19 +102,21 @@ type PicklesParams =
/// - `SystemUnderTestVersion` - `None`
/// - `TimeOut` - 5 minutes
/// - `ErrorLevel` - `Error`
/// - `IncludeExperimentalFeatures` - `None`
let PicklesDefaults =
{
ToolPath = findToolInSubPath "pickles.exe" currentDirectory
FeatureDirectory = currentDirectory
FeatureFileLanguage = None
OutputDirectory = currentDirectory @@ "Documentation"
OutputFileFormat = DHTML
TestResultsFormat = Nunit
TestResultsFormat = NUnit
LinkedTestResultFiles = []
SystemUnderTestName = None
SystemUnderTestVersion = None
TimeOut = TimeSpan.FromMinutes 5.
ErrorLevel = Error
IncludeExperimentalFeatures = None
}

let buildPicklesArgs parameters =
Expand All @@ -118,15 +131,25 @@ let buildPicklesArgs parameters =
| [] -> None
| _ -> match parameters.TestResultsFormat with
| Nunit -> Some "nunit"
| NUnit -> Some "nunit"
| NUnit3 -> Some "nunit3"
| XUnit -> Some "xunit"
| XUnit2 -> Some "xunit2"
| MSTest -> Some "mstest"
| CucumberJSON -> Some "cucumberjson"
| SpecRun -> Some "specrun"
| VSTest -> Some "vstest"

let linkedResultFiles = match parameters.LinkedTestResultFiles with
| [] -> None
| _ -> parameters.LinkedTestResultFiles
|> Seq.map (fun f -> sprintf "\"%s\"" f)
|> String.concat ";"
|> Some

let experimentalFeatures = match parameters.IncludeExperimentalFeatures with
| Some true -> Some "--exp"
| _ -> None

new StringBuilder()
|> appendWithoutQuotes (sprintf " -f \"%s\"" parameters.FeatureDirectory)
|> appendWithoutQuotes (sprintf " -o \"%s\"" parameters.OutputDirectory)
Expand All @@ -136,6 +159,7 @@ let buildPicklesArgs parameters =
|> appendWithoutQuotes (sprintf " --df %s" outputFormat)
|> appendIfSome testResultFormat (sprintf " --trfmt %s")
|> appendIfSome linkedResultFiles (sprintf " --lr %s")
|> appendIfSome experimentalFeatures (sprintf "%s")
|> toText

module internal ResultHandling =
Expand Down Expand Up @@ -184,4 +208,4 @@ let Pickles setParams =

ResultHandling.failBuildIfPicklesReportedError parameters.ErrorLevel result

traceEndTask "Pickles" ""
traceEndTask "Pickles" ""