Skip to content

Commit

Permalink
Merge pull request #1196 from nunit/updatefrom460
Browse files Browse the repository at this point in the history
Updatefrom460
  • Loading branch information
OsirisTerje authored Jul 26, 2024
2 parents 1c09ca5 + 0bc193e commit 14b36e5
Show file tree
Hide file tree
Showing 39 changed files with 121 additions and 217 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/NUnit3TestAdapter.CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: windows-latest

steps:
- uses: actions/checkout@v4.1.1
- uses: actions/checkout@v4.1.7
- uses: actions/setup-dotnet@v4
with:
dotnet-version: |
Expand Down
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
2 changes: 1 addition & 1 deletion .github/workflows/sonarbuild.yml.UnderWork
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: windows-latest
steps:
- name: Set up JDK 11
uses: actions/setup-java@v1
uses: actions/setup-java@v3.5.1
with:
java-version: 1.11
- uses: actions/checkout@v2
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 = "5.0.0";

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

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
4 changes: 1 addition & 3 deletions src/NUnit.TestAdapter.Tests.Acceptance/AcceptanceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net;

using NUnit.Framework;
using NUnit.Framework.Interfaces;
Expand Down Expand Up @@ -277,7 +276,6 @@ private static string TryGetTestNupkgVersion(string directory, string packageId)

var path = selected?.FullName;

return path is null ? null :
Path.GetFileNameWithoutExtension(path).Substring(packageId.Length + 1);
return Path.GetFileNameWithoutExtension(path)?.Substring(packageId.Length + 1) ?? "";
}
}
24 changes: 12 additions & 12 deletions src/NUnit.TestAdapter.Tests.Acceptance/FilterTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ public void Bar()

[Test, Platform("Win")]
[TestCase(NoFilter, 2, 3)]
[TestCase(@"TestCategory=FooGroup", 1, 2)]
[TestCase(@"TestCategory!=BarGroup", 1, 2)]
[TestCase(@"TestCategory=IsExplicit", 1, 1)]
[TestCase(@"FullyQualifiedName=Filter.Tests.Foo", 1, 1)]
[TestCase(@"FullyQualifiedName!=Filter.Tests.Foo", 1, 1)]
[TestCase(@"TestCategory!=AllGroup", 0, 0)]
[TestCase("TestCategory=FooGroup", 1, 2)]
[TestCase("TestCategory!=BarGroup", 1, 2)]
[TestCase("TestCategory=IsExplicit", 1, 1)]
[TestCase("FullyQualifiedName=Filter.Tests.Foo", 1, 1)]
[TestCase("FullyQualifiedName!=Filter.Tests.Foo", 1, 1)]
[TestCase("TestCategory!=AllGroup", 0, 0)]
// [TestCase(@"TestThatDontExistHere", 0, 0)]
// [TestCase(@"FullyQualifiedName~Filter.Tests.Foo", 1, 1)]
// [TestCase(@"FullyQualifiedName~Foo", 1, 1)]
Expand All @@ -58,11 +58,11 @@ public void Filter_DotNetTest(string filter, int executed, int total)

[Test, Platform("Win")]
[TestCase(NoFilter, 2, 3)]
[TestCase(@"TestCategory=FooGroup", 1, 2)]
[TestCase(@"TestCategory!=BarGroup", 1, 2)]
[TestCase(@"TestCategory=IsExplicit", 1, 1)]
[TestCase(@"FullyQualifiedName=Filter.Tests.Foo", 1, 1)]
[TestCase(@"TestCategory=XXXX", 0, 0)]
[TestCase("TestCategory=FooGroup", 1, 2)]
[TestCase("TestCategory!=BarGroup", 1, 2)]
[TestCase("TestCategory=IsExplicit", 1, 1)]
[TestCase("FullyQualifiedName=Filter.Tests.Foo", 1, 1)]
[TestCase("TestCategory=XXXX", 0, 0)]
public void Filter_VSTest(string filter, int executed, int total)
{
var workspace = Build();
Expand All @@ -84,7 +84,7 @@ public void Filter_VSTest(string filter, int executed, int total)
public void Filter_DotNetTest_NUnitWhere(string filter, int executed, int total)
{
var workspace = Build();
var nunitWhere = $@"NUnit.Where={filter}";
var nunitWhere = $"NUnit.Where={filter}";
var results = workspace.DotNetTest(nunitWhere, true, true, TestContext.WriteLine);
Verify(executed, total, results);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,11 @@
<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="NUnit.Analyzers" Version="4.1.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>
14 changes: 7 additions & 7 deletions src/NUnit.TestAdapter.Tests.Acceptance/ParanthesisTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ public void VsTestNoFilter()
}

[Test, Platform("Win")]
[TestCase(@"FullyQualifiedName=Issue919.Foo.Bzzt", 1, 1)] // Sanity check
[TestCase("FullyQualifiedName=Issue919.Foo.Bzzt", 1, 1)] // Sanity check
[TestCase(@"FullyQualifiedName=Issue919.Foo.Bar\(1\)", 0, 0)]
[TestCase(@"FullyQualifiedName=Issue919.Foo.Baz\(1\)", 1, 1)]
[TestCase(@"Name=Bzzt", 1, 1)] // Sanity check
[TestCase("Name=Bzzt", 1, 1)] // Sanity check
[TestCase(@"Name=Bar\(1\)", 0, 0)]
[TestCase(@"Name=Baz\(1\)", 1, 1)]
[TestCase(@"", 2, 2)]
[TestCase("", 2, 2)]
public void VsTestTestCases(string filter, int executed, int total)
{
var workspace = Build();
Expand All @@ -58,7 +58,7 @@ public void VsTestTestCases(string filter, int executed, int total)
}

[Test, Platform("Win")]
[TestCase(@"Bzzt", 1, 1)] // Sanity check
[TestCase("Bzzt", 1, 1)] // Sanity check
[TestCase(@"Bar\(1\)", 0, 0)]
[TestCase(@"Baz\(1\)", 1, 1)]
public void VsTestTests(string filter, int executed, int total)
Expand All @@ -69,13 +69,13 @@ public void VsTestTests(string filter, int executed, int total)
}

[Test, Platform("Win")]
[TestCase(@"FullyQualifiedName=Issue919.Foo.Bzzt", 1, 1)] // Sanity check
[TestCase("FullyQualifiedName=Issue919.Foo.Bzzt", 1, 1)] // Sanity check
[TestCase(@"FullyQualifiedName=Issue919.Foo.Bar\(1\)", 0, 0)]
[TestCase(@"FullyQualifiedName=Issue919.Foo.Baz\(1\)", 1, 1)]
[TestCase(@"Name=Bzzt", 1, 1)] // Sanity check
[TestCase("Name=Bzzt", 1, 1)] // Sanity check
[TestCase(@"Name=Bar\(1\)", 0, 0)]
[TestCase(@"Name=Baz\(1\)", 1, 1)]
[TestCase(@"", 2, 2)]
[TestCase("", 2, 2)]
public void DotnetTestCases(string filter, int executed, int total)
{
var workspace = Build();
Expand Down
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
18 changes: 5 additions & 13 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 @@ -34,23 +34,15 @@
<ItemGroup>
<PackageReference Include="Microsoft.Testing.Extensions.VSTestBridge" Version="1.2.1" />
<PackageReference Include="SourceLink.Create.CommandLine" Version="2.8.3" PrivateAssets="All" />
<PackageReference Include="nunit.engine" Version="3.18.1" />
<PackageReference Include="nunit" Version="3.14.0" />
<PackageReference Include="nunit.engine" Version="3.17.0" />
<PackageReference Include="TestCentric.Metadata" Version="3.0.2" Aliases="TestCentric" />
<PackageReference Include="TestCentric.Metadata" Version="3.0.2" Aliases="TestCentric" />
</ItemGroup>

<ItemGroup>
<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
Loading

0 comments on commit 14b36e5

Please sign in to comment.