From 3d36a7a7a06c0eb7d22d6ac3db4f75854dc1194d Mon Sep 17 00:00:00 2001 From: Terje Sandstrom Date: Sun, 28 Nov 2021 15:01:59 +0100 Subject: [PATCH 1/4] Updated comments in NUnitTestFilterBuilder --- build.cake | 2 +- src/NUnitTestAdapter/NUnit3TestDiscoverer.cs | 2 +- src/NUnitTestAdapter/NUnit3TestExecutor.cs | 2 +- src/NUnitTestAdapter/NUnitTestFilterBuilder.cs | 6 ++++++ 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/build.cake b/build.cake index 078c4368..94863524 100644 --- a/build.cake +++ b/build.cake @@ -13,7 +13,7 @@ var configuration = Argument("configuration", "Release"); ////////////////////////////////////////////////////////////////////// var version = "4.1.0"; -var modifier = ""; +var modifier = "-alpha.101"; var dbgSuffix = configuration.ToLower() == "debug" ? "-dbg" : ""; var packageVersion = version + modifier + dbgSuffix; diff --git a/src/NUnitTestAdapter/NUnit3TestDiscoverer.cs b/src/NUnitTestAdapter/NUnit3TestDiscoverer.cs index aa7e92f9..b6a5c2fe 100644 --- a/src/NUnitTestAdapter/NUnit3TestDiscoverer.cs +++ b/src/NUnitTestAdapter/NUnit3TestDiscoverer.cs @@ -21,7 +21,7 @@ // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // *********************************************************************** -// #define LAUNCHDEBUGGER +#define LAUNCHDEBUGGER using System; using System.Collections.Generic; diff --git a/src/NUnitTestAdapter/NUnit3TestExecutor.cs b/src/NUnitTestAdapter/NUnit3TestExecutor.cs index 0a7dcb93..f815bed6 100644 --- a/src/NUnitTestAdapter/NUnit3TestExecutor.cs +++ b/src/NUnitTestAdapter/NUnit3TestExecutor.cs @@ -21,7 +21,7 @@ // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // *********************************************************************** -// #define LAUNCHDEBUGGER +#define LAUNCHDEBUGGER using System; using System.Collections.Generic; diff --git a/src/NUnitTestAdapter/NUnitTestFilterBuilder.cs b/src/NUnitTestAdapter/NUnitTestFilterBuilder.cs index 92a1eacf..73c929ff 100644 --- a/src/NUnitTestAdapter/NUnitTestFilterBuilder.cs +++ b/src/NUnitTestAdapter/NUnitTestFilterBuilder.cs @@ -65,6 +65,9 @@ public TestFilter ConvertVsTestFilterToNUnitFilter(IVsTestFilter vsFilter, IDisc return result; } + /// + /// Used when running from command line, mode Non-Ide, e.g. 'dotnet test --filter xxxxx'. Reads the TfsTestCaseFilterExpression + /// public TestFilter ConvertVsTestFilterToNUnitFilter(IVsTestFilter vsFilter) { if (string.IsNullOrEmpty(vsFilter?.TfsTestCaseFilterExpression?.TestCaseFilterValue)) @@ -87,6 +90,9 @@ public TestFilter ConvertTfsFilterToNUnitFilter(IVsTestFilter vsFilter, IDiscove return testCases.Any() ? FilterByList(testCases) : NoTestsFound; } + /// + /// Used when a Where statement is added as a runsettings parameter, either in a runsettings file or on the command line from dotnet using the '-- NUnit.Where .....' statement + /// public TestFilter FilterByWhere(string where) { if (string.IsNullOrEmpty(where)) From 332d52af2b1862889f33bfa9919d35970827615b Mon Sep 17 00:00:00 2001 From: Terje Sandstrom Date: Wed, 1 Dec 2021 23:54:39 +0100 Subject: [PATCH 2/4] fixes --- build.cake | 2 +- src/NUnitTestAdapter/NUnit3TestExecutor.cs | 2 +- src/NUnitTestAdapter/NUnitEngine/DiscoveryConverter.cs | 2 +- src/NUnitTestAdapterTests/TestExecutionTests.cs | 10 +++++----- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/build.cake b/build.cake index 15f0217d..3d6252c7 100644 --- a/build.cake +++ b/build.cake @@ -13,7 +13,7 @@ var configuration = Argument("configuration", "Release"); ////////////////////////////////////////////////////////////////////// var version = "4.2.0"; -var modifier = "-alpha.201"; +var modifier = "-alpha.310"; var dbgSuffix = configuration.ToLower() == "debug" ? "-dbg" : ""; var packageVersion = version + modifier + dbgSuffix; diff --git a/src/NUnitTestAdapter/NUnit3TestExecutor.cs b/src/NUnitTestAdapter/NUnit3TestExecutor.cs index 0a7dcb93..f815bed6 100644 --- a/src/NUnitTestAdapter/NUnit3TestExecutor.cs +++ b/src/NUnitTestAdapter/NUnit3TestExecutor.cs @@ -21,7 +21,7 @@ // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // *********************************************************************** -// #define LAUNCHDEBUGGER +#define LAUNCHDEBUGGER using System; using System.Collections.Generic; diff --git a/src/NUnitTestAdapter/NUnitEngine/DiscoveryConverter.cs b/src/NUnitTestAdapter/NUnitEngine/DiscoveryConverter.cs index 9473a515..1a4913c3 100644 --- a/src/NUnitTestAdapter/NUnitEngine/DiscoveryConverter.cs +++ b/src/NUnitTestAdapter/NUnitEngine/DiscoveryConverter.cs @@ -170,7 +170,7 @@ public IList Convert(NUnitResults discoveryResults, string assemblyPat return loadedTestCases; IEnumerable RunnableTestCases(bool isExplicit) => - isExplicit || !Settings.DesignMode + isExplicit /*|| !Settings.DesignMode*/ ? TestRun.TestAssembly.AllTestCases : TestRun.TestAssembly.RunnableTestCases; } diff --git a/src/NUnitTestAdapterTests/TestExecutionTests.cs b/src/NUnitTestAdapterTests/TestExecutionTests.cs index e768fa0d..083f799c 100644 --- a/src/NUnitTestAdapterTests/TestExecutionTests.cs +++ b/src/NUnitTestAdapterTests/TestExecutionTests.cs @@ -82,11 +82,11 @@ public void LoadMockassembly() [TestCase("method =~ MockTest?", 5)] [TestCase("method =~ MockTest? and cat != MockCategory", 3)] [TestCase("namespace == ThisNamespaceDoesNotExist", 0)] - [TestCase("test==NUnit.Tests.Assemblies.MockTestFixture", MockTestFixture.Tests, TestName = "{m}_MockTestFixture")] + [TestCase("test==NUnit.Tests.Assemblies.MockTestFixture", MockTestFixture.Tests - MockTestFixture.Explicit, TestName = "{m}_MockTestFixture")] [TestCase("test==NUnit.Tests.IgnoredFixture and method == Test2", 1, TestName = "{m}_IgnoredFixture")] - [TestCase("class==NUnit.Tests.Assemblies.MockTestFixture", MockTestFixture.Tests)] - [TestCase("name==MockTestFixture", MockTestFixture.Tests + NUnit.Tests.TestAssembly.MockTestFixture.Tests)] - [TestCase("cat==FixtureCategory", MockTestFixture.Tests)] + [TestCase("class==NUnit.Tests.Assemblies.MockTestFixture", MockTestFixture.Tests - MockTestFixture.Explicit)] + [TestCase("name==MockTestFixture", MockTestFixture.Tests + NUnit.Tests.TestAssembly.MockTestFixture.Tests - MockTestFixture.Explicit)] + [TestCase("cat==FixtureCategory", MockTestFixture.Tests - MockTestFixture.Explicit)] public void TestsWhereShouldFilter(string filter, int expectedCount) { // Create a fake environment. @@ -158,7 +158,7 @@ public void CorrectNumberOfTestCasesWereStarted() Console.WriteLine(ev.TestCase.DisplayName); Assert.That( testLog.Events.FindAll(e => e.EventType == eventType).Count, - Is.EqualTo(MockAssembly.ResultCount - BadFixture.Tests - IgnoredFixture.Tests - ExplicitFixture.Tests)); + Is.EqualTo(MockAssembly.ResultCount - BadFixture.Tests - IgnoredFixture.Tests - ExplicitFixture.Tests - MockTestFixture.Explicit)); } [Test] From abf706792512fd732426e02b2d31c89ccf3181c9 Mon Sep 17 00:00:00 2001 From: Terje Sandstrom Date: Sat, 11 Dec 2021 15:30:20 +0100 Subject: [PATCH 3/4] updated for 912 and 919 --- build.cake | 4 ++-- src/NUnitTestAdapter/NUnit3TestDiscoverer.cs | 2 +- src/NUnitTestAdapter/NUnit3TestExecutor.cs | 7 ++----- src/NUnitTestAdapter/NUnitEngine/DiscoveryConverter.cs | 2 +- src/NUnitTestAdapter/NUnitTestFilterBuilder.cs | 4 ++-- .../TestFilterConverterTests/TestFilterParserTests.cs | 2 +- 6 files changed, 9 insertions(+), 12 deletions(-) diff --git a/build.cake b/build.cake index 94863524..c3a2b849 100644 --- a/build.cake +++ b/build.cake @@ -12,8 +12,8 @@ var configuration = Argument("configuration", "Release"); // SET PACKAGE VERSION ////////////////////////////////////////////////////////////////////// -var version = "4.1.0"; -var modifier = "-alpha.101"; +var version = "4.2.0"; +var modifier = "-alpha.919.3"; var dbgSuffix = configuration.ToLower() == "debug" ? "-dbg" : ""; var packageVersion = version + modifier + dbgSuffix; diff --git a/src/NUnitTestAdapter/NUnit3TestDiscoverer.cs b/src/NUnitTestAdapter/NUnit3TestDiscoverer.cs index b6a5c2fe..aa7e92f9 100644 --- a/src/NUnitTestAdapter/NUnit3TestDiscoverer.cs +++ b/src/NUnitTestAdapter/NUnit3TestDiscoverer.cs @@ -21,7 +21,7 @@ // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // *********************************************************************** -#define LAUNCHDEBUGGER +// #define LAUNCHDEBUGGER using System; using System.Collections.Generic; diff --git a/src/NUnitTestAdapter/NUnit3TestExecutor.cs b/src/NUnitTestAdapter/NUnit3TestExecutor.cs index f815bed6..58e32fe3 100644 --- a/src/NUnitTestAdapter/NUnit3TestExecutor.cs +++ b/src/NUnitTestAdapter/NUnit3TestExecutor.cs @@ -21,7 +21,7 @@ // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // *********************************************************************** -#define LAUNCHDEBUGGER +// #define LAUNCHDEBUGGER using System; using System.Collections.Generic; @@ -119,10 +119,7 @@ public void RunTests(IEnumerable sources, IRunContext runContext, IFrame var vsTestFilter = VsTestFilterFactory.CreateVsTestFilter(Settings, runContext); filter = builder.ConvertVsTestFilterToNUnitFilter(vsTestFilter); } - if (filter == null) - { - filter = builder.FilterByWhere(Settings.Where); - } + filter ??= builder.FilterByWhere(Settings.Where); foreach (string assemblyName in sources) { diff --git a/src/NUnitTestAdapter/NUnitEngine/DiscoveryConverter.cs b/src/NUnitTestAdapter/NUnitEngine/DiscoveryConverter.cs index ce10ab61..f68b6eeb 100644 --- a/src/NUnitTestAdapter/NUnitEngine/DiscoveryConverter.cs +++ b/src/NUnitTestAdapter/NUnitEngine/DiscoveryConverter.cs @@ -170,7 +170,7 @@ public IList Convert(NUnitResults discoveryResults, string assemblyPat return loadedTestCases; IEnumerable RunnableTestCases(bool isExplicit) => - isExplicit || !Settings.DesignMode + isExplicit ? TestRun.TestAssembly.AllTestCases : TestRun.TestAssembly.RunnableTestCases; } diff --git a/src/NUnitTestAdapter/NUnitTestFilterBuilder.cs b/src/NUnitTestAdapter/NUnitTestFilterBuilder.cs index 73c929ff..f5245470 100644 --- a/src/NUnitTestAdapter/NUnitTestFilterBuilder.cs +++ b/src/NUnitTestAdapter/NUnitTestFilterBuilder.cs @@ -66,7 +66,7 @@ public TestFilter ConvertVsTestFilterToNUnitFilter(IVsTestFilter vsFilter, IDisc } /// - /// Used when running from command line, mode Non-Ide, e.g. 'dotnet test --filter xxxxx'. Reads the TfsTestCaseFilterExpression + /// Used when running from command line, mode Non-Ide, e.g. 'dotnet test --filter xxxxx'. Reads the TfsTestCaseFilterExpression. /// public TestFilter ConvertVsTestFilterToNUnitFilter(IVsTestFilter vsFilter) { @@ -91,7 +91,7 @@ public TestFilter ConvertTfsFilterToNUnitFilter(IVsTestFilter vsFilter, IDiscove } /// - /// Used when a Where statement is added as a runsettings parameter, either in a runsettings file or on the command line from dotnet using the '-- NUnit.Where .....' statement + /// Used when a Where statement is added as a runsettings parameter, either in a runsettings file or on the command line from dotnet using the '-- NUnit.Where .....' statement. /// public TestFilter FilterByWhere(string where) { diff --git a/src/NUnitTestAdapterTests/TestFilterConverterTests/TestFilterParserTests.cs b/src/NUnitTestAdapterTests/TestFilterConverterTests/TestFilterParserTests.cs index 2d51a7cf..b00d16dd 100644 --- a/src/NUnitTestAdapterTests/TestFilterConverterTests/TestFilterParserTests.cs +++ b/src/NUnitTestAdapterTests/TestFilterConverterTests/TestFilterParserTests.cs @@ -173,7 +173,7 @@ public void TestParser(string input, string output) { Assert.That(_parser.Parse(input), Is.EqualTo($"{output}")); - XmlDocument doc = new XmlDocument(); + XmlDocument doc = new (); Assert.DoesNotThrow(() => doc.LoadXml(output)); } From f00e7b745f581cbb71d833cc4811347ebc792cf7 Mon Sep 17 00:00:00 2001 From: Terje Sandstrom Date: Sat, 11 Dec 2021 15:34:13 +0100 Subject: [PATCH 4/4] remove debugflag --- src/NUnitTestAdapter/NUnit3TestExecutor.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/NUnitTestAdapter/NUnit3TestExecutor.cs b/src/NUnitTestAdapter/NUnit3TestExecutor.cs index b03dbbd4..58e32fe3 100644 --- a/src/NUnitTestAdapter/NUnit3TestExecutor.cs +++ b/src/NUnitTestAdapter/NUnit3TestExecutor.cs @@ -21,7 +21,7 @@ // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // *********************************************************************** -#define LAUNCHDEBUGGER +// #define LAUNCHDEBUGGER using System; using System.Collections.Generic;