From fc8cb240eb2102d4291eff362ea09a99e984be47 Mon Sep 17 00:00:00 2001 From: MaceWindu Date: Tue, 9 Jul 2024 11:54:23 +0200 Subject: [PATCH] Add support for ThrowOnEachFailureUnderDebugger setting for https://github.com/nunit/nunit/issues/4738 --- src/NUnitTestAdapter/AdapterSettings.cs | 2 ++ src/NUnitTestAdapter/IAdapterSettings.cs | 1 + src/NUnitTestAdapter/NUnitTestAdapter.cs | 3 +++ src/NUnitTestAdapter/PackageSettings.cs | 5 +++++ 4 files changed, 11 insertions(+) diff --git a/src/NUnitTestAdapter/AdapterSettings.cs b/src/NUnitTestAdapter/AdapterSettings.cs index f065ebb6..6162d69c 100644 --- a/src/NUnitTestAdapter/AdapterSettings.cs +++ b/src/NUnitTestAdapter/AdapterSettings.cs @@ -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; } @@ -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); diff --git a/src/NUnitTestAdapter/IAdapterSettings.cs b/src/NUnitTestAdapter/IAdapterSettings.cs index da7b04e7..d44f48ff 100644 --- a/src/NUnitTestAdapter/IAdapterSettings.cs +++ b/src/NUnitTestAdapter/IAdapterSettings.cs @@ -91,6 +91,7 @@ public interface IAdapterSettings char FullnameSeparator { get; } DiscoveryMethod DiscoveryMethod { get; } bool SkipNonTestAssemblies { get; } + bool ThrowOnEachFailureUnderDebugger { get; } int AssemblySelectLimit { get; } diff --git a/src/NUnitTestAdapter/NUnitTestAdapter.cs b/src/NUnitTestAdapter/NUnitTestAdapter.cs index 14666e7a..4cf8309b 100644 --- a/src/NUnitTestAdapter/NUnitTestAdapter.cs +++ b/src/NUnitTestAdapter/NUnitTestAdapter.cs @@ -250,6 +250,9 @@ protected TestPackage CreateTestPackage(string assemblyName, IGrouping public const string StopOnError = "StopOnError"; + /// + /// If true, asserts in multiple asserts block will throw first-chance exception on failure. + /// + public const string ThrowOnEachFailureUnderDebugger = "ThrowOnEachFailureUnderDebugger"; + /// /// If true, use of the event queue is suppressed and test events are synchronous. ///