Skip to content

Commit

Permalink
Merge pull request #1188 from MaceWindu/feature/4738
Browse files Browse the repository at this point in the history
Add support for ThrowOnEachFailureUnderDebugger setting
  • Loading branch information
OsirisTerje committed Jul 12, 2024
2 parents b3ab570 + fc8cb24 commit 9f5391f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/NUnitTestAdapter/AdapterSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ public class AdapterSettings(ITestLogger logger) : IAdapterSettings
public bool UseNUnitIdforTestCaseId { get; private set; } // default is false.
public int ConsoleOut { get; private set; }
public bool StopOnError { get; private set; }
public bool ThrowOnEachFailureUnderDebugger { get; private set; }

public DiscoveryMethod DiscoveryMethod { get; private set; } = DiscoveryMethod.Current;
public bool SkipNonTestAssemblies { get; private set; }
Expand Down Expand Up @@ -257,6 +258,7 @@ public void Load(string settingsXml)
IncludeStackTraceForSuites = GetInnerTextAsBool(nunitNode, nameof(IncludeStackTraceForSuites), true);
EnsureAttachmentFileScheme = GetInnerTextAsBool(nunitNode, nameof(EnsureAttachmentFileScheme), false);
SkipExecutionWhenNoTests = GetInnerTextAsBool(nunitNode, nameof(SkipExecutionWhenNoTests), false);
ThrowOnEachFailureUnderDebugger = GetInnerTextAsBool(nunitNode, nameof(ThrowOnEachFailureUnderDebugger), false);

// Engine settings
DiscoveryMethod = MapEnum(GetInnerText(nunitNode, nameof(DiscoveryMethod), Verbosity > 0), DiscoveryMethod.Current);
Expand Down
1 change: 1 addition & 0 deletions src/NUnitTestAdapter/IAdapterSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ public interface IAdapterSettings
char FullnameSeparator { get; }
DiscoveryMethod DiscoveryMethod { get; }
bool SkipNonTestAssemblies { get; }
bool ThrowOnEachFailureUnderDebugger { get; }

int AssemblySelectLimit { get; }

Expand Down
3 changes: 3 additions & 0 deletions src/NUnitTestAdapter/NUnitTestAdapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,9 @@ protected TestPackage CreateTestPackage(string assemblyName, IGrouping<string, T
if (Settings.SkipNonTestAssemblies)
package.Settings[PackageSettings.SkipNonTestAssemblies] = true;

if (Settings.ThrowOnEachFailureUnderDebugger)
package.Settings[PackageSettings.ThrowOnEachFailureUnderDebugger] = true;

// Always run one assembly at a time in process in its own domain
package.Settings[PackageSettings.ProcessModel] = "InProcess";

Expand Down
5 changes: 5 additions & 0 deletions src/NUnitTestAdapter/PackageSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,11 @@ public static class PackageSettings
/// </summary>
public const string StopOnError = "StopOnError";

/// <summary>
/// If true, asserts in multiple asserts block will throw first-chance exception on failure.
/// </summary>
public const string ThrowOnEachFailureUnderDebugger = "ThrowOnEachFailureUnderDebugger";

/// <summary>
/// If true, use of the event queue is suppressed and test events are synchronous.
/// </summary>
Expand Down

0 comments on commit 9f5391f

Please sign in to comment.