Navigation Menu

Skip to content

Commit

Permalink
450alpha2 (#1095)
Browse files Browse the repository at this point in the history
* Added engine with fix for NUnit 4

* Updated test projects

* Updating to 4.5.0

* commented out local nuget feed

* resetting frameworks for test project

* Updateing target frameworks

* Fix for issue #1097
  • Loading branch information
OsirisTerje committed May 30, 2023
1 parent 364f81e commit 7329666
Show file tree
Hide file tree
Showing 8 changed files with 130 additions and 115 deletions.
3 changes: 1 addition & 2 deletions build.cake
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion nuget.config
Expand Up @@ -3,6 +3,6 @@
<packageSources>
<clear />
<add key="nuget" value="https://api.nuget.org/v3/index.json" />
<add key="Local" value="c:\nuget" />
<!--<add key="Local" value="c:\nuget" />-->
</packageSources>
</configuration>
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<AssemblyName>NUnit.VisualStudio.TestAdapter.ExternalTests</AssemblyName>
<RootNamespace>NUnit.VisualStudio.TestAdapter.Tests</RootNamespace>
<TargetFrameworks>net45;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net462;netcoreapp3.1</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down
107 changes: 3 additions & 104 deletions src/NUnitTestAdapter/AdapterSettings.cs
Expand Up @@ -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<string, string> 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; }

/// <summary>
/// Syntax documentation <see cref="https://github.com/nunit/docs/wiki/Template-Based-Test-Naming"/>.
/// </summary>
string DefaultTestNamePattern { get; }

VsTestCategoryType VsTestCategoryType { get; }
string TestOutputXml { get; }
bool UseTestOutputXml { get; }
OutputXmlFolderMode OutputXmlFolderMode { get; }

/// <summary>
/// For retry runs create a new file for each run.
/// </summary>
bool NewOutputXmlFileForEachRun { get; }

/// <summary>
/// True if test run is triggered in an IDE/Editor context.
/// </summary>
bool DesignMode { get; }

/// <summary>
/// If true, an adapter shouldn't create appdomains to run tests.
/// </summary>
bool DisableAppDomain { get; }

/// <summary>
/// If true, an adapter should disable any test case parallelization.
/// </summary>
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,
Expand Down Expand Up @@ -197,6 +93,8 @@ public AdapterSettings(ITestLogger logger)
/// </summary>
public bool DisableParallelization { get; private set; }

public bool AllowParallelWithDebugger { get; private set; }

/// <summary>
/// True if test run is triggered in an IDE/Editor context.
/// </summary>
Expand Down Expand Up @@ -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);
Expand Down
118 changes: 118 additions & 0 deletions 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<string, string> 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; }

/// <summary>
/// Syntax documentation <see cref="https://github.com/nunit/docs/wiki/Template-Based-Test-Naming"/>.
/// </summary>
string DefaultTestNamePattern { get; }

VsTestCategoryType VsTestCategoryType { get; }
string TestOutputXml { get; }
bool UseTestOutputXml { get; }
OutputXmlFolderMode OutputXmlFolderMode { get; }

/// <summary>
/// For retry runs create a new file for each run.
/// </summary>
bool NewOutputXmlFileForEachRun { get; }

/// <summary>
/// True if test run is triggered in an IDE/Editor context.
/// </summary>
bool DesignMode { get; }

/// <summary>
/// If true, an adapter shouldn't create appdomains to run tests.
/// </summary>
bool DisableAppDomain { get; }

/// <summary>
/// If true, an adapter should disable any test case parallelization.
/// </summary>
bool DisableParallelization { get; }

/// <summary>
/// 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.
/// </summary>
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);
}
6 changes: 3 additions & 3 deletions src/NUnitTestAdapter/NUnit.TestAdapter.csproj
Expand Up @@ -4,9 +4,9 @@
<AssemblyName>NUnit3.TestAdapter</AssemblyName>
<!--<AssemblyName>NUnit3.TestAdapterDebug</AssemblyName>-->
<RootNamespace>NUnit.VisualStudio.TestAdapter</RootNamespace>
<TargetFramework>netcoreapp3.1</TargetFramework>
<!--<TargetFramework>netcoreapp3.1</TargetFramework>-->
<!-- For testing and debugging-->
<!--<TargetFrameworks>net462;netcoreapp3.1</TargetFrameworks>-->
<TargetFrameworks>net462;netcoreapp3.1</TargetFrameworks>
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
<SourceLinkOriginUrl>https://github.com/nunit/nunit3-vs-adapter</SourceLinkOriginUrl>
<SourceLinkCreate>true</SourceLinkCreate>
Expand All @@ -33,7 +33,7 @@

<ItemGroup>
<PackageReference Include="SourceLink.Create.CommandLine" Version="2.8.3" PrivateAssets="All" />
<PackageReference Include="nunit.engine" Version="3.15.4-pre00001" />
<PackageReference Include="nunit.engine" Version="3.15.4" />
<PackageReference Include="TestCentric.Metadata" Version="1.7.1" Aliases="TestCentric" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/NUnitTestAdapter/NUnitTestAdapter.cs
Expand Up @@ -198,7 +198,7 @@ protected TestPackage CreateTestPackage(string assemblyName, IGrouping<string, T
TestLog.Debug(" Setting ShadowCopyFiles to true");
}

if (Debugger.IsAttached)
if (Debugger.IsAttached && !Settings.AllowParallelWithDebugger)
{
package.Settings[PackageSettings.NumberOfTestWorkers] = 0;
TestLog.Debug(" Setting NumberOfTestWorkers to zero for Debugging");
Expand Down
5 changes: 2 additions & 3 deletions src/NUnitTestAdapterTests/NUnit.TestAdapter.Tests.csproj
Expand Up @@ -4,9 +4,8 @@
<IsTestProject>true</IsTestProject>
<RootNamespace>NUnit.VisualStudio.TestAdapter.Tests</RootNamespace>
<AssemblyName>NUnit.VisualStudio.TestAdapter.Tests</AssemblyName>
<!--<TargetFrameworks>net462;netcoreapp3.1</TargetFrameworks>-->
<TargetFrameworks>netcoreapp3.1</TargetFrameworks>
<!-- For testing and debugging-->
<TargetFrameworks>net462;netcoreapp3.1</TargetFrameworks>
<!--<TargetFrameworks>netcoreapp3.1</TargetFrameworks>--> <!-- For testing and debugging-->
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
<LangVersion>latest</LangVersion>
Expand Down

0 comments on commit 7329666

Please sign in to comment.