diff --git a/build.cake b/build.cake index 8ee08347..a64397a1 100644 --- a/build.cake +++ b/build.cake @@ -15,8 +15,7 @@ var configuration = Argument("configuration", "Release"); var version = "4.5.0"; -var modifier = "-alpha.3"; - +var modifier = ""; var dbgSuffix = configuration.ToLower() == "debug" ? "-dbg" : ""; var packageVersion = version + modifier + dbgSuffix; diff --git a/nuget.config b/nuget.config index 8f1bcc0a..01dd41bc 100644 --- a/nuget.config +++ b/nuget.config @@ -3,6 +3,6 @@ - + \ No newline at end of file diff --git a/src/NUnit3AdapterExternalTests/NUnit3AdapterExternalTests.csproj b/src/NUnit3AdapterExternalTests/NUnit3AdapterExternalTests.csproj index 26df8db8..2ab906f0 100644 --- a/src/NUnit3AdapterExternalTests/NUnit3AdapterExternalTests.csproj +++ b/src/NUnit3AdapterExternalTests/NUnit3AdapterExternalTests.csproj @@ -3,7 +3,7 @@ NUnit.VisualStudio.TestAdapter.ExternalTests NUnit.VisualStudio.TestAdapter.Tests - net45;netcoreapp3.1 + net462;netcoreapp3.1 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/Metadata/DirectReflectionMetadataProvider.cs b/src/NUnitTestAdapter/Metadata/DirectReflectionMetadataProvider.cs index 196bb7bd..50d1402a 100644 --- a/src/NUnitTestAdapter/Metadata/DirectReflectionMetadataProvider.cs +++ b/src/NUnitTestAdapter/Metadata/DirectReflectionMetadataProvider.cs @@ -27,7 +27,7 @@ using System.Reflection; using NUnit.VisualStudio.TestAdapter.Internal; -#if !NET462 +#if !NET462 && !NETSTANDARD using System.Runtime.Loader; #endif @@ -84,7 +84,7 @@ private static MethodInfo TryGetSingleMethod(string assemblyPath, string reflect { try { -#if !NET462 +#if !NET462 && !NETSTANDARD var assembly = AssemblyLoadContext.Default.LoadFromAssemblyPath(assemblyPath); #else var assembly = Assembly.LoadFrom(assemblyPath); diff --git a/src/NUnitTestAdapter/NUnit.TestAdapter.csproj b/src/NUnitTestAdapter/NUnit.TestAdapter.csproj index 1c42cb4f..d0928ace 100644 --- a/src/NUnitTestAdapter/NUnit.TestAdapter.csproj +++ b/src/NUnitTestAdapter/NUnit.TestAdapter.csproj @@ -4,9 +4,9 @@ NUnit3.TestAdapter NUnit.VisualStudio.TestAdapter - netcoreapp3.1 + - + net462;netcoreapp3.1 true https://github.com/nunit/nunit3-vs-adapter true @@ -33,7 +33,7 @@ - + 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, IGroupingtrue NUnit.VisualStudio.TestAdapter.Tests NUnit.VisualStudio.TestAdapter.Tests - - netcoreapp3.1 - + net462;netcoreapp3.1 + true true latest