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

Add support for outputting NUnit style test result XML to Fake.Testing.XUnit2 #870

Merged
merged 1 commit into from
Jul 20, 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
5 changes: 5 additions & 0 deletions src/app/FakeLib/UnitTest/XUnit/XUnit2.fs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Valid options:
: if specified more than once, acts as an AND operation
-xml <filename> : output results to xUnit.net v2 style XML file
-xmlv1 <filename> : output results to xUnit.net v1 style XML file
-nunit <filename> : output results to NUnit-style XML file
-html <filename> : output results to HTML file
*)

Expand Down Expand Up @@ -79,6 +80,8 @@ type XUnit2Params =
XmlOutputPath : string option
/// The output path of the xUnit XML report (in the xUnit v1 style).
XmlV1OutputPath : string option
/// The output path of the NUnit XML report.
NUnitXmlOutputPath : string option
/// The working directory for running the xunit console runner.
WorkingDir : string option
/// Run xUnit with shadow copy enabled.
Expand Down Expand Up @@ -126,6 +129,7 @@ let XUnit2Defaults =
HtmlOutputPath = None
XmlOutputPath = None
XmlV1OutputPath = None
NUnitXmlOutputPath = None
IncludeTraits = []
ExcludeTraits = []
ShadowCopy = true
Expand Down Expand Up @@ -157,6 +161,7 @@ let internal buildXUnit2Args assemblies parameters =
|> appendIfTrueWithoutQuotes parameters.Silent "-silent"
|> appendIfSome parameters.XmlOutputPath (sprintf @"-xml ""%s""")
|> appendIfSome parameters.XmlV1OutputPath (sprintf @"-xmlv1 ""%s""")
|> appendIfSome parameters.NUnitXmlOutputPath (sprintf @"-nunit ""%s""")
|> appendIfSome parameters.HtmlOutputPath (sprintf @"-html ""%s""")
|> appendTraits parameters.IncludeTraits "-trait"
|> appendTraits parameters.ExcludeTraits "-notrait"
Expand Down
10 changes: 10 additions & 0 deletions src/test/Test.FAKECore/XUnit2Specs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ internal class When_using_the_default_parameters
{
Arguments.ShouldNotContain(" -xml");
Arguments.ShouldNotContain(" -xmlv1");
Arguments.ShouldNotContain(" -nunit");
Arguments.ShouldNotContain(" -html");
};

Expand Down Expand Up @@ -83,6 +84,7 @@ internal class When_using_parameters_which_include_traits
XUnit2.XUnit2Defaults.HtmlOutputPath,
XUnit2.XUnit2Defaults.XmlOutputPath,
XUnit2.XUnit2Defaults.XmlV1OutputPath,
XUnit2.XUnit2Defaults.NUnitXmlOutputPath,
XUnit2.XUnit2Defaults.WorkingDir,
XUnit2.XUnit2Defaults.ShadowCopy,
XUnit2.XUnit2Defaults.Silent,
Expand Down Expand Up @@ -117,6 +119,7 @@ internal class When_using_parameters_which_include_reports
FSharpOption<string>.Some("html.html"),
FSharpOption<string>.Some("xml.xml"),
FSharpOption<string>.Some("xmlv1.xml"),
FSharpOption<string>.Some("nunit.xml"),
XUnit2.XUnit2Defaults.WorkingDir,
XUnit2.XUnit2Defaults.ShadowCopy,
XUnit2.XUnit2Defaults.Silent,
Expand All @@ -137,6 +140,9 @@ internal class When_using_parameters_which_include_reports

It should_include_the_expected_XML_v1_reporting_argument = () =>
Arguments.ShouldContain(@" -xmlv1 ""xmlv1.xml""");

It should_include_the_expected_NUnit_XML_reporting_argument = () =>
Arguments.ShouldContain(@" -nunit ""nunit.xml""");
}

internal class When_using_parameters_which_request_total_parallel_execution
Expand All @@ -151,6 +157,7 @@ internal class When_using_parameters_which_request_total_parallel_execution
XUnit2.XUnit2Defaults.HtmlOutputPath,
XUnit2.XUnit2Defaults.XmlOutputPath,
XUnit2.XUnit2Defaults.XmlV1OutputPath,
XUnit2.XUnit2Defaults.NUnitXmlOutputPath,
XUnit2.XUnit2Defaults.WorkingDir,
XUnit2.XUnit2Defaults.ShadowCopy,
XUnit2.XUnit2Defaults.Silent,
Expand Down Expand Up @@ -182,6 +189,7 @@ internal class When_using_parameters_which_request_assembly_only_parallel_execut
XUnit2.XUnit2Defaults.HtmlOutputPath,
XUnit2.XUnit2Defaults.XmlOutputPath,
XUnit2.XUnit2Defaults.XmlV1OutputPath,
XUnit2.XUnit2Defaults.NUnitXmlOutputPath,
XUnit2.XUnit2Defaults.WorkingDir,
XUnit2.XUnit2Defaults.ShadowCopy,
XUnit2.XUnit2Defaults.Silent,
Expand Down Expand Up @@ -213,6 +221,7 @@ internal class When_using_parameters_which_request_collection_only_parallel_exec
XUnit2.XUnit2Defaults.HtmlOutputPath,
XUnit2.XUnit2Defaults.XmlOutputPath,
XUnit2.XUnit2Defaults.XmlV1OutputPath,
XUnit2.XUnit2Defaults.NUnitXmlOutputPath,
XUnit2.XUnit2Defaults.WorkingDir,
XUnit2.XUnit2Defaults.ShadowCopy,
XUnit2.XUnit2Defaults.Silent,
Expand Down Expand Up @@ -245,6 +254,7 @@ internal class When_using_parameters_which_request_non_default_flags
XUnit2.XUnit2Defaults.HtmlOutputPath,
XUnit2.XUnit2Defaults.XmlOutputPath,
XUnit2.XUnit2Defaults.XmlV1OutputPath,
XUnit2.XUnit2Defaults.NUnitXmlOutputPath,
XUnit2.XUnit2Defaults.WorkingDir,
!XUnit2.XUnit2Defaults.ShadowCopy,
!XUnit2.XUnit2Defaults.Silent,
Expand Down