diff --git a/eng/Versions.props b/eng/Versions.props index 5c22cc7509..501ca14f98 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -63,38 +63,38 @@ 6.11.0 4.16.1 - 17.4.1 + 17.9.0 - 2.3.0-preview-20220711-02 - 2.3.0-preview-20220711-02 + 3.3.1 + 3.3.1 1.0.3-preview - 2.3.1 - 2.3.1 - 2.3.1 - 3.10.1 - 3.11.0 - 3.8.0 + 2.4.2 + 2.4.5 + 2.4.2 + 3.14.0 + 3.17.0 + 3.16.3 - [2.3.0-preview-20220613-02] - [2.2.10] - [2.2.9] - [2.1.0] - [2.1.0] + [3.3.1] + [3.3.1] + [3.2.2] + [2.2.10] + [2.2.10] [1.4.0] - [17.2.0-preview-20220401-08] - [17.2.0] - [17.1.0] - [16.6.1] + [17.10.0-release-24177-07] + [17.9.0] + [17.8.0] + [17.6.2] [16.11.0] [15.9.2] 5.0.0 diff --git a/global.json b/global.json index c8485217fa..39c3c09285 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "9.0.100-preview.1.24101.2", + "version": "9.0.100-preview.2.24157.14", "rollForward": "minor", "allowPrerelease": false, "architecture": "x64" @@ -29,7 +29,7 @@ }, "xcopy-msbuild": "17.8.5", "vswhere": "2.2.7", - "dotnet": "9.0.100-preview.1.24101.2" + "dotnet": "9.0.100-preview.2.24157.14" }, "msbuild-sdks": { "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.24207.1" diff --git a/playground/MSTest1/MSTest1.csproj b/playground/MSTest1/MSTest1.csproj index a02ed4c683..407633246a 100644 --- a/playground/MSTest1/MSTest1.csproj +++ b/playground/MSTest1/MSTest1.csproj @@ -7,8 +7,8 @@ - - + + diff --git a/playground/MSTest2/MSTest2.csproj b/playground/MSTest2/MSTest2.csproj index a02ed4c683..407633246a 100644 --- a/playground/MSTest2/MSTest2.csproj +++ b/playground/MSTest2/MSTest2.csproj @@ -7,8 +7,8 @@ - - + + diff --git a/playground/TestPlatform.Playground/TestPlatform.Playground.csproj b/playground/TestPlatform.Playground/TestPlatform.Playground.csproj index d385d07dcc..f20a1bd4d8 100644 --- a/playground/TestPlatform.Playground/TestPlatform.Playground.csproj +++ b/playground/TestPlatform.Playground/TestPlatform.Playground.csproj @@ -12,8 +12,8 @@ - - + + diff --git a/src/Microsoft.TestPlatform.CoreUtilities/GlobalSuppressions.cs b/src/Microsoft.TestPlatform.CoreUtilities/GlobalSuppressions.cs new file mode 100644 index 0000000000..6b8e9ab2b7 --- /dev/null +++ b/src/Microsoft.TestPlatform.CoreUtilities/GlobalSuppressions.cs @@ -0,0 +1,8 @@ +// This file is used by Code Analysis to maintain SuppressMessage +// attributes that are applied to this project. +// Project-level suppressions either have no target or are given +// a specific target and scoped to a namespace, type, member, etc. + +using System.Diagnostics.CodeAnalysis; + +[assembly: SuppressMessage("Reliability", "CA2022:Avoid inexact read with 'Stream.Read'", Justification = "", Scope = "member", Target = "~M:Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Helpers.DotnetHostHelper.GetMuxerArchitectureByMachoOnMac(System.String)~System.Nullable{Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformArchitecture}")] diff --git a/src/vstest.console/TestPlatformHelpers/TestRequestManager.cs b/src/vstest.console/TestPlatformHelpers/TestRequestManager.cs index 4faf151b05..86e0727553 100644 --- a/src/vstest.console/TestPlatformHelpers/TestRequestManager.cs +++ b/src/vstest.console/TestPlatformHelpers/TestRequestManager.cs @@ -1567,6 +1567,36 @@ internal static class KnownPlatformSourceFilter "Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll", "Microsoft.VisualStudio.TestPlatform.TestFramework.dll", "Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", + + // Testing platform + "Microsoft.Testing.Extensions.CodeCoverage.dll", + "Microsoft.Testing.Extensions.CodeCoverage.resources.dll", + "Microsoft.Testing.Extensions.CrashDump.dll", + "Microsoft.Testing.Extensions.CrashDump.resources.dll", + "Microsoft.Testing.Extensions.Experimental.dll", + "Microsoft.Testing.Extensions.HangDump.dll", + "Microsoft.Testing.Extensions.HangDump.resources.dll", + "Microsoft.Testing.Extensions.HotReload.dll", + "Microsoft.Testing.Extensions.HotReload.resources.dll", + "Microsoft.Testing.Extensions.Retry.dll", + "Microsoft.Testing.Extensions.Retry.resources.dll", + "Microsoft.Testing.Extensions.Telemetry.dll", + "Microsoft.Testing.Extensions.Telemetry.resources.dll", + "Microsoft.Testing.Extensions.TrxReport.Abstractions.dll", + "Microsoft.Testing.Extensions.TrxReport.dll", + "Microsoft.Testing.Extensions.TrxReport.resources.dll", + "Microsoft.Testing.Extensions.VSTestBridge.dll", + "Microsoft.Testing.Extensions.VSTestBridge.resources.dll", + "Microsoft.Testing.Internal.Framework.dll", + "Microsoft.Testing.Internal.Framework.SourceGeneration.dll", + "Microsoft.Testing.Internal.VersionSourceGeneration.dll", + "Microsoft.Testing.Platform.dll", + "Microsoft.Testing.Platform.Extensions.dll", + "Microsoft.Testing.Platform.Extensions.VSTestBridge.dll", + "Microsoft.Testing.Platform.MSBuild.dll", + "Microsoft.Testing.Platform.MSBuild.resources.dll", + "Microsoft.Testing.Platform.resources.dll", + // For MSTest up to v3 "Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.dll", "Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.resources.dll", diff --git a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/BlameDataCollectorTests.cs b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/BlameDataCollectorTests.cs index 40636532b9..cdcb645d46 100644 --- a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/BlameDataCollectorTests.cs +++ b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/BlameDataCollectorTests.cs @@ -25,7 +25,7 @@ namespace Microsoft.TestPlatform.AcceptanceTests; public class BlameDataCollectorTests : AcceptanceTestBase { public const string NETCOREANDFX = "net462;net472;netcoreapp3.1"; - public const string NET50 = "net5.0"; + public const string NET60 = "net6.0"; private readonly string _procDumpPath; public BlameDataCollectorTests() @@ -130,9 +130,9 @@ public void BlameDataCollectorShouldOutputDumpFileWhenNoCrashOccursButCollectAlw } [TestMethod] - [NetCoreRunner("net462;net472;netcoreapp3.1;net5.0")] + [NetCoreRunner("net462;net472;netcoreapp3.1;net6.0")] // should make no difference, keeping for easy debug - // [NetFrameworkRunner("net462;net472;netcoreapp3.1;net5.0")] + // [NetFrameworkRunner("net462;net472;netcoreapp3.1;net6.0")] public void HangDumpOnTimeout(RunnerInfo runnerInfo) { SetTestEnvironment(_testEnvironment, runnerInfo); @@ -152,7 +152,7 @@ public void HangDumpOnTimeout(RunnerInfo runnerInfo) } [TestMethod] - // net5.0 does not support dump on exit + // net6.0 does not support dump on exit [NetCoreRunner("net462;net472;netcoreapp3.1")] // should make no difference, keeping for easy debug // [NetFrameworkRunner("net462;net472;netcoreapp3.1")] @@ -176,7 +176,7 @@ public void CrashDumpWhenThereIsNoTimeout(RunnerInfo runnerInfo) } [TestMethod] - // net5.0 does not support dump on exit + // net6.0 does not support dump on exit [NetCoreRunner("net462;net472;netcoreapp3.1")] // should make no difference, keeping for easy debug // [NetFrameworkRunner("net462;net472;netcoreapp3.1")] @@ -200,9 +200,9 @@ public void CrashDumpOnExit(RunnerInfo runnerInfo) } [TestMethod] - [NetCoreRunner("net462;net472;netcoreapp3.1;net5.0")] + [NetCoreRunner("net462;net472;netcoreapp3.1;net6.0")] // should make no difference, keeping for easy debug - // [NetFrameworkRunner("net462;net472;netcoreapp3.1;net5.0")] + // [NetFrameworkRunner("net462;net472;netcoreapp3.1;net6.0")] public void CrashDumpOnStackOverflow(RunnerInfo runnerInfo) { SetTestEnvironment(_testEnvironment, runnerInfo); @@ -222,7 +222,7 @@ public void CrashDumpOnStackOverflow(RunnerInfo runnerInfo) } [TestMethod] - [NetCoreRunner(NET50)] + [NetCoreRunner(NET60)] // should make no difference, keeping for easy debug // [NetFrameworkRunner(NET50)] public void CrashDumpChildProcesses(RunnerInfo runnerInfo) @@ -238,9 +238,9 @@ public void CrashDumpChildProcesses(RunnerInfo runnerInfo) } [TestMethod] - [NetCoreRunner("net462;net472;netcoreapp3.1;net5.0")] + [NetCoreRunner("net462;net472;netcoreapp3.1;net6.0")] // should make no difference, keeping for easy debug - // [NetFrameworkRunner("net462;net472;netcoreapp3.1;net5.0")] + // [NetFrameworkRunner("net462;net472;netcoreapp3.1;net6.0")] public void HangDumpChildProcesses(RunnerInfo runnerInfo) { SetTestEnvironment(_testEnvironment, runnerInfo); diff --git a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/DeprecateExtensionsPathWarningTests.cs b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/DeprecateExtensionsPathWarningTests.cs index 2d3b34d298..7f0ca13acc 100644 --- a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/DeprecateExtensionsPathWarningTests.cs +++ b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/DeprecateExtensionsPathWarningTests.cs @@ -53,15 +53,6 @@ public DeprecateExtensionsPathWarningTests() } } - [TestMethod] - public void VerifyDeprecatedWarningIsThrownWhenAdaptersPickedFromExtensionDirectory() - { - var arguments = PrepareArguments(GetSampleTestAssembly(), null, null, FrameworkArgValue, resultsDirectory: TempDirectory.Path); - - InvokeVsTest(arguments); - StdOutputContains("Adapter lookup is being changed, please follow"); - } - public override string GetConsoleRunnerPath() { return Path.Combine(IntegrationTestEnvironment.PublishDirectory, $"Microsoft.TestPlatform.{IntegrationTestEnvironment.LatestLocallyBuiltNugetVersion}.nupkg", "tools", diff --git a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/DotnetTestMSBuildOutputTests.cs b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/DotnetTestMSBuildOutputTests.cs index 5de5f389d3..089bdc74a8 100644 --- a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/DotnetTestMSBuildOutputTests.cs +++ b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/DotnetTestMSBuildOutputTests.cs @@ -34,7 +34,7 @@ public void MSBuildLoggerCanBeEnabledByBuildPropertyAndDoesNotEatSpecialChars(Ru // C:\Users\nohwnd\AppData\Local\Temp\vstest\xvoVt\UnitTest1.cs(41): error VSTEST1: (FailingTest) SampleUnitTestProject.UnitTest1.FailingTest() Assert.AreEqual failed. Expected:<2>. Actual:<3>. [C:\Users\nohwnd\AppData\Local\Temp\vstest\xvoVt\SimpleTestProject.csproj::TargetFramework=netcoreapp3.1] StdOutputContains("error VSTEST1: FailingTest ("); - StdOutputContains("): Error Message: Assert.AreEqual failed. Expected:<ğğğ𦮙我們剛才從𓋴𓅓𓏏𓇏𓇌𓀀 (System.String)>. Actual:<3 (System.Int32)>."); + StdOutputContains("): Error Message: Assert.AreEqual failed. Expected:<ğğğ𦮙我們剛才從𓋴𓅓𓏏𓇏𓇌𓀀>. Actual:."); StdOutputContains("at TerminalLoggerUnitTests.UnitTest1.FailingTest() in"); // We are sending those as low prio messages, they won't show up on screen but will be in binlog. //StdOutputContains("passed PassingTest"); diff --git a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/ExecutionTests.cs b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/ExecutionTests.cs index 8def3a6c66..1678f6a13e 100644 --- a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/ExecutionTests.cs +++ b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/ExecutionTests.cs @@ -160,21 +160,6 @@ public void TestSessionTimeOutTests(RunnerInfo runnerInfo) StdOutputDoesNotContains("Total tests: 6"); } - [TestMethod] - [NetCoreTargetFrameworkDataSource] - public void TestPlatformShouldBeCompatibleWithOldTestHost(RunnerInfo runnerInfo) - { - SetTestEnvironment(_testEnvironment, runnerInfo); - - var assemblyPaths = GetAssetFullPath("SampleProjectWithOldTestHost.dll"); - var arguments = PrepareArguments(assemblyPaths, GetTestAdapterPath(), string.Empty, FrameworkArgValue, runnerInfo.InIsolationValue, resultsDirectory: TempDirectory.Path); - - InvokeVsTest(arguments); - - ValidateSummaryStatus(1, 0, 0); - ExitCodeEquals(0); - } - [TestMethod] [NetFullTargetFrameworkDataSource(inIsolation: true, inProcess: true)] [NetCoreTargetFrameworkDataSource] @@ -509,8 +494,8 @@ public void RunTestsWhenProvidingJustPlatformDllsFailsTheRun(RunnerInfo runnerIn // or deps.json, and fails the run. SetTestEnvironment(_testEnvironment, runnerInfo); - var xunitAssemblyPath = _testEnvironment.GetTestAsset("SimpleTestProject.dll"); - var allDllsMatchingTestPattern = Directory.GetFiles(Path.GetDirectoryName(xunitAssemblyPath)!, "*test*.dll").Where(f => !f.EndsWith("SimpleTestProject.dll")); + var testAssemblyPath = _testEnvironment.GetTestAsset("SimpleTestProject.dll"); + var allDllsMatchingTestPattern = Directory.GetFiles(Path.GetDirectoryName(testAssemblyPath)!, "*test*.dll").Where(f => !f.EndsWith("SimpleTestProject.dll")); string assemblyPaths = string.Join(" ", allDllsMatchingTestPattern.Select(s => s.AddDoubleQuote())); InvokeVsTestForExecution(assemblyPaths, testAdapterPath: string.Empty, FrameworkArgValue, string.Empty); diff --git a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Extension/NetCoreRunnerAttribute.cs b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Extension/NetCoreRunnerAttribute.cs index 977ae98fbc..478c595d3d 100644 --- a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Extension/NetCoreRunnerAttribute.cs +++ b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Extension/NetCoreRunnerAttribute.cs @@ -65,8 +65,8 @@ public IEnumerable GetData(MethodInfo methodInfo) return dataRows; } - public string GetDisplayName(MethodInfo methodInfo, object[] data) + public string GetDisplayName(MethodInfo methodInfo, object?[]? data) { - return string.Format(CultureInfo.CurrentCulture, "{0} ({1})", methodInfo.Name, string.Join(",", data)); + return string.Format(CultureInfo.CurrentCulture, "{0} ({1})", methodInfo.Name, string.Join(",", data ?? Array.Empty())); } } diff --git a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Extension/NetCoreTargetFrameworkDataSourceAttribute.cs b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Extension/NetCoreTargetFrameworkDataSourceAttribute.cs index eec13fe74c..5cc808dd7f 100644 --- a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Extension/NetCoreTargetFrameworkDataSourceAttribute.cs +++ b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Extension/NetCoreTargetFrameworkDataSourceAttribute.cs @@ -81,8 +81,8 @@ public IEnumerable GetData(MethodInfo methodInfo) return dataRows; } - public string GetDisplayName(MethodInfo methodInfo, object[] data) + public string GetDisplayName(MethodInfo methodInfo, object?[]? data) { - return string.Format(CultureInfo.CurrentCulture, "{0} ({1})", methodInfo.Name, string.Join(",", data)); + return string.Format(CultureInfo.CurrentCulture, "{0} ({1})", methodInfo.Name, string.Join(",", data ?? Array.Empty())); } } diff --git a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Extension/NetFrameworkRunnerAttribute.cs b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Extension/NetFrameworkRunnerAttribute.cs index 4d8b56c92e..3ade381b25 100644 --- a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Extension/NetFrameworkRunnerAttribute.cs +++ b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Extension/NetFrameworkRunnerAttribute.cs @@ -68,8 +68,8 @@ public IEnumerable GetData(MethodInfo methodInfo) return dataRows; } - public string GetDisplayName(MethodInfo methodInfo, object[] data) + public string GetDisplayName(MethodInfo methodInfo, object?[]? data) { - return string.Format(CultureInfo.CurrentCulture, "{0} ({1})", methodInfo.Name, string.Join(",", data)); + return string.Format(CultureInfo.CurrentCulture, "{0} ({1})", methodInfo.Name, string.Join(",", data ?? Array.Empty())); } } diff --git a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Extension/NetFullTargetFrameworkDataSourceAttribute.cs b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Extension/NetFullTargetFrameworkDataSourceAttribute.cs index 0179019a1f..c38cdde9cf 100644 --- a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Extension/NetFullTargetFrameworkDataSourceAttribute.cs +++ b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Extension/NetFullTargetFrameworkDataSourceAttribute.cs @@ -110,8 +110,8 @@ public IEnumerable GetData(MethodInfo methodInfo) return dataRows; } - public string GetDisplayName(MethodInfo methodInfo, object[] data) + public string GetDisplayName(MethodInfo methodInfo, object?[]? data) { - return string.Format(CultureInfo.CurrentCulture, "{0} ({1})", methodInfo.Name, string.Join(",", data)); + return string.Format(CultureInfo.CurrentCulture, "{0} ({1})", methodInfo.Name, string.Join(",", data ?? Array.Empty())); } } diff --git a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Extension/TestDataSourceAttribute.cs b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Extension/TestDataSourceAttribute.cs index 6f7a6adae2..8b334fcb4f 100644 --- a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Extension/TestDataSourceAttribute.cs +++ b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Extension/TestDataSourceAttribute.cs @@ -32,9 +32,9 @@ IEnumerable ITestDataSource.GetData(MethodInfo methodInfo) return _data; } - string ITestDataSource.GetDisplayName(MethodInfo methodInfo, object[] data) + string ITestDataSource.GetDisplayName(MethodInfo methodInfo, object?[]? data) { - return GetDisplayName(methodInfo, (T1)data[0]); + return GetDisplayName(methodInfo, (T1)data![0]!); } } @@ -63,9 +63,9 @@ IEnumerable ITestDataSource.GetData(MethodInfo methodInfo) return _data; } - string ITestDataSource.GetDisplayName(MethodInfo methodInfo, object[] data) + string ITestDataSource.GetDisplayName(MethodInfo methodInfo, object?[]? data) { - return GetDisplayName(methodInfo, (T1)data[0], (T2)data[1]); + return GetDisplayName(methodInfo, (T1)data![0]!, (T2)data![1]!); } } @@ -95,9 +95,9 @@ IEnumerable ITestDataSource.GetData(MethodInfo methodInfo) return _data; } - string ITestDataSource.GetDisplayName(MethodInfo methodInfo, object[] data) + string ITestDataSource.GetDisplayName(MethodInfo methodInfo, object?[]? data) { - return GetDisplayName(methodInfo, (T1)data[0], (T2)data[1], (T3)data[2]); + return GetDisplayName(methodInfo, (T1)data![0]!, (T2)data![1]!, (T3)data![2]!); } } @@ -128,8 +128,8 @@ IEnumerable ITestDataSource.GetData(MethodInfo methodInfo) return _data; } - string ITestDataSource.GetDisplayName(MethodInfo methodInfo, object[] data) + string ITestDataSource.GetDisplayName(MethodInfo methodInfo, object?[]? data) { - return GetDisplayName(methodInfo, (T1)data[0], (T2)data[1], (T3)data[2], (T4)data[3]); + return GetDisplayName(methodInfo, (T1)data![0]!, (T2)data![1]!, (T3)data![2]!, (T4)data![3]!); } } diff --git a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Microsoft.TestPlatform.Acceptance.IntegrationTests.csproj b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Microsoft.TestPlatform.Acceptance.IntegrationTests.csproj index 670689714f..0780c80452 100644 --- a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Microsoft.TestPlatform.Acceptance.IntegrationTests.csproj +++ b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Microsoft.TestPlatform.Acceptance.IntegrationTests.csproj @@ -31,7 +31,6 @@ - diff --git a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Performance/TranslationLayer/TelemetryPerfTestBase.cs b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Performance/TranslationLayer/TelemetryPerfTestBase.cs index 7080d40fec..d1a72e3716 100644 --- a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Performance/TranslationLayer/TelemetryPerfTestBase.cs +++ b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Performance/TranslationLayer/TelemetryPerfTestBase.cs @@ -24,7 +24,9 @@ public class TelemetryPerfTestBase : PerformanceTestBase public TelemetryPerfTestBase() { var telemetryConfiguration = TelemetryConfiguration.CreateDefault(); +#pragma warning disable CS0618 // Type or member is obsolete telemetryConfiguration.InstrumentationKey = TelemetryInstrumentationKey; +#pragma warning restore CS0618 // Type or member is obsolete _client = new TelemetryClient(telemetryConfiguration); } diff --git a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/RecursiveResourcesLookupTests.cs b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/RecursiveResourcesLookupTests.cs index db9d8fb31a..f18852d87f 100644 --- a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/RecursiveResourcesLookupTests.cs +++ b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/RecursiveResourcesLookupTests.cs @@ -10,8 +10,9 @@ namespace Microsoft.TestPlatform.AcceptanceTests; public class RecursiveResourcesLookupTests : AcceptanceTestBase { [TestMethod] - // This only fails on .NET Framework, and it fails in teshtost, so no need to double check with + // This only fails on .NET Framework, and it fails in testhost, so no need to double check with // two different runners. + [Ignore("Temporarily ignore until solving https://github.com/microsoft/testfx/issues/2692")] [NetFullTargetFrameworkDataSource(useCoreRunner: false)] public void RunsToCompletionWhenJapaneseResourcesAreLookedUpForMSCorLib(RunnerInfo runnerInfo) { diff --git a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/TestPlatformNugetPackageTests.cs b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/TestPlatformNugetPackageTests.cs index 7297722bad..5f55b852eb 100644 --- a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/TestPlatformNugetPackageTests.cs +++ b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/TestPlatformNugetPackageTests.cs @@ -20,12 +20,6 @@ public static void ClassInit(TestContext _) s_nugetPackageFolder = Path.Combine(IntegrationTestEnvironment.PublishDirectory, $"Microsoft.TestPlatform.{IntegrationTestEnvironment.LatestLocallyBuiltNugetVersion}.nupkg"); } - [ClassCleanup] - public static void ClassCleanup() - { - Directory.Delete(s_nugetPackageFolder, true); - } - [TestMethod] [TestCategory("Windows-Review")] [NetFullTargetFrameworkDataSourceAttribute(useCoreRunner: false)] diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/AttachmentsProcessing/DataCollectorAttachmentProcessorAppDomainTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/AttachmentsProcessing/DataCollectorAttachmentProcessorAppDomainTests.cs index eeef74233d..ca3ebea968 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/AttachmentsProcessing/DataCollectorAttachmentProcessorAppDomainTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/AttachmentsProcessing/DataCollectorAttachmentProcessorAppDomainTests.cs @@ -87,17 +87,18 @@ public async Task DataCollectorAttachmentProcessorAppDomain_ShouldReturnCorrectA Assert.IsTrue(dcap.LoadSucceded); var attachmentsResult = await dcap.ProcessAttachmentSetsAsync(doc.DocumentElement, attachments, new Progress(), _loggerMock.Object, CancellationToken.None); + var firstAttachmentSet = attachmentsResult.First(); // assert // We return same instance but we're marshaling so we expected different pointers - Assert.AreNotSame(attachmentSet, attachmentsResult); + Assert.AreNotSame(attachmentSet, firstAttachmentSet); - Assert.AreEqual(attachmentSet.DisplayName, attachmentsResult.First().DisplayName); - Assert.AreEqual(attachmentSet.Uri, attachmentsResult.First().Uri); + Assert.AreEqual(attachmentSet.DisplayName, firstAttachmentSet.DisplayName); + Assert.AreEqual(attachmentSet.Uri, firstAttachmentSet.Uri); Assert.AreEqual(attachmentSet.Attachments.Count, attachmentsResult.Count); - Assert.AreEqual(attachmentSet.Attachments[0].Description, attachmentsResult.First().Attachments[0].Description); - Assert.AreEqual(attachmentSet.Attachments[0].Uri, attachmentsResult.First().Attachments[0].Uri); - Assert.AreEqual(attachmentSet.Attachments[0].Uri, attachmentsResult.First().Attachments[0].Uri); + Assert.AreEqual(attachmentSet.Attachments[0].Description, firstAttachmentSet.Attachments[0].Description); + Assert.AreEqual(attachmentSet.Attachments[0].Uri, firstAttachmentSet.Attachments[0].Uri); + Assert.AreEqual(attachmentSet.Attachments[0].Uri, firstAttachmentSet.Attachments[0].Uri); } [TestMethod] diff --git a/test/Microsoft.TestPlatform.TestUtilities/IntegrationTestBase.cs b/test/Microsoft.TestPlatform.TestUtilities/IntegrationTestBase.cs index f8f546ce83..0fe2212be4 100644 --- a/test/Microsoft.TestPlatform.TestUtilities/IntegrationTestBase.cs +++ b/test/Microsoft.TestPlatform.TestUtilities/IntegrationTestBase.cs @@ -45,9 +45,10 @@ public class IntegrationTestBase protected readonly IntegrationTestEnvironment _testEnvironment; - private readonly string _testAdapterRelativePath = @"mstest.testadapter\{0}\build\_common".Replace('\\', Path.DirectorySeparatorChar); + private readonly string _msTestPre3_0AdapterRelativePath = @"mstest.testadapter\{0}\build\_common".Replace('\\', Path.DirectorySeparatorChar); + private readonly string _msTestAdapterRelativePath = @"mstest.testadapter\{0}\build\{1}".Replace('\\', Path.DirectorySeparatorChar); private readonly string _nUnitTestAdapterRelativePath = @"nunit3testadapter\{0}\build".Replace('\\', Path.DirectorySeparatorChar); - private readonly string _xUnitTestAdapterRelativePath = @"xunit.runner.visualstudio\{0}\build\_common".Replace('\\', Path.DirectorySeparatorChar); + private readonly string _xUnitTestAdapterRelativePath = @"xunit.runner.visualstudio\{0}\build\{1}".Replace('\\', Path.DirectorySeparatorChar); public enum UnitTestFramework { @@ -594,7 +595,16 @@ protected string GetTestAdapterPath(UnitTestFramework testFramework = UnitTestFr if (testFramework == UnitTestFramework.MSTest) { - adapterRelativePath = string.Format(CultureInfo.InvariantCulture, _testAdapterRelativePath, IntegrationTestEnvironment.DependencyVersions["MSTestTestAdapterVersion"]); + var version = IntegrationTestEnvironment.DependencyVersions["MSTestTestAdapterVersion"]; + if (version.StartsWith("3")) + { + var tfm = _testEnvironment.TargetFramework.StartsWith("net4") ? "net462" : _testEnvironment.TargetFramework; + adapterRelativePath = string.Format(CultureInfo.InvariantCulture, _msTestAdapterRelativePath, version, tfm); + } + else + { + adapterRelativePath = string.Format(CultureInfo.InvariantCulture, _msTestPre3_0AdapterRelativePath, version); + } } else if (testFramework == UnitTestFramework.NUnit) { @@ -602,7 +612,8 @@ protected string GetTestAdapterPath(UnitTestFramework testFramework = UnitTestFr } else if (testFramework == UnitTestFramework.XUnit) { - adapterRelativePath = string.Format(CultureInfo.InvariantCulture, _xUnitTestAdapterRelativePath, IntegrationTestEnvironment.DependencyVersions["XUnitAdapterVersion"]); + var tfm = _testEnvironment.TargetFramework.StartsWith("net4") ? "net462" : "netcoreapp3.1"; + adapterRelativePath = string.Format(CultureInfo.InvariantCulture, _xUnitTestAdapterRelativePath, IntegrationTestEnvironment.DependencyVersions["XUnitAdapterVersion"], tfm); } return _testEnvironment.GetNugetPackage(adapterRelativePath); diff --git a/test/Microsoft.TestPlatform.Utilities.UnitTests/CodeCoverageDataAttachmentsHandlerTests.cs b/test/Microsoft.TestPlatform.Utilities.UnitTests/CodeCoverageDataAttachmentsHandlerTests.cs index b6626f081b..0761e61d69 100644 --- a/test/Microsoft.TestPlatform.Utilities.UnitTests/CodeCoverageDataAttachmentsHandlerTests.cs +++ b/test/Microsoft.TestPlatform.Utilities.UnitTests/CodeCoverageDataAttachmentsHandlerTests.cs @@ -33,7 +33,7 @@ public class CodeCoverageDataAttachmentsHandlerTests public TestContext? TestContext { get; set; } - internal string TestFilesDirectory => Path.Combine(TestContext!.DeploymentDirectory, "TestFiles"); + internal string TestFilesDirectory => Path.Combine(TestContext!.DeploymentDirectory!, "TestFiles"); public CodeCoverageDataAttachmentsHandlerTests() { @@ -50,19 +50,17 @@ public CodeCoverageDataAttachmentsHandlerTests() #endif } -#if NETFRAMEWORK [ClassInitialize] public static void ClassInitialize(TestContext context) { // Copying test files to correct place, var assemblyPath = AppDomain.CurrentDomain.BaseDirectory; - var testFilesDirectory = Path.Combine(context.DeploymentDirectory, "TestFiles"); + var testFilesDirectory = Path.Combine(context.DeploymentDirectory!, "TestFiles"); Directory.CreateDirectory(testFilesDirectory); var files = Directory.GetFiles(Path.Combine(assemblyPath, "TestFiles")); foreach (var file in files) File.Copy(file, Path.Combine(testFilesDirectory, Path.GetFileName(file))); } -#endif [TestMethod] public async Task HandleDataCollectionAttachmentSetsShouldReturnEmptySetWhenNoAttachmentsOrAttachmentsAreNull() diff --git a/test/TestAssets/SampleProjectWithOldTestHost/SampleProjectWithOldTestHost.csproj b/test/TestAssets/SampleProjectWithOldTestHost/SampleProjectWithOldTestHost.csproj deleted file mode 100644 index b336cc2e65..0000000000 --- a/test/TestAssets/SampleProjectWithOldTestHost/SampleProjectWithOldTestHost.csproj +++ /dev/null @@ -1,20 +0,0 @@ - - - - $(NetCoreAppMinimum) - true - false - - - - - - - - - - - - - - diff --git a/test/TestAssets/SampleProjectWithOldTestHost/UnitTest1.cs b/test/TestAssets/SampleProjectWithOldTestHost/UnitTest1.cs deleted file mode 100644 index 873d2d5853..0000000000 --- a/test/TestAssets/SampleProjectWithOldTestHost/UnitTest1.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -using Microsoft.VisualStudio.TestTools.UnitTesting; - -namespace SampleProjectWithOldTestHost -{ - [TestClass] - public class UnitTest1 - { - [TestMethod] - public void TestMethod1() - { - } - } -} diff --git a/test/TestAssets/SimpleTestProject3/SimpleTestProject3.csproj b/test/TestAssets/SimpleTestProject3/SimpleTestProject3.csproj index 35504c2fc9..9d5a70e0fa 100644 --- a/test/TestAssets/SimpleTestProject3/SimpleTestProject3.csproj +++ b/test/TestAssets/SimpleTestProject3/SimpleTestProject3.csproj @@ -17,7 +17,7 @@ - + diff --git a/test/TestAssets/TerminalLoggerTestProject/UnitTest1.cs b/test/TestAssets/TerminalLoggerTestProject/UnitTest1.cs index b86daea74d..1d4b51287a 100644 --- a/test/TestAssets/TerminalLoggerTestProject/UnitTest1.cs +++ b/test/TestAssets/TerminalLoggerTestProject/UnitTest1.cs @@ -31,7 +31,7 @@ public void PassingTest() public void FailingTest() { // test characters taken from https://pages.ucsd.edu/~dkjordan/chin/unitestuni.html - Assert.AreEqual("ğğğ𦮙我們剛才從𓋴𓅓𓏏𓇏𓇌𓀀", 3); + Assert.AreEqual("ğğğ𦮙我們剛才從𓋴𓅓𓏏𓇏𓇌𓀀", "not the same"); } /// diff --git a/test/TestAssets/TestAssets.sln b/test/TestAssets/TestAssets.sln index c1bd7b4786..ac0dfefb2a 100644 --- a/test/TestAssets/TestAssets.sln +++ b/test/TestAssets/TestAssets.sln @@ -62,8 +62,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DiscoveryTestProject", "Dis EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventLogUnitTestProject", "EventLogUnitTestProject\EventLogUnitTestProject.csproj", "{40DA6965-C3C3-46BC-BA56-6D457C097F3C}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SampleProjectWithOldTestHost", "SampleProjectWithOldTestHost\SampleProjectWithOldTestHost.csproj", "{D7869421-F18B-4BEF-AECD-71485136808C}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SimpleClassLibrary", "SimpleClassLibrary\SimpleClassLibrary.csproj", "{F37144D7-2C6D-42AF-9E85-EF10E5244A7B}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SelfContainedAppTestProject", "SelfContainedAppTestProject\SelfContainedAppTestProject.csproj", "{7F85E9D0-7BCE-431D-B468-4F6104E52DFA}" @@ -250,10 +248,6 @@ Global {40DA6965-C3C3-46BC-BA56-6D457C097F3C}.Debug|Any CPU.Build.0 = Debug|Any CPU {40DA6965-C3C3-46BC-BA56-6D457C097F3C}.Release|Any CPU.ActiveCfg = Release|Any CPU {40DA6965-C3C3-46BC-BA56-6D457C097F3C}.Release|Any CPU.Build.0 = Release|Any CPU - {D7869421-F18B-4BEF-AECD-71485136808C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D7869421-F18B-4BEF-AECD-71485136808C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D7869421-F18B-4BEF-AECD-71485136808C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D7869421-F18B-4BEF-AECD-71485136808C}.Release|Any CPU.Build.0 = Release|Any CPU {F37144D7-2C6D-42AF-9E85-EF10E5244A7B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {F37144D7-2C6D-42AF-9E85-EF10E5244A7B}.Debug|Any CPU.Build.0 = Debug|Any CPU {F37144D7-2C6D-42AF-9E85-EF10E5244A7B}.Release|Any CPU.ActiveCfg = Release|Any CPU