diff --git a/src/NUnitTestAdapter/AdapterSettings.cs b/src/NUnitTestAdapter/AdapterSettings.cs index 65cc94ce..188d674d 100644 --- a/src/NUnitTestAdapter/AdapterSettings.cs +++ b/src/NUnitTestAdapter/AdapterSettings.cs @@ -33,110 +33,6 @@ namespace NUnit.VisualStudio.TestAdapter { - public interface IAdapterSettings - { - int MaxCpuCount { get; } - string ResultsDirectory { get; } - string TargetPlatform { get; } - string TargetFrameworkVersion { get; } - string TestAdapterPaths { get; } - bool CollectSourceInformation { get; } - IDictionary TestProperties { get; } - InternalTraceLevel InternalTraceLevelEnum { get; } - string WorkDirectory { get; } - string Where { get; } - int DefaultTimeout { get; } - int NumberOfTestWorkers { get; } - bool ShadowCopyFiles { get; } - int Verbosity { get; } - bool UseVsKeepEngineRunning { get; } - string BasePath { get; } - string PrivateBinPath { get; } - int? RandomSeed { get; } - bool RandomSeedSpecified { get; } - bool InProcDataCollectorsAvailable { get; } - // ReSharper disable once UnusedMemberInSuper.Global - bool CollectDataForEachTestSeparately { get; } // Used implicitly by MS - bool SynchronousEvents { get; } - string DomainUsage { get; } - bool DumpXmlTestDiscovery { get; } - bool DumpXmlTestResults { get; } - - bool DumpVsInput { get; } - - bool PreFilter { get; } - - /// - /// Syntax documentation . - /// - string DefaultTestNamePattern { get; } - - VsTestCategoryType VsTestCategoryType { get; } - string TestOutputXml { get; } - bool UseTestOutputXml { get; } - OutputXmlFolderMode OutputXmlFolderMode { get; } - - /// - /// For retry runs create a new file for each run. - /// - bool NewOutputXmlFileForEachRun { get; } - - /// - /// True if test run is triggered in an IDE/Editor context. - /// - bool DesignMode { get; } - - /// - /// If true, an adapter shouldn't create appdomains to run tests. - /// - bool DisableAppDomain { get; } - - /// - /// If true, an adapter should disable any test case parallelization. - /// - bool DisableParallelization { get; } - - bool ShowInternalProperties { get; } - - bool UseParentFQNForParametrizedTests { get; } - - bool UseNUnitIdforTestCaseId { get; } - - int ConsoleOut { get; } - bool StopOnError { get; } - TestOutcome MapWarningTo { get; } - bool UseTestNameInConsoleOutput { get; } - DisplayNameOptions DisplayName { get; } - char FullnameSeparator { get; } - DiscoveryMethod DiscoveryMethod { get; } - bool SkipNonTestAssemblies { get; } - - int AssemblySelectLimit { get; } - - bool UseNUnitFilter { get; } - bool IncludeStackTraceForSuites { get; } - - - void Load(IDiscoveryContext context, TestLogger testLogger = null); - void Load(string settingsXml); - void SaveRandomSeed(string dirname); - void RestoreRandomSeed(string dirname); - - bool EnsureAttachmentFileScheme { get; } - - // For Internal Development use - bool FreakMode { get; } // displays metadata instead of real data in Test Explorer - bool Debug { get; } - bool DebugExecution { get; } - bool DebugDiscovery { get; } - - // Filter control - ExplicitModeEnum ExplicitMode { get; } - bool SkipExecutionWhenNoTests { get; } - string TestOutputFolder { get; } - string SetTestOutputFolder(string workDirectory); - } - public enum VsTestCategoryType { NUnit, @@ -197,6 +93,8 @@ public AdapterSettings(ITestLogger logger) /// public bool DisableParallelization { get; private set; } + public bool AllowParallelWithDebugger { get; private set; } + /// /// True if test run is triggered in an IDE/Editor context. /// @@ -524,6 +422,7 @@ private void ExtractRunConfiguration(XmlDocument doc) CollectSourceInformation = GetInnerTextAsBool(runConfiguration, nameof(CollectSourceInformation), true); DisableAppDomain = GetInnerTextAsBool(runConfiguration, nameof(DisableAppDomain), false); DisableParallelization = GetInnerTextAsBool(runConfiguration, nameof(DisableParallelization), false); + AllowParallelWithDebugger = GetInnerTextAsBool(runConfiguration, nameof(AllowParallelWithDebugger), false); DesignMode = GetInnerTextAsBool(runConfiguration, nameof(DesignMode), false); CollectDataForEachTestSeparately = GetInnerTextAsBool(runConfiguration, nameof(CollectDataForEachTestSeparately), false); diff --git a/src/NUnitTestAdapter/IAdapterSettings.cs b/src/NUnitTestAdapter/IAdapterSettings.cs new file mode 100644 index 00000000..8d8b116e --- /dev/null +++ b/src/NUnitTestAdapter/IAdapterSettings.cs @@ -0,0 +1,118 @@ +using System.Collections.Generic; + +using Microsoft.VisualStudio.TestPlatform.ObjectModel; +using Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter; + +using NUnit.Engine; + +namespace NUnit.VisualStudio.TestAdapter; + +public interface IAdapterSettings +{ + int MaxCpuCount { get; } + string ResultsDirectory { get; } + string TargetPlatform { get; } + string TargetFrameworkVersion { get; } + string TestAdapterPaths { get; } + bool CollectSourceInformation { get; } + IDictionary TestProperties { get; } + InternalTraceLevel InternalTraceLevelEnum { get; } + string WorkDirectory { get; } + string Where { get; } + int DefaultTimeout { get; } + int NumberOfTestWorkers { get; } + bool ShadowCopyFiles { get; } + int Verbosity { get; } + bool UseVsKeepEngineRunning { get; } + string BasePath { get; } + string PrivateBinPath { get; } + int? RandomSeed { get; } + bool RandomSeedSpecified { get; } + bool InProcDataCollectorsAvailable { get; } + // ReSharper disable once UnusedMemberInSuper.Global + bool CollectDataForEachTestSeparately { get; } // Used implicitly by MS + bool SynchronousEvents { get; } + string DomainUsage { get; } + bool DumpXmlTestDiscovery { get; } + bool DumpXmlTestResults { get; } + + bool DumpVsInput { get; } + + bool PreFilter { get; } + + /// + /// Syntax documentation . + /// + string DefaultTestNamePattern { get; } + + VsTestCategoryType VsTestCategoryType { get; } + string TestOutputXml { get; } + bool UseTestOutputXml { get; } + OutputXmlFolderMode OutputXmlFolderMode { get; } + + /// + /// For retry runs create a new file for each run. + /// + bool NewOutputXmlFileForEachRun { get; } + + /// + /// True if test run is triggered in an IDE/Editor context. + /// + bool DesignMode { get; } + + /// + /// If true, an adapter shouldn't create appdomains to run tests. + /// + bool DisableAppDomain { get; } + + /// + /// If true, an adapter should disable any test case parallelization. + /// + bool DisableParallelization { get; } + + /// + /// Default is that when the adapter notice it is running with a debugger attached it will disable parallelization. + /// By changing this setting to `true` the adapter will allow parallelization even if a debugger is attached. + /// + bool AllowParallelWithDebugger { get; } + + bool ShowInternalProperties { get; } + + bool UseParentFQNForParametrizedTests { get; } + + bool UseNUnitIdforTestCaseId { get; } + + int ConsoleOut { get; } + bool StopOnError { get; } + TestOutcome MapWarningTo { get; } + bool UseTestNameInConsoleOutput { get; } + DisplayNameOptions DisplayName { get; } + char FullnameSeparator { get; } + DiscoveryMethod DiscoveryMethod { get; } + bool SkipNonTestAssemblies { get; } + + int AssemblySelectLimit { get; } + + bool UseNUnitFilter { get; } + bool IncludeStackTraceForSuites { get; } + + + void Load(IDiscoveryContext context, TestLogger testLogger = null); + void Load(string settingsXml); + void SaveRandomSeed(string dirname); + void RestoreRandomSeed(string dirname); + + bool EnsureAttachmentFileScheme { get; } + + // For Internal Development use + bool FreakMode { get; } // displays metadata instead of real data in Test Explorer + bool Debug { get; } + bool DebugExecution { get; } + bool DebugDiscovery { get; } + + // Filter control + ExplicitModeEnum ExplicitMode { get; } + bool SkipExecutionWhenNoTests { get; } + string TestOutputFolder { get; } + string SetTestOutputFolder(string workDirectory); +} \ No newline at end of file diff --git a/src/NUnitTestAdapter/NUnitTestAdapter.cs b/src/NUnitTestAdapter/NUnitTestAdapter.cs index ccea2855..4446d108 100644 --- a/src/NUnitTestAdapter/NUnitTestAdapter.cs +++ b/src/NUnitTestAdapter/NUnitTestAdapter.cs @@ -198,7 +198,7 @@ protected TestPackage CreateTestPackage(string assemblyName, IGrouping