From 60e055047e0c572db1cbaaf10ec7b0bdb58ca6a6 Mon Sep 17 00:00:00 2001 From: Mayank Bansal Date: Tue, 10 Apr 2018 14:13:06 +0530 Subject: [PATCH 01/25] Define MsTest to support managed sources only --- src/Adapter/MSTest.CoreAdapter/MSTest.CoreAdapter.csproj | 3 +++ src/Adapter/MSTest.CoreAdapter/MSTestDiscoverer.cs | 2 ++ src/Adapter/MSTest.CoreAdapter/packages.config | 1 + .../MSTestDiscovererTests.cs | 9 +++++++++ 4 files changed, 15 insertions(+) diff --git a/src/Adapter/MSTest.CoreAdapter/MSTest.CoreAdapter.csproj b/src/Adapter/MSTest.CoreAdapter/MSTest.CoreAdapter.csproj index c1995f15fc..4983d30e55 100644 --- a/src/Adapter/MSTest.CoreAdapter/MSTest.CoreAdapter.csproj +++ b/src/Adapter/MSTest.CoreAdapter/MSTest.CoreAdapter.csproj @@ -119,6 +119,9 @@ C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETPortable\v4.5\System.Collections.Concurrent.dll + + ..\..\..\packages\System.ComponentModel.Primitives.4.1.0\lib\netstandard1.0\System.ComponentModel.Primitives.dll + diff --git a/src/Adapter/MSTest.CoreAdapter/MSTestDiscoverer.cs b/src/Adapter/MSTest.CoreAdapter/MSTestDiscoverer.cs index 8179dd273d..0919d2c9a5 100644 --- a/src/Adapter/MSTest.CoreAdapter/MSTestDiscoverer.cs +++ b/src/Adapter/MSTest.CoreAdapter/MSTestDiscoverer.cs @@ -5,6 +5,7 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter { using System; using System.Collections.Generic; + using System.ComponentModel; using System.IO; using System.Linq; using Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.ObjectModel; @@ -20,6 +21,7 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter [FileExtension(".appx")] [FileExtension(".dll")] [FileExtension(".exe")] + [Category("managed")] public class MSTestDiscoverer : ITestDiscoverer { /// diff --git a/src/Adapter/MSTest.CoreAdapter/packages.config b/src/Adapter/MSTest.CoreAdapter/packages.config index 1703f0c32f..47b10485d0 100644 --- a/src/Adapter/MSTest.CoreAdapter/packages.config +++ b/src/Adapter/MSTest.CoreAdapter/packages.config @@ -3,4 +3,5 @@ + \ No newline at end of file diff --git a/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs b/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs index 395e8c1f84..99ebb9fc52 100644 --- a/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs +++ b/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs @@ -7,6 +7,7 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTestAdapter.UnitTests using System; using System.Collections.Generic; + using System.ComponentModel; using System.Linq; using System.Reflection; @@ -66,6 +67,14 @@ public void MSTestDiscovererHasMSTestAdapterAsExecutorUri() Assert.AreEqual("executor://MSTestAdapter/v2", attribute.ExecutorUri); } + [TestMethod] + public void MSTestDiscovererHasCategoryAttribute() + { + var attribute = typeof(MSTestDiscoverer).GetTypeInfo().GetCustomAttribute(typeof(CategoryAttribute)); + Assert.IsNotNull(attribute); + Assert.AreEqual("managed", (attribute as CategoryAttribute).Category); + } + [TestMethod] public void MSTestDiscovererHasXapAsFileExtension() { From 84c0447a414ff0606535e3c2c9ee73aab41c8d75 Mon Sep 17 00:00:00 2001 From: Mayank Bansal Date: Tue, 10 Apr 2018 16:24:27 +0530 Subject: [PATCH 02/25] test log --- .../MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs b/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs index 99ebb9fc52..d321f817b3 100644 --- a/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs +++ b/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs @@ -70,6 +70,7 @@ public void MSTestDiscovererHasMSTestAdapterAsExecutorUri() [TestMethod] public void MSTestDiscovererHasCategoryAttribute() { + Console.WriteLine(typeof(MSTestDiscoverer)); var attribute = typeof(MSTestDiscoverer).GetTypeInfo().GetCustomAttribute(typeof(CategoryAttribute)); Assert.IsNotNull(attribute); Assert.AreEqual("managed", (attribute as CategoryAttribute).Category); From 664f4bb15d9c2a9916cc7a4a2a230ec958709f0a Mon Sep 17 00:00:00 2001 From: Mayank Bansal Date: Tue, 10 Apr 2018 16:53:19 +0530 Subject: [PATCH 03/25] logs --- .../MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs b/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs index d321f817b3..90ae87466d 100644 --- a/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs +++ b/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs @@ -70,7 +70,7 @@ public void MSTestDiscovererHasMSTestAdapterAsExecutorUri() [TestMethod] public void MSTestDiscovererHasCategoryAttribute() { - Console.WriteLine(typeof(MSTestDiscoverer)); + Assert.IsTrue(typeof(MSTestDiscoverer).Assembly.Location.Contains(@"MSTest.CoreAdapter.Unit.Tests\Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.dll")); var attribute = typeof(MSTestDiscoverer).GetTypeInfo().GetCustomAttribute(typeof(CategoryAttribute)); Assert.IsNotNull(attribute); Assert.AreEqual("managed", (attribute as CategoryAttribute).Category); From 386f0e0ac017030c826ccc29d0d2495bae19c800 Mon Sep 17 00:00:00 2001 From: Mayank Bansal Date: Tue, 10 Apr 2018 16:58:39 +0530 Subject: [PATCH 04/25] testfix --- .../MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs b/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs index 90ae87466d..4505a96ef0 100644 --- a/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs +++ b/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs @@ -70,10 +70,9 @@ public void MSTestDiscovererHasMSTestAdapterAsExecutorUri() [TestMethod] public void MSTestDiscovererHasCategoryAttribute() { - Assert.IsTrue(typeof(MSTestDiscoverer).Assembly.Location.Contains(@"MSTest.CoreAdapter.Unit.Tests\Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.dll")); - var attribute = typeof(MSTestDiscoverer).GetTypeInfo().GetCustomAttribute(typeof(CategoryAttribute)); + CategoryAttribute attribute = typeof(MSTestDiscoverer).GetTypeInfo().GetCustomAttributes(typeof(CategoryAttribute)).Cast().First(); Assert.IsNotNull(attribute); - Assert.AreEqual("managed", (attribute as CategoryAttribute).Category); + Assert.AreEqual("managed", attribute.Category); } [TestMethod] From d240eb101f63b932dceb5d560416654780b29627 Mon Sep 17 00:00:00 2001 From: Mayank Bansal Date: Tue, 10 Apr 2018 17:03:50 +0530 Subject: [PATCH 05/25] error --- .../MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs b/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs index 4505a96ef0..dd2d3b9df4 100644 --- a/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs +++ b/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs @@ -70,7 +70,7 @@ public void MSTestDiscovererHasMSTestAdapterAsExecutorUri() [TestMethod] public void MSTestDiscovererHasCategoryAttribute() { - CategoryAttribute attribute = typeof(MSTestDiscoverer).GetTypeInfo().GetCustomAttributes(typeof(CategoryAttribute)).Cast().First(); + CategoryAttribute attribute = typeof(MSTestDiscoverer).GetCustomAttributes(typeof(CategoryAttribute)).Cast().First(); Assert.IsNotNull(attribute); Assert.AreEqual("managed", attribute.Category); } From bfb5683c06d474b768b69c1ebd7f2bf8841e0618 Mon Sep 17 00:00:00 2001 From: Mayank Bansal Date: Tue, 10 Apr 2018 17:08:39 +0530 Subject: [PATCH 06/25] fail uri test --- src/Adapter/MSTest.CoreAdapter/Constants.cs | 2 +- .../MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Adapter/MSTest.CoreAdapter/Constants.cs b/src/Adapter/MSTest.CoreAdapter/Constants.cs index 5f561f1519..e2f544fe07 100644 --- a/src/Adapter/MSTest.CoreAdapter/Constants.cs +++ b/src/Adapter/MSTest.CoreAdapter/Constants.cs @@ -16,7 +16,7 @@ internal static class Constants /// /// Uri of the MSTest executor. /// - internal const string ExecutorUriString = "executor://MSTestAdapter/v2"; + internal const string ExecutorUriString = "executor://MSTestAdapter/v3"; /// /// The name of test run parameters node in the runsettings. diff --git a/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs b/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs index dd2d3b9df4..3e4e6a2cef 100644 --- a/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs +++ b/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs @@ -64,7 +64,7 @@ public void MSTestDiscovererHasMSTestAdapterAsExecutorUri() { DefaultExecutorUriAttribute attribute = typeof(MSTestDiscoverer).GetTypeInfo().GetCustomAttributes(typeof(DefaultExecutorUriAttribute)).Cast().First(); Assert.IsNotNull(attribute); - Assert.AreEqual("executor://MSTestAdapter/v2", attribute.ExecutorUri); + Assert.AreEqual("executor://MSTestAdapter/v3", attribute.ExecutorUri); } [TestMethod] From ed9808acf75fd6d433dab390a616ce96cb99e243 Mon Sep 17 00:00:00 2001 From: Mayank Bansal Date: Tue, 10 Apr 2018 17:13:23 +0530 Subject: [PATCH 07/25] undo uri --- src/Adapter/MSTest.CoreAdapter/Constants.cs | 2 +- .../MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Adapter/MSTest.CoreAdapter/Constants.cs b/src/Adapter/MSTest.CoreAdapter/Constants.cs index e2f544fe07..5f561f1519 100644 --- a/src/Adapter/MSTest.CoreAdapter/Constants.cs +++ b/src/Adapter/MSTest.CoreAdapter/Constants.cs @@ -16,7 +16,7 @@ internal static class Constants /// /// Uri of the MSTest executor. /// - internal const string ExecutorUriString = "executor://MSTestAdapter/v3"; + internal const string ExecutorUriString = "executor://MSTestAdapter/v2"; /// /// The name of test run parameters node in the runsettings. diff --git a/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs b/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs index 3e4e6a2cef..dd2d3b9df4 100644 --- a/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs +++ b/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs @@ -64,7 +64,7 @@ public void MSTestDiscovererHasMSTestAdapterAsExecutorUri() { DefaultExecutorUriAttribute attribute = typeof(MSTestDiscoverer).GetTypeInfo().GetCustomAttributes(typeof(DefaultExecutorUriAttribute)).Cast().First(); Assert.IsNotNull(attribute); - Assert.AreEqual("executor://MSTestAdapter/v3", attribute.ExecutorUri); + Assert.AreEqual("executor://MSTestAdapter/v2", attribute.ExecutorUri); } [TestMethod] From cb6608b64d386bbdb0565eaf85d1942b54b87650 Mon Sep 17 00:00:00 2001 From: Mayank Bansal Date: Tue, 10 Apr 2018 17:25:53 +0530 Subject: [PATCH 08/25] fix --- .../MSTest.CoreAdapter.Unit.Tests.csproj | 3 +++ test/UnitTests/MSTest.CoreAdapter.Unit.Tests/packages.config | 1 + 2 files changed, 4 insertions(+) diff --git a/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTest.CoreAdapter.Unit.Tests.csproj b/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTest.CoreAdapter.Unit.Tests.csproj index 5c7854a9c4..076b5cce5e 100644 --- a/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTest.CoreAdapter.Unit.Tests.csproj +++ b/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTest.CoreAdapter.Unit.Tests.csproj @@ -48,6 +48,9 @@ True + + ..\..\..\packages\System.ComponentModel.Primitives.4.1.0\lib\net45\System.ComponentModel.Primitives.dll + diff --git a/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/packages.config b/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/packages.config index a7492e000b..ed71d4c5c2 100644 --- a/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/packages.config +++ b/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/packages.config @@ -4,4 +4,5 @@ + \ No newline at end of file From bb9d44d8f4a46fa248be5fdd8ea8efb3bc50d452 Mon Sep 17 00:00:00 2001 From: Mayank Bansal Date: Wed, 11 Apr 2018 14:03:45 +0530 Subject: [PATCH 09/25] remove unnecessary changes --- .../MSTest.CoreAdapter.Unit.Tests.csproj | 3 --- test/UnitTests/MSTest.CoreAdapter.Unit.Tests/packages.config | 1 - 2 files changed, 4 deletions(-) diff --git a/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTest.CoreAdapter.Unit.Tests.csproj b/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTest.CoreAdapter.Unit.Tests.csproj index 076b5cce5e..5c7854a9c4 100644 --- a/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTest.CoreAdapter.Unit.Tests.csproj +++ b/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTest.CoreAdapter.Unit.Tests.csproj @@ -48,9 +48,6 @@ True - - ..\..\..\packages\System.ComponentModel.Primitives.4.1.0\lib\net45\System.ComponentModel.Primitives.dll - diff --git a/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/packages.config b/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/packages.config index ed71d4c5c2..a7492e000b 100644 --- a/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/packages.config +++ b/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/packages.config @@ -4,5 +4,4 @@ - \ No newline at end of file From 8fcd3017912830e64321c6bfade5805cce3af274 Mon Sep 17 00:00:00 2001 From: Mayank Bansal Date: Wed, 11 Apr 2018 14:47:57 +0530 Subject: [PATCH 10/25] logs --- .../MSTestDiscovererTests.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs b/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs index dd2d3b9df4..1292adad20 100644 --- a/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs +++ b/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs @@ -70,9 +70,17 @@ public void MSTestDiscovererHasMSTestAdapterAsExecutorUri() [TestMethod] public void MSTestDiscovererHasCategoryAttribute() { + var count = typeof(MSTestDiscoverer).GetTypeInfo().GetCustomAttributes().Count(); + var path2 = typeof(MSTestDiscoverer).GetTypeInfo().Assembly.Location; + var path = typeof(MSTestDiscoverer).Assembly.Location; + + throw new Exception(path + " " + count + " " + path2); + + /* CategoryAttribute attribute = typeof(MSTestDiscoverer).GetCustomAttributes(typeof(CategoryAttribute)).Cast().First(); Assert.IsNotNull(attribute); Assert.AreEqual("managed", attribute.Category); + */ } [TestMethod] From d473ee0932659909c31d663a2b7803d360dab985 Mon Sep 17 00:00:00 2001 From: Mayank Bansal Date: Wed, 11 Apr 2018 15:00:42 +0530 Subject: [PATCH 11/25] possible test fix --- .../MSTestDiscovererTests.cs | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs b/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs index 1292adad20..4fbb23f957 100644 --- a/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs +++ b/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs @@ -70,17 +70,9 @@ public void MSTestDiscovererHasMSTestAdapterAsExecutorUri() [TestMethod] public void MSTestDiscovererHasCategoryAttribute() { - var count = typeof(MSTestDiscoverer).GetTypeInfo().GetCustomAttributes().Count(); - var path2 = typeof(MSTestDiscoverer).GetTypeInfo().Assembly.Location; - var path = typeof(MSTestDiscoverer).Assembly.Location; - - throw new Exception(path + " " + count + " " + path2); - - /* - CategoryAttribute attribute = typeof(MSTestDiscoverer).GetCustomAttributes(typeof(CategoryAttribute)).Cast().First(); + Attribute attribute = typeof(MSTestDiscoverer).GetCustomAttribute(typeof(System.ComponentModel.CategoryAttribute)); Assert.IsNotNull(attribute); - Assert.AreEqual("managed", attribute.Category); - */ + Assert.AreEqual("managed", (attribute as System.ComponentModel.CategoryAttribute)?.Category); } [TestMethod] From 8315a9de5f8897b534d15210d4c58ca393f14b29 Mon Sep 17 00:00:00 2001 From: Mayank Bansal Date: Wed, 11 Apr 2018 18:08:31 +0530 Subject: [PATCH 12/25] log --- .../MSTestDiscovererTests.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs b/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs index 4fbb23f957..465a9b76b4 100644 --- a/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs +++ b/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs @@ -70,9 +70,21 @@ public void MSTestDiscovererHasMSTestAdapterAsExecutorUri() [TestMethod] public void MSTestDiscovererHasCategoryAttribute() { + var attributes = typeof(MSTestDiscoverer).GetCustomAttributes(); + IList data = new List(); + + foreach (var attribute in attributes) + { + data.Add(attribute.ToString()); + } + + throw new Exception(data.ToString()); + + /* Attribute attribute = typeof(MSTestDiscoverer).GetCustomAttribute(typeof(System.ComponentModel.CategoryAttribute)); Assert.IsNotNull(attribute); Assert.AreEqual("managed", (attribute as System.ComponentModel.CategoryAttribute)?.Category); + */ } [TestMethod] From d2f28fc52a83a700274ebb592e94eaf88e99cf0e Mon Sep 17 00:00:00 2001 From: Mayank Bansal Date: Wed, 11 Apr 2018 18:22:17 +0530 Subject: [PATCH 13/25] log --- .../MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs b/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs index 465a9b76b4..ad96d8ed58 100644 --- a/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs +++ b/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs @@ -71,14 +71,14 @@ public void MSTestDiscovererHasMSTestAdapterAsExecutorUri() public void MSTestDiscovererHasCategoryAttribute() { var attributes = typeof(MSTestDiscoverer).GetCustomAttributes(); - IList data = new List(); + string data = null; foreach (var attribute in attributes) { - data.Add(attribute.ToString()); + data += attribute.ToString(); } - throw new Exception(data.ToString()); + throw new Exception(data); /* Attribute attribute = typeof(MSTestDiscoverer).GetCustomAttribute(typeof(System.ComponentModel.CategoryAttribute)); From abf19c204b7749bfb42b4b7c7ed2dce395d0796a Mon Sep 17 00:00:00 2001 From: Mayank Bansal Date: Wed, 11 Apr 2018 18:32:59 +0530 Subject: [PATCH 14/25] try to get attribute data --- .../MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs b/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs index ad96d8ed58..ac7d651d1f 100644 --- a/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs +++ b/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs @@ -75,7 +75,10 @@ public void MSTestDiscovererHasCategoryAttribute() foreach (var attribute in attributes) { - data += attribute.ToString(); + if (attribute is CategoryAttribute) + { + data += attribute + " value: " + (attribute as CategoryAttribute)?.Category; + } } throw new Exception(data); From 8c237c925892a8e8abbb85ef521a4c46ba833b1f Mon Sep 17 00:00:00 2001 From: Mayank Bansal Date: Wed, 11 Apr 2018 18:39:22 +0530 Subject: [PATCH 15/25] last --- .../MSTestDiscovererTests.cs | 23 +++++-------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs b/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs index ac7d651d1f..b7b3d83b5f 100644 --- a/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs +++ b/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs @@ -67,28 +67,17 @@ public void MSTestDiscovererHasMSTestAdapterAsExecutorUri() Assert.AreEqual("executor://MSTestAdapter/v2", attribute.ExecutorUri); } + /* + // Commenting as it is failing in PR, but constantly passing on local, & any NAR machine. Needs to be revisied, or removed. + // https://ci.dot.net/job/Microsoft_testfx/job/master/job/Debug_prtest/342/console [TestMethod] public void MSTestDiscovererHasCategoryAttribute() { - var attributes = typeof(MSTestDiscoverer).GetCustomAttributes(); - string data = null; - - foreach (var attribute in attributes) - { - if (attribute is CategoryAttribute) - { - data += attribute + " value: " + (attribute as CategoryAttribute)?.Category; - } - } - - throw new Exception(data); - - /* - Attribute attribute = typeof(MSTestDiscoverer).GetCustomAttribute(typeof(System.ComponentModel.CategoryAttribute)); + Attribute attribute = typeof(MSTestDiscoverer).GetCustomAttribute(typeof(CategoryAttribute)); Assert.IsNotNull(attribute); - Assert.AreEqual("managed", (attribute as System.ComponentModel.CategoryAttribute)?.Category); - */ + Assert.AreEqual("managed", (attribute as CategoryAttribute)?.Category); } + */ [TestMethod] public void MSTestDiscovererHasXapAsFileExtension() From dd3233f9ff50eac403cebad3498b00770284ed8e Mon Sep 17 00:00:00 2001 From: Mayank Bansal Date: Fri, 13 Apr 2018 12:28:44 +0530 Subject: [PATCH 16/25] move to latest VS(15.6) --- netci.groovy | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/netci.groovy b/netci.groovy index 4c52cb8e5c..cb63541026 100644 --- a/netci.groovy +++ b/netci.groovy @@ -28,7 +28,8 @@ def branch = GithubBranchName } } - Utilities.setMachineAffinity(newJob, 'Windows_NT', 'latest-or-auto-dev15-0') + // Move to latest VS(15.6) machines + Utilities.setMachineAffinity(newJob, 'Windows_NT', 'Windows.10.Amd64.ClientRS3.DevEx.Open') // This call performs remaining common job setup on the newly created job. Utilities.standardJobSetup(newJob, project, isPR, "*/${branch}") From d013771ad5770632ed177099b15978ba4f5f810b Mon Sep 17 00:00:00 2001 From: Mayank Bansal Date: Fri, 13 Apr 2018 13:25:15 +0530 Subject: [PATCH 17/25] log --- test/E2ETests/Automation.CLI/CLITestBase.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/E2ETests/Automation.CLI/CLITestBase.cs b/test/E2ETests/Automation.CLI/CLITestBase.cs index f846b3e69a..29b6e00099 100644 --- a/test/E2ETests/Automation.CLI/CLITestBase.cs +++ b/test/E2ETests/Automation.CLI/CLITestBase.cs @@ -99,6 +99,15 @@ public string GetConsoleRunnerPath() /// List of tests expected to be discovered. public void ValidateDiscoveredTests(params string[] discoveredTestsList) { + string testdata = null; + foreach (var test in this.discoveryEventsHandler.Tests) + { + testdata += test + " "; + } + + throw new Exception(testdata + " " + this.discoveryEventsHandler.Tests.Count()); + + /* foreach (var test in discoveredTestsList) { var flag = this.discoveryEventsHandler.Tests.Contains(test) @@ -108,6 +117,7 @@ public void ValidateDiscoveredTests(params string[] discoveredTestsList) // Make sure only expected number of tests are discovered and not more. Assert.AreEqual(discoveredTestsList.Length, this.discoveryEventsHandler.Tests.Count); + */ } /// From ff220a32fb08dbfc1c828aad2aeb5d4d4d5202da Mon Sep 17 00:00:00 2001 From: Mayank Bansal Date: Fri, 13 Apr 2018 14:07:33 +0530 Subject: [PATCH 18/25] Step for adding archiving trx files --- netci.groovy | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/netci.groovy b/netci.groovy index cb63541026..4c1813a204 100644 --- a/netci.groovy +++ b/netci.groovy @@ -31,9 +31,21 @@ def branch = GithubBranchName // Move to latest VS(15.6) machines Utilities.setMachineAffinity(newJob, 'Windows_NT', 'Windows.10.Amd64.ClientRS3.DevEx.Open') + // Archive trx files for logs + Utilities.addArchival(newJob, '**/TestResults/**/*.trx', '', true, false) + // This call performs remaining common job setup on the newly created job. Utilities.standardJobSetup(newJob, project, isPR, "*/${branch}") + // Specifying save duration for logs + newJob.with { + logRotator { + artifactDaysToKeep(30) + daysToKeep(30) + artifactNumToKeep(200) + numToKeep(200) + } + if (isPR) { Utilities.addGithubPRTriggerForBranch(newJob, branch, "Windows / ${configuration} Build") } From 66654b743517f4ed34f0ad36297ab23029ab28b9 Mon Sep 17 00:00:00 2001 From: Mayank Bansal Date: Fri, 13 Apr 2018 15:45:25 +0530 Subject: [PATCH 19/25] logs --- .../Execution/TestExecutionManagerTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/Execution/TestExecutionManagerTests.cs b/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/Execution/TestExecutionManagerTests.cs index 935c448082..62822d3928 100644 --- a/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/Execution/TestExecutionManagerTests.cs +++ b/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/Execution/TestExecutionManagerTests.cs @@ -506,7 +506,7 @@ public void RunTestsForTestShouldRunTestsWithSpecifiedNumberOfWorkers() allThreadIds.UnionWith(DummyTestClassForParallelize2.ThreadIds); allThreadIds.UnionWith(DummyTestClassForParallelize3.ThreadIds); - Assert.AreEqual(3, allThreadIds.Count); + // Assert.AreEqual(3, allThreadIds.Count); } finally { From c3d31f654b44d49301932d888b1d0e4abc027e9e Mon Sep 17 00:00:00 2001 From: Mayank Bansal Date: Fri, 13 Apr 2018 16:49:26 +0530 Subject: [PATCH 20/25] remove category --- src/Adapter/MSTest.CoreAdapter/MSTestDiscoverer.cs | 1 - test/E2ETests/Automation.CLI/CLITestBase.cs | 10 ---------- 2 files changed, 11 deletions(-) diff --git a/src/Adapter/MSTest.CoreAdapter/MSTestDiscoverer.cs b/src/Adapter/MSTest.CoreAdapter/MSTestDiscoverer.cs index 0919d2c9a5..52280baa48 100644 --- a/src/Adapter/MSTest.CoreAdapter/MSTestDiscoverer.cs +++ b/src/Adapter/MSTest.CoreAdapter/MSTestDiscoverer.cs @@ -21,7 +21,6 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter [FileExtension(".appx")] [FileExtension(".dll")] [FileExtension(".exe")] - [Category("managed")] public class MSTestDiscoverer : ITestDiscoverer { /// diff --git a/test/E2ETests/Automation.CLI/CLITestBase.cs b/test/E2ETests/Automation.CLI/CLITestBase.cs index 29b6e00099..f846b3e69a 100644 --- a/test/E2ETests/Automation.CLI/CLITestBase.cs +++ b/test/E2ETests/Automation.CLI/CLITestBase.cs @@ -99,15 +99,6 @@ public string GetConsoleRunnerPath() /// List of tests expected to be discovered. public void ValidateDiscoveredTests(params string[] discoveredTestsList) { - string testdata = null; - foreach (var test in this.discoveryEventsHandler.Tests) - { - testdata += test + " "; - } - - throw new Exception(testdata + " " + this.discoveryEventsHandler.Tests.Count()); - - /* foreach (var test in discoveredTestsList) { var flag = this.discoveryEventsHandler.Tests.Contains(test) @@ -117,7 +108,6 @@ public void ValidateDiscoveredTests(params string[] discoveredTestsList) // Make sure only expected number of tests are discovered and not more. Assert.AreEqual(discoveredTestsList.Length, this.discoveryEventsHandler.Tests.Count); - */ } /// From 18977ed12b9e8e084b3c9962a8ab840f9ca0205c Mon Sep 17 00:00:00 2001 From: Mayank Bansal Date: Fri, 13 Apr 2018 17:11:17 +0530 Subject: [PATCH 21/25] try --- src/Adapter/MSTest.CoreAdapter/MSTest.CoreAdapter.csproj | 4 ++-- src/Adapter/MSTest.CoreAdapter/MSTestDiscoverer.cs | 1 + src/Adapter/MSTest.CoreAdapter/packages.config | 5 ++++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Adapter/MSTest.CoreAdapter/MSTest.CoreAdapter.csproj b/src/Adapter/MSTest.CoreAdapter/MSTest.CoreAdapter.csproj index 4983d30e55..abd80bee53 100644 --- a/src/Adapter/MSTest.CoreAdapter/MSTest.CoreAdapter.csproj +++ b/src/Adapter/MSTest.CoreAdapter/MSTest.CoreAdapter.csproj @@ -119,8 +119,8 @@ C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETPortable\v4.5\System.Collections.Concurrent.dll - - ..\..\..\packages\System.ComponentModel.Primitives.4.1.0\lib\netstandard1.0\System.ComponentModel.Primitives.dll + + ..\..\..\packages\System.ComponentModel.Primitives.4.3.0\lib\netstandard1.0\System.ComponentModel.Primitives.dll diff --git a/src/Adapter/MSTest.CoreAdapter/MSTestDiscoverer.cs b/src/Adapter/MSTest.CoreAdapter/MSTestDiscoverer.cs index 52280baa48..0919d2c9a5 100644 --- a/src/Adapter/MSTest.CoreAdapter/MSTestDiscoverer.cs +++ b/src/Adapter/MSTest.CoreAdapter/MSTestDiscoverer.cs @@ -21,6 +21,7 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter [FileExtension(".appx")] [FileExtension(".dll")] [FileExtension(".exe")] + [Category("managed")] public class MSTestDiscoverer : ITestDiscoverer { /// diff --git a/src/Adapter/MSTest.CoreAdapter/packages.config b/src/Adapter/MSTest.CoreAdapter/packages.config index 47b10485d0..47f6465e0a 100644 --- a/src/Adapter/MSTest.CoreAdapter/packages.config +++ b/src/Adapter/MSTest.CoreAdapter/packages.config @@ -3,5 +3,8 @@ - + + + + \ No newline at end of file From 17182f12e676b9b62ceb474331a3b3a917a219e0 Mon Sep 17 00:00:00 2001 From: Mayank Bansal Date: Fri, 13 Apr 2018 17:30:22 +0530 Subject: [PATCH 22/25] Category --- src/Adapter/MSTest.CoreAdapter/MSTest.CoreAdapter.csproj | 4 ++-- src/Adapter/MSTest.CoreAdapter/packages.config | 5 +---- .../MSTestDiscovererTests.cs | 8 +------- 3 files changed, 4 insertions(+), 13 deletions(-) diff --git a/src/Adapter/MSTest.CoreAdapter/MSTest.CoreAdapter.csproj b/src/Adapter/MSTest.CoreAdapter/MSTest.CoreAdapter.csproj index abd80bee53..4983d30e55 100644 --- a/src/Adapter/MSTest.CoreAdapter/MSTest.CoreAdapter.csproj +++ b/src/Adapter/MSTest.CoreAdapter/MSTest.CoreAdapter.csproj @@ -119,8 +119,8 @@ C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETPortable\v4.5\System.Collections.Concurrent.dll - - ..\..\..\packages\System.ComponentModel.Primitives.4.3.0\lib\netstandard1.0\System.ComponentModel.Primitives.dll + + ..\..\..\packages\System.ComponentModel.Primitives.4.1.0\lib\netstandard1.0\System.ComponentModel.Primitives.dll diff --git a/src/Adapter/MSTest.CoreAdapter/packages.config b/src/Adapter/MSTest.CoreAdapter/packages.config index 47f6465e0a..47b10485d0 100644 --- a/src/Adapter/MSTest.CoreAdapter/packages.config +++ b/src/Adapter/MSTest.CoreAdapter/packages.config @@ -3,8 +3,5 @@ - - - - + \ No newline at end of file diff --git a/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs b/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs index b7b3d83b5f..22126582ef 100644 --- a/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs +++ b/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs @@ -67,17 +67,11 @@ public void MSTestDiscovererHasMSTestAdapterAsExecutorUri() Assert.AreEqual("executor://MSTestAdapter/v2", attribute.ExecutorUri); } - /* - // Commenting as it is failing in PR, but constantly passing on local, & any NAR machine. Needs to be revisied, or removed. - // https://ci.dot.net/job/Microsoft_testfx/job/master/job/Debug_prtest/342/console [TestMethod] public void MSTestDiscovererHasCategoryAttribute() { - Attribute attribute = typeof(MSTestDiscoverer).GetCustomAttribute(typeof(CategoryAttribute)); - Assert.IsNotNull(attribute); - Assert.AreEqual("managed", (attribute as CategoryAttribute)?.Category); + throw new Exception(typeof(CategoryAttribute).Assembly.Location); } - */ [TestMethod] public void MSTestDiscovererHasXapAsFileExtension() From 8abc9dd90ef6e63b718c7e7e4f0e12aa5fc85c5b Mon Sep 17 00:00:00 2001 From: Mayank Bansal Date: Fri, 20 Apr 2018 16:13:36 +0530 Subject: [PATCH 23/25] remove un-necessary changes --- netci.groovy | 14 +------------- .../Execution/TestExecutionManagerTests.cs | 2 +- .../MSTestDiscovererTests.cs | 4 +++- 3 files changed, 5 insertions(+), 15 deletions(-) diff --git a/netci.groovy b/netci.groovy index 4c1813a204..1e04b0605f 100644 --- a/netci.groovy +++ b/netci.groovy @@ -29,23 +29,11 @@ def branch = GithubBranchName } // Move to latest VS(15.6) machines - Utilities.setMachineAffinity(newJob, 'Windows_NT', 'Windows.10.Amd64.ClientRS3.DevEx.Open') - - // Archive trx files for logs - Utilities.addArchival(newJob, '**/TestResults/**/*.trx', '', true, false) + Utilities.setMachineAffinity(newJob, 'Windows_NT', 'latest-or-auto-dev15-0') // This call performs remaining common job setup on the newly created job. Utilities.standardJobSetup(newJob, project, isPR, "*/${branch}") - // Specifying save duration for logs - newJob.with { - logRotator { - artifactDaysToKeep(30) - daysToKeep(30) - artifactNumToKeep(200) - numToKeep(200) - } - if (isPR) { Utilities.addGithubPRTriggerForBranch(newJob, branch, "Windows / ${configuration} Build") } diff --git a/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/Execution/TestExecutionManagerTests.cs b/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/Execution/TestExecutionManagerTests.cs index 62822d3928..935c448082 100644 --- a/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/Execution/TestExecutionManagerTests.cs +++ b/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/Execution/TestExecutionManagerTests.cs @@ -506,7 +506,7 @@ public void RunTestsForTestShouldRunTestsWithSpecifiedNumberOfWorkers() allThreadIds.UnionWith(DummyTestClassForParallelize2.ThreadIds); allThreadIds.UnionWith(DummyTestClassForParallelize3.ThreadIds); - // Assert.AreEqual(3, allThreadIds.Count); + Assert.AreEqual(3, allThreadIds.Count); } finally { diff --git a/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs b/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs index 22126582ef..99ebb9fc52 100644 --- a/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs +++ b/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs @@ -70,7 +70,9 @@ public void MSTestDiscovererHasMSTestAdapterAsExecutorUri() [TestMethod] public void MSTestDiscovererHasCategoryAttribute() { - throw new Exception(typeof(CategoryAttribute).Assembly.Location); + var attribute = typeof(MSTestDiscoverer).GetTypeInfo().GetCustomAttribute(typeof(CategoryAttribute)); + Assert.IsNotNull(attribute); + Assert.AreEqual("managed", (attribute as CategoryAttribute).Category); } [TestMethod] From eb0696060009a16054dc2a58ee67dc531fe32546 Mon Sep 17 00:00:00 2001 From: Mayank Bansal Date: Fri, 20 Apr 2018 17:08:33 +0530 Subject: [PATCH 24/25] pass --- src/Package/MSTest.TestAdapter.Enu.nuspec | 3 +++ src/Package/MSTest.TestAdapter.nuspec | 5 ++++- .../DataSourceTestProject/DataSourceTestProject.csproj | 4 ++++ .../MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs | 4 ++-- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/Package/MSTest.TestAdapter.Enu.nuspec b/src/Package/MSTest.TestAdapter.Enu.nuspec index 25d97bc984..33fe9da91f 100644 --- a/src/Package/MSTest.TestAdapter.Enu.nuspec +++ b/src/Package/MSTest.TestAdapter.Enu.nuspec @@ -25,6 +25,9 @@ + + + diff --git a/src/Package/MSTest.TestAdapter.nuspec b/src/Package/MSTest.TestAdapter.nuspec index 8ef68ec7f8..fb956f1e25 100644 --- a/src/Package/MSTest.TestAdapter.nuspec +++ b/src/Package/MSTest.TestAdapter.nuspec @@ -24,7 +24,10 @@ - + + + + diff --git a/test/E2ETests/TestAssets/DataSourceTestProject/DataSourceTestProject.csproj b/test/E2ETests/TestAssets/DataSourceTestProject/DataSourceTestProject.csproj index 5b3ec27ed2..b99b64536a 100644 --- a/test/E2ETests/TestAssets/DataSourceTestProject/DataSourceTestProject.csproj +++ b/test/E2ETests/TestAssets/DataSourceTestProject/DataSourceTestProject.csproj @@ -12,6 +12,10 @@ + + + + diff --git a/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs b/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs index 99ebb9fc52..1a1944a2ec 100644 --- a/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs +++ b/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs @@ -67,13 +67,13 @@ public void MSTestDiscovererHasMSTestAdapterAsExecutorUri() Assert.AreEqual("executor://MSTestAdapter/v2", attribute.ExecutorUri); } - [TestMethod] + /*[TestMethod] public void MSTestDiscovererHasCategoryAttribute() { var attribute = typeof(MSTestDiscoverer).GetTypeInfo().GetCustomAttribute(typeof(CategoryAttribute)); Assert.IsNotNull(attribute); Assert.AreEqual("managed", (attribute as CategoryAttribute).Category); - } + }*/ [TestMethod] public void MSTestDiscovererHasXapAsFileExtension() From 616323dfb6cd38f6d28f086f2d2014722e95b508 Mon Sep 17 00:00:00 2001 From: Mayank Bansal Date: Mon, 23 Apr 2018 11:13:09 +0530 Subject: [PATCH 25/25] Add test --- .../MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs b/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs index 1a1944a2ec..99ebb9fc52 100644 --- a/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs +++ b/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/MSTestDiscovererTests.cs @@ -67,13 +67,13 @@ public void MSTestDiscovererHasMSTestAdapterAsExecutorUri() Assert.AreEqual("executor://MSTestAdapter/v2", attribute.ExecutorUri); } - /*[TestMethod] + [TestMethod] public void MSTestDiscovererHasCategoryAttribute() { var attribute = typeof(MSTestDiscoverer).GetTypeInfo().GetCustomAttribute(typeof(CategoryAttribute)); Assert.IsNotNull(attribute); Assert.AreEqual("managed", (attribute as CategoryAttribute).Category); - }*/ + } [TestMethod] public void MSTestDiscovererHasXapAsFileExtension()