(GH-2095) NUnit Skip non test assemblies · dreamsql/cake@3bd5956 · GitHub
Skip to content

Commit 3bd5956

Browse files
pavzajdevlead
authored andcommitted
(cake-buildGH-2095) NUnit Skip non test assemblies
* Add --skipnontestassemblies funcionality to CAKE's NUnit3Settings as it exists in original nunit3 test runner * Fixes cake-build#2095
1 parent 883e79e commit 3bd5956

4 files changed

Lines changed: 24 additions & 4 deletions

File tree

‎src/Cake.Common.Tests/Unit/Tools/NUnit/NUnit3RunnerTests.cs‎

Lines changed: 3 additions & 1 deletion

‎src/Cake.Common/Tools/NUnit/NUnit3Runner.cs‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
namespace Cake.Common.Tools.NUnit
1414
{
1515
/// <summary>
16-
/// The NUnit unit test runner.
16+
/// The NUnit3 unit test runner.
1717
/// </summary>
1818
public sealed class NUnit3Runner : Tool<NUnit3Settings>
1919
{
@@ -99,6 +99,11 @@ private ProcessArgumentBuilder GetArguments(IEnumerable<FilePath> assemblyPaths,
9999
builder.Append("--stoponerror");
100100
}
101101

102+
if (settings.SkipNonTestAssemblies)
103+
{
104+
builder.Append("--skipnontestassemblies");
105+
}
106+
102107
if (settings.Work != null)
103108
{
104109
builder.AppendQuoted(string.Format(CultureInfo.InvariantCulture, "--work={0}", settings.Work.MakeAbsolute(_environment).FullPath));
@@ -256,7 +261,7 @@ protected override IEnumerable<string> GetToolExecutableNames()
256261
}
257262

258263
/// <summary>
259-
/// Customized exit code handling.
264+
/// Customized Nunit3 exit code handling.
260265
/// Throws <see cref="CakeException"/> on non-zero exit code
261266
/// </summary>
262267
/// <param name="exitCode">The process exit code</param>
@@ -279,6 +284,9 @@ protected override void ProcessExitCode(int exitCode)
279284
case -4:
280285
error = "Invalid test fixture";
281286
break;
287+
case -5:
288+
error = "Unload error";
289+
break;
282290
case -100:
283291
error = "Unexpected error";
284292
break;

‎src/Cake.Common/Tools/NUnit/NUnit3Settings.cs‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,16 @@ public sealed class NUnit3Settings : ToolSettings
8080
/// </value>
8181
public bool StopOnError { get; set; }
8282

83+
/// <summary>
84+
/// Gets or sets a value indicating whether execution of the test run should
85+
/// skip any non-test assemblies specified, without error.
86+
/// </summary>
87+
/// <value>
88+
/// <c>true</c> if execution of the test run should skip any non-test assemblies specified, without error;
89+
/// otherwise, <c>false</c>.
90+
/// </value>
91+
public bool SkipNonTestAssemblies { get; set; }
92+
8393
/// <summary>
8494
/// Gets or sets the directory to use for output files. If
8595
/// not specified, defaults to the current directory.

‎src/Cake.Common/Tools/NUnit/NUnitRunner.cs‎

Lines changed: 1 addition & 1 deletion

0 commit comments

Comments
 (0)