Skip to content

Commit

Permalink
Merge branch 'master' into dependabot/github_actions/actions/checkout…
Browse files Browse the repository at this point in the history
…-4.1.7
  • Loading branch information
OsirisTerje authored Jul 26, 2024
2 parents 05c7786 + d46cdd0 commit 80cd5ce
Show file tree
Hide file tree
Showing 21 changed files with 67 additions and 141 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/NUnit3TestAdapter.Myget.Publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:

steps:
- name: ⤵Checkout Source
uses: actions/checkout@v4
uses: actions/checkout@v4.1.7

- name: 🛠️ Setup .NET
uses: actions/setup-dotnet@v4
Expand Down
5 changes: 5 additions & 0 deletions NUnit3TestAdapter.sln.DotSettings
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateStaticFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateStaticReadonly/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb"&gt;&lt;ExtraRule Prefix="" Suffix="" Style="AA_BB" /&gt;&lt;/Policy&gt;</s:String>
<s:String x:Key="/Default/CodeInspection/CSharpLanguageProject/LanguageLevel/@EntryValue">CSharp70</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/UserRules/=15b5b1f1_002D457c_002D4ca6_002Db278_002D5615aedc07d3/@EntryIndexedValue">&lt;Policy&gt;&lt;Descriptor Staticness="Static" AccessRightKinds="Private" Description="Static readonly fields (private)"&gt;&lt;ElementKinds&gt;&lt;Kind Name="READONLY_FIELD" /&gt;&lt;/ElementKinds&gt;&lt;/Descriptor&gt;&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb"&gt;&lt;ExtraRule Prefix="" Suffix="" Style="AA_BB" /&gt;&lt;/Policy&gt;&lt;/Policy&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/UserRules/=236f7aa5_002D7b06_002D43ca_002Dbf2a_002D9b31bfcff09a/@EntryIndexedValue">&lt;Policy&gt;&lt;Descriptor Staticness="Any" AccessRightKinds="Private" Description="Constant fields (private)"&gt;&lt;ElementKinds&gt;&lt;Kind Name="CONSTANT_FIELD" /&gt;&lt;/ElementKinds&gt;&lt;/Descriptor&gt;&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb"&gt;&lt;ExtraRule Prefix="" Suffix="" Style="AA_BB" /&gt;&lt;/Policy&gt;&lt;/Policy&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/UserRules/=4a98fdf6_002D7d98_002D4f5a_002Dafeb_002Dea44ad98c70c/@EntryIndexedValue">&lt;Policy&gt;&lt;Descriptor Staticness="Instance" AccessRightKinds="Private" Description="Instance fields (private)"&gt;&lt;ElementKinds&gt;&lt;Kind Name="FIELD" /&gt;&lt;Kind Name="READONLY_FIELD" /&gt;&lt;/ElementKinds&gt;&lt;/Descriptor&gt;&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb"&gt;&lt;ExtraRule Prefix="" Suffix="" Style="aaBb" /&gt;&lt;/Policy&gt;&lt;/Policy&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/UserRules/=f9fce829_002De6f4_002D4cb2_002D80f1_002D5497c44f51df/@EntryIndexedValue">&lt;Policy&gt;&lt;Descriptor Staticness="Static" AccessRightKinds="Private" Description="Static fields (private)"&gt;&lt;ElementKinds&gt;&lt;Kind Name="FIELD" /&gt;&lt;/ElementKinds&gt;&lt;/Descriptor&gt;&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;&lt;/Policy&gt;</s:String>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EPredefinedNamingRulesToUserRulesUpgrade/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=mstest/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=nunit/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Parallelization/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
Expand Down
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ or the latest developer build version

##### Builds on master
![NUnit3TestAdapter.CI](https://img.shields.io/github/actions/workflow/status/nunit/nunit3-vs-adapter/NUnit3TestAdapter.CI.yml?branch=master)
[![Tests](https://img.shields.io/azure-devops/tests/nunit/nunit/4)](https://nunit.visualstudio.com/NUnit/_build?definitionId=4&_a=completed)
[![Coverage](https://img.shields.io/azure-devops/coverage/nunit/nunit/4.svg)](https://nunit.visualstudio.com/NUnit/_build?definitionId=4&_a=completed)



##### Support

Expand Down
69 changes: 0 additions & 69 deletions azure-pipelines.yml

This file was deleted.

2 changes: 1 addition & 1 deletion build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var configuration = Argument("configuration", "Release");

var version = "4.6.0";

var modifier = "-beta.2";
var modifier = "";

var dbgSuffix = configuration.ToLower() == "debug" ? "-dbg" : "";
var packageVersion = version + modifier + dbgSuffix;
Expand Down
2 changes: 1 addition & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.507" PrivateAssets="all" />
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.556" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,12 @@

<ItemGroup>
<PackageReference Include="nunit" Version="4.1.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="NUnit.Analyzers" Version="4.2.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<PackageReference Update="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Update="StyleCop.Analyzers" Version="1.2.0-beta.556" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,4 @@
<PackageReference Include="NUnit" Version="4.1.0" />
</ItemGroup>

<ItemGroup>
<PackageReference Update="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Update="StyleCop.Analyzers" Version="1.2.0-beta.556" />
</ItemGroup>

</Project>
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
4 changes: 4 additions & 0 deletions src/NUnitTestAdapter/Execution.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ protected TestFilter CheckFilter(TestFilter testFilter, IDiscoveryConverter disc
}
return testFilter;
}
if (testFilter.IsPartitionFilter())
{
return testFilter;
}
var filterBuilder = CreateTestFilterBuilder();
return filterBuilder.FilterByList(discovery.LoadedTestCases);
}
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
16 changes: 4 additions & 12 deletions src/NUnitTestAdapter/NUnit.TestAdapter.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
<SourceLinkOriginUrl>https://github.com/nunit/nunit3-vs-adapter</SourceLinkOriginUrl>
<SourceLinkCreate>true</SourceLinkCreate>
<AssemblyVersion>4.5.0.0</AssemblyVersion>
<FileVersion>4.5.0.0</FileVersion>
<AssemblyVersion>4.6.0.0</AssemblyVersion>
<FileVersion>4.6.0.0</FileVersion>
<NeutralLanguage>en</NeutralLanguage>
<Title>NUnit3 Test Adapter for Visual Studio</Title>
<Copyright>Copyright © 2011-2021 Charlie Poole, 2014-2023 Terje Sandstrom</Copyright>
<Copyright>Copyright © 2011-2021 Charlie Poole, 2014-2024 Terje Sandstrom</Copyright>
<Description>A package containing the NUnit3 TestAdapter for Visual Studio 2012 onwards.
The package works with Visual Studio 2012 and newer, dotnet test and VSTest.Console.</Description>
<Company>NUnit Project</Company>
Expand All @@ -33,7 +33,7 @@

<ItemGroup>
<PackageReference Include="SourceLink.Create.CommandLine" Version="2.8.3" PrivateAssets="All" />
<PackageReference Include="nunit.engine" Version="3.17.0" />
<PackageReference Include="nunit.engine" Version="3.18.1" />
<PackageReference Include="TestCentric.Metadata" Version="3.0.2" Aliases="TestCentric" />
</ItemGroup>

Expand All @@ -49,14 +49,6 @@
<Folder Include="TestFilterConverter\" />
</ItemGroup>

<ItemGroup>
<PackageReference Update="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Update="StyleCop.Analyzers" Version="1.2.0-beta.556" />
</ItemGroup>

<Target Name="PreventTestPlatformObjectModelCopyLocal" AfterTargets="ResolveReferences">
<ItemGroup>
<ReferenceCopyLocalPaths Remove="@(ReferenceCopyLocalPaths)" Condition="'%(Filename)' == 'Microsoft.VisualStudio.TestPlatform.ObjectModel'" />
Expand Down
13 changes: 10 additions & 3 deletions src/NUnitTestAdapter/NUnit3TestDiscoverer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ public void DiscoverTests(IEnumerable<string> sources, IDiscoveryContext discove
}
else
{
TestLog.Warning("Exception thrown discovering tests in " + sourceAssembly, e);
TestLog.Error("Exception thrown discovering tests in " + sourceAssembly, e);
// throw; // This causes the VerifyLoading test to fail. It can't load the Empty assembly, which happens regardless of this, just when rethrowing it shows up.
}
}
catch (BadImageFormatException)
Expand All @@ -145,13 +146,19 @@ public void DiscoverTests(IEnumerable<string> sources, IDiscoveryContext discove
catch (TypeLoadException ex)
{
if (ex.TypeName == "NUnit.Framework.Api.FrameworkController")
{
TestLog.Warning(" Skipping NUnit 2.x test assembly");
}
else
TestLog.Warning("Exception thrown discovering tests in " + sourceAssembly, ex);
{
TestLog.Error("Exception thrown discovering tests in " + sourceAssembly, ex);
throw;
}
}
catch (Exception ex)
{
TestLog.Warning("Exception thrown discovering tests in " + sourceAssembly, ex);
TestLog.Error("Exception thrown discovering tests in " + sourceAssembly, ex);
throw;
}
finally
{
Expand Down
24 changes: 20 additions & 4 deletions src/NUnitTestAdapter/NUnit3TestExecutor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

using Microsoft.VisualStudio.TestPlatform.ObjectModel;
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter;
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging;

using NUnit.Engine;
using NUnit.VisualStudio.TestAdapter.Dump;
Expand Down Expand Up @@ -142,7 +143,7 @@ private void RunAssemblies(IEnumerable<string> sources, TestFilter filter)
string assemblyPath = Path.IsPathRooted(assemblyName)
? assemblyName
: Path.Combine(Directory.GetCurrentDirectory(), assemblyName);
RunAssembly(assemblyPath, null, filter);
RunAssembly(assemblyPath, null, filter, assemblyName);
}
catch (Exception ex)
{
Expand Down Expand Up @@ -205,13 +206,13 @@ public void RunTests(IEnumerable<TestCase> tests, IRunContext runContext, IFrame
var filterBuilder = CreateTestFilterBuilder();
var filter = filterBuilder.FilterByList(assemblyGroup);

RunAssembly(assemblyPath, assemblyGroup, filter);
RunAssembly(assemblyPath, assemblyGroup, filter, assemblyName);
}
catch (Exception ex)
{
if (ex is TargetInvocationException) { ex = ex.InnerException; }

TestLog.Warning("Exception thrown executing tests", ex);
TestLog.Error("Exception thrown executing tests", ex);
}

assemblytiming.LogTime($"Executing {assemblyGroup.Key} time ");
Expand Down Expand Up @@ -274,7 +275,8 @@ public void InitializeForExecution(IRunContext runContext, IFrameworkHandle fram
TestLog.Debug("EnableShutdown: " + enableShutdown);
}

private void RunAssembly(string assemblyPath, IGrouping<string, TestCase> testCases, TestFilter filter)
private void RunAssembly(string assemblyPath, IGrouping<string, TestCase> testCases, TestFilter filter,
string assemblyName)
{
LogActionAndSelection(assemblyPath, filter);
RestoreRandomSeed(assemblyPath);
Expand Down Expand Up @@ -326,6 +328,20 @@ private void RunAssembly(string assemblyPath, IGrouping<string, TestCase> testCa
if (ex is TargetInvocationException)
ex = ex.InnerException;
TestLog.Warning(" Exception thrown executing tests in " + assemblyPath, ex);
var tc = new TestCase(assemblyName, new Uri(NUnit3TestExecutor.ExecutorUri), assemblyName)
{
DisplayName = assemblyName,
FullyQualifiedName = assemblyName,
Id = Guid.NewGuid(),
CodeFilePath = assemblyPath,
LineNumber = 0,
};
FrameworkHandle.RecordResult(new TestResult(tc)
{
Outcome = TestOutcome.Failed,
ErrorMessage = ex.ToString(),
ErrorStackTrace = ex.StackTrace,
});
}
finally
{
Expand Down
3 changes: 3 additions & 0 deletions src/NUnitTestAdapter/NUnitEngine/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ public static bool AllWithEmptyFalse<T>(this IEnumerable<T> list, Func<T, bool>
public static bool IsCategoryFilter(this TestFilter filter) =>
filter != TestFilter.Empty && filter.Text.Contains("<cat>");

public static bool IsPartitionFilter(this TestFilter filter) =>
filter != TestFilter.Empty && filter.Text.Contains("<partition>");

public static bool IsNegativeCategoryFilter(this TestFilter filter) =>
filter.IsCategoryFilter() && filter.Text.Contains("<not><cat>");
}
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
16 changes: 4 additions & 12 deletions src/NUnitTestAdapterTests/NUnit.TestAdapter.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<ItemGroup>
<PackageReference Include="NSubstitute" Version="5.1.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.9.2" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.10.0" />
<PackageReference Include="NUnit.Analyzers" Version="4.2.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand All @@ -30,12 +30,12 @@

<ItemGroup Condition=" '$(TargetFramework)' == 'net462' ">
<PackageReference Include="Microsoft.TestPlatform.ObjectModel" Version="11.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp'">
<PackageReference Include="Microsoft.TestPlatform.ObjectModel" Version="17.9.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="Microsoft.TestPlatform.ObjectModel" Version="17.10.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
</ItemGroup>

<ItemGroup>
Expand All @@ -51,14 +51,6 @@
<None Update="temp.snk" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>

<ItemGroup>
<PackageReference Update="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Update="StyleCop.Analyzers" Version="1.2.0-beta.556" />
</ItemGroup>

<Target Name="PreventTestPlatformObjectModelCopyLocal" AfterTargets="ResolveReferences">
<ItemGroup>
<ReferenceCopyLocalPaths Remove="@(ReferenceCopyLocalPaths)" Condition="'%(Filename)' == 'Microsoft.VisualStudio.TestPlatform.ObjectModel'" />
Expand Down
Loading

0 comments on commit 80cd5ce

Please sign in to comment.