Skip to content

Commit

Permalink
Added SkipNonTestAssemblies to NUnit3Params
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-bogomaz committed Jul 4, 2017
1 parent b593379 commit d761cab
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 37 deletions.
6 changes: 6 additions & 0 deletions src/app/Fake.DotNet.Testing.NUnit/NUnit3.fs
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,9 @@ type NUnit3Params =
/// Controls the trace logs NUnit3 will output, defaults to Off
TraceLevel : NUnit3TraceLevel

/// Skips assemblies that do not contain tests or assemblies that contain the NUnit.Framework.NonTestAssemblyAttribute without raising an error
SkipNonTestAssemblies : bool

/// A test parameter specified in the form name=value. Multiple parameters may be specified, separated by semicolons
Params : string
}
Expand Down Expand Up @@ -238,6 +241,7 @@ type NUnit3Params =
/// - `TeamCity` - `false`
/// - `ErrorLevel` - `Error`
/// - `TraceLevel` - `Default` (By default NUnit3 sets this to off internally)
/// - `SkipNonTestAssemblies` - `false`
/// - `Params` - `""`
/// ## Defaults
let NUnit3Defaults =
Expand Down Expand Up @@ -265,6 +269,7 @@ let NUnit3Defaults =
Labels = LabelsLevel.Default
ErrorLevel = NUnit3ErrorLevel.Error
TraceLevel= NUnit3TraceLevel.Default
SkipNonTestAssemblies = false
Params = ""
}

Expand Down Expand Up @@ -306,6 +311,7 @@ let buildNUnit3Args parameters assemblies =
|> appendResultString parameters.ResultSpecs
|> appendIfTrue parameters.ShadowCopy "--shadowcopy"
|> appendIfTrue parameters.TeamCity "--teamcity"
|> appendIfTrue parameters.SkipNonTestAssemblies "--skipnontestassemblies"
|> appendIfNotNullOrEmpty parameters.Params "--params="
|> appendFileNamesIfNotNull assemblies
|> toText
Expand Down
6 changes: 6 additions & 0 deletions src/app/FakeLib/UnitTest/NUnit/NUnit3.fs
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,9 @@ type NUnit3Params =
/// Controls the trace logs NUnit3 will output, defaults to Off
TraceLevel : NUnit3TraceLevel

/// Skips assemblies that do not contain tests or assemblies that contain the NUnit.Framework.NonTestAssemblyAttribute without raising an error
SkipNonTestAssemblies : bool

/// A test parameter specified in the form name=value. Multiple parameters may be specified, separated by semicolons
Params : string
}
Expand Down Expand Up @@ -234,6 +237,7 @@ type NUnit3Params =
/// - `TeamCity` - `false`
/// - `ErrorLevel` - `Error`
/// - `TraceLevel` - `Default` (By default NUnit3 sets this to off internally)
/// - `SkipNonTestAssemblies` - `false`
/// - `Params` - `""`
/// ## Defaults
[<System.Obsolete("use Fake.DotNet.Testing.NUnit instead")>]
Expand Down Expand Up @@ -262,6 +266,7 @@ let NUnit3Defaults =
Labels = LabelsLevel.Default
ErrorLevel = NUnit3ErrorLevel.Error
TraceLevel= NUnit3TraceLevel.Default
SkipNonTestAssemblies = false
Params = ""
}

Expand Down Expand Up @@ -305,6 +310,7 @@ let buildNUnit3Args parameters assemblies =
|> appendResultString parameters.ResultSpecs
|> appendIfTrue parameters.ShadowCopy "--shadowcopy"
|> appendIfTrue parameters.TeamCity "--teamcity"
|> appendIfTrue parameters.SkipNonTestAssemblies "--skipnontestassemblies"
|> appendIfNotNullOrEmpty parameters.Params "--params="
|> appendFileNamesIfNotNull assemblies
|> toText
Expand Down
58 changes: 21 additions & 37 deletions src/test/Test.FAKECore/NUnit3Specs.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using Fake.Testing;
using FSharp.Testing;
using Machine.Specifications;

namespace Test.FAKECore.Testing.NUnit3Specs
Expand All @@ -9,7 +10,7 @@ internal abstract class BuildArgumentsSpecsBase
{
private Establish context = () =>
{
Assemblies = new[] {"test1.dll", "test2.dll"};
Assemblies = new[] { "test1.dll", "test2.dll" };
Parameters = NUnit3.NUnit3Defaults;
};

Expand All @@ -27,47 +28,30 @@ internal abstract class BuildArgumentsSpecsBase
internal class When_using_the_default_parameters
: BuildArgumentsSpecsBase
{
It should_not_set_any_trace_value = () =>
{
Arguments.ShouldNotContain("--trace");
};
It should_not_set_any_trace_value =
() => Arguments.ShouldNotContain("--trace");

It should_not_skip_non_test_assemblies =
() => Arguments.ShouldNotContain("--skipnontestassemblies");
}

internal class When_using_non_default_trace_parameter
: BuildArgumentsSpecsBase
{
Establish context = () =>
{
Parameters = new NUnit3.NUnit3Params(
NUnit3.NUnit3Defaults.ToolPath,
NUnit3.NUnit3Defaults.Testlist,
NUnit3.NUnit3Defaults.Where,
NUnit3.NUnit3Defaults.Config,
NUnit3.NUnit3Defaults.ProcessModel,
NUnit3.NUnit3Defaults.Agents,
NUnit3.NUnit3Defaults.Domain,
NUnit3.NUnit3Defaults.Framework,
NUnit3.NUnit3Defaults.Force32bit,
NUnit3.NUnit3Defaults.DisposeRunners,
NUnit3.NUnit3Defaults.TimeOut,
NUnit3.NUnit3Defaults.Seed,
NUnit3.NUnit3Defaults.Workers,
NUnit3.NUnit3Defaults.StopOnError,
NUnit3.NUnit3Defaults.WorkingDir,
NUnit3.NUnit3Defaults.OutputDir,
NUnit3.NUnit3Defaults.ErrorDir,
NUnit3.NUnit3Defaults.ResultSpecs,
NUnit3.NUnit3Defaults.ShadowCopy,
NUnit3.NUnit3Defaults.TeamCity,
NUnit3.NUnit3Defaults.Labels,
NUnit3.NUnit3Defaults.ErrorLevel,
NUnit3.NUnit3TraceLevel.Verbose,
NUnit3.NUnit3Defaults.Params);
};
Establish context =
() => Parameters = Parameters.With(p => p.TraceLevel, NUnit3.NUnit3TraceLevel.Verbose);

It should_include_the_expected_trace_argument = () =>
{
Arguments.ShouldContain(@"--trace=Verbose");
};
It should_include_the_expected_trace_argument =
() => Arguments.ShouldContain(@"--trace=Verbose");
}

internal class When_using_SkipNonTestAssemblies_parameter
: BuildArgumentsSpecsBase
{
Establish context =
() => Parameters = Parameters.With(p => p.SkipNonTestAssemblies, true);

It should_include_the_expected_skipnontestassemblies_argument =
() => Arguments.ShouldContain(@"--skipnontestassemblies");
}
}

0 comments on commit d761cab

Please sign in to comment.