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 ThrowOnEachFailureUnderDebugger setting #1188

Merged
merged 1 commit into from
Jul 12, 2024
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
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