From 8fed7bcbebcdfa42d03fd89e00fd480f8f6fdc77 Mon Sep 17 00:00:00 2001 From: Youssef1313 Date: Thu, 19 Mar 2026 13:25:13 +0100 Subject: [PATCH 1/5] Use global NuGet cache in acceptance integration tests --- .../AbortionTests.cs | 2 +- .../AnalyzersTests.cs | 6 +----- .../AppDomainTests.cs | 6 +++--- .../AspireSdkTests.cs | 3 +-- .../AssemblyCleanupTests.cs | 2 +- .../AssemblyResolutionTests.cs | 2 +- .../AssemblyResolverTests.cs | 2 +- .../CancellationTests.cs | 2 +- .../ConfigurationMSTestSettingsTests.cs | 4 ++-- .../ConfigurationMSTestV2SettingsTests.cs | 4 ++-- .../ConfigurationSettingsTests.cs | 2 +- .../CustomAttributesTests.cs | 4 ++-- .../DataSourceTests.cs | 1 - .../DeadlockTests.cs | 2 +- .../DeploymentItemTests.cs | 2 +- .../DotnetTestCliTests.cs | 2 +- .../DuplicateTestClassAttributeTests.cs | 4 ++-- .../DynamicDataMethodTests.cs | 2 +- .../FrameworkOnlyTests.cs | 2 +- .../GenericTestMethodTests.cs | 2 +- .../HelpInfoTests.cs | 2 +- .../IgnoreTests.cs | 2 +- .../InconclusiveTests.cs | 2 +- .../LeakTests.cs | 2 +- .../LifecycleAttributesTaskThreadingTests.cs | 4 ++-- ...ecycleAttributesValueTaskThreadingTests.cs | 4 ++-- .../LifecycleAttributesVoidThreadingTests.cs | 4 ++-- .../LifecycleTests.cs | 2 +- ...ithParallelAttributesTaskThreadingTests.cs | 4 ++-- .../MSBuildRunnerTests.cs | 4 ++-- .../MaxFailedTestsExtensionTests.cs | 2 +- .../NativeAotTests.cs | 2 -- .../OutputTests.cs | 2 +- .../ParameterizedDataRowTests.cs | 2 +- .../ParameterizedDataSourceTests.cs | 2 +- .../ParameterizedTestTests.cs | 2 +- .../PlaywrightSdkTests.cs | 3 +-- .../PublishAotNonNativeTests.cs | 2 +- .../RetryTests.cs | 2 +- .../RunnerTests.cs | 16 ++++++++-------- .../RunsettingsTests.cs | 2 +- .../STATestClassCooperativeTimeoutTests.cs | 2 +- .../STATestClassTests.cs | 2 +- .../STATestClassTimeoutTests.cs | 2 +- .../STATestMethodCooperativeTimeoutTests.cs | 2 +- .../STATestMethodTests.cs | 2 +- .../STATestMethodTimeoutTests.cs | 2 +- .../STAThreadingTests.cs | 4 ++-- .../SdkTests.cs | 19 +++++++++---------- .../ServerModeTests.cs | 2 +- .../SynchronizationContextTests.cs | 2 +- .../TestContextTests.cs | 2 +- .../TestDiscoveryTests.cs | 2 +- .../TestDiscoveryWarningsTests.cs | 2 +- .../TestFilterTests.cs | 2 +- .../TestRunParametersTests.cs | 2 +- ...readContextCultureFlowsInheritanceTests.cs | 2 +- .../ThreadContextCultureFlowsTests.cs | 2 +- .../ThreadContextTests.cs | 2 +- .../ThreadingTests.cs | 2 +- .../TimeoutTests.cs | 2 +- .../TrimTests.cs | 2 -- .../TrxReportTests.cs | 2 +- .../TupleDynamicDataTests.cs | 2 +- .../ValueTaskTests.cs | 2 +- .../WinUITests.cs | 2 +- .../AbortionTests.cs | 2 +- .../ConsoleTests.cs | 2 +- .../CrashDumpTests.cs | 2 +- .../CrashPlusHangDumpTests.cs | 2 +- .../CustomBannerTests.cs | 2 +- .../DataConsumerThroughputTests.cs | 4 ++-- .../DiagnosticTests.cs | 2 +- ...mentVariablesConfigurationProviderTests.cs | 2 +- .../ExecutionRequestCompleteTests.cs | 4 ++-- .../ExecutionTests.cs | 2 +- .../ExitOnProcessExitTests.cs | 2 +- .../ForwardCompatibilityTests.cs | 2 +- .../HangDumpOutputTests.cs | 2 +- .../HangDumpProcessTreeTests.cs | 2 +- .../HangDumpTests.cs | 4 +--- .../HelpInfoAllExtensionsTests.cs | 2 +- .../HelpInfoTests.cs | 2 +- .../Helpers/AcceptanceFixture.cs | 11 +---------- .../IgnoreExitCodeTests.cs | 3 +-- .../LocalizationFailingTests.cs | 2 +- .../LocalizationTests.cs | 2 +- .../MSBuild.KnownExtensionRegistration.cs | 2 +- .../MSBuildTests.ConfigurationFile.cs | 8 ++++---- .../MSBuildTests.GenerateEntryPoint.cs | 5 ++--- .../MSBuildTests.Solution.cs | 4 ++-- .../MSBuildTests.Test.cs | 11 +++-------- .../MaxFailedTestsExtensionTests.cs | 2 +- .../NativeAotTests.cs | 1 - .../NoBannerTests.cs | 2 +- .../RetryFailedTestsTests.cs | 3 +-- .../ServerLoggingTests.cs | 2 +- .../TelemetryDisabledTests.cs | 4 ++-- .../TelemetryTests.cs | 2 +- .../TestHostProcessLifetimeHandlerTests.cs | 2 +- .../TimeoutTests.cs | 2 +- .../TrimTests.cs | 1 - .../TrxDataRowTests.cs | 2 +- .../TrxFailingTestTests.cs | 2 +- .../TrxSkippedTestTests.cs | 2 +- .../TrxTests.cs | 3 +-- .../TypeForwardingTests.cs | 2 +- .../UnhandledExceptionPolicyTests.cs | 2 +- .../Steps/DotnetMuxer.cs | 3 +-- .../Steps/DotnetTrace.cs | 3 +-- .../DotnetCli.cs | 3 --- .../TestAsset.cs | 3 --- .../TestAssetFixtureBase.cs | 8 ++------ 113 files changed, 144 insertions(+), 190 deletions(-) diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/AbortionTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/AbortionTests.cs index b172729f04..791c980981 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/AbortionTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/AbortionTests.cs @@ -36,7 +36,7 @@ public async Task AbortWithCTRLPlusC_CancellingTests(string tfm) testHostResult.AssertOutputMatchesRegex("Canceling the test session.*"); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { private const string Sources = """ #file AbortMSTestAsset.csproj diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/AnalyzersTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/AnalyzersTests.cs index b5aa911e94..f2654fbae1 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/AnalyzersTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/AnalyzersTests.cs @@ -56,7 +56,6 @@ public void TestMethod() using TestAsset testAsset = await TestAsset.GenerateAssetAsync("TestForMSTEST0001", code); DotnetMuxerResult result = await DotnetCli.RunAsync( $"build {testAsset.TargetAssetPath}", - AcceptanceFixture.NuGetGlobalPackagesFolder.Path, warnAsError: false, cancellationToken: TestContext.CancellationToken); if (isAdapterReferenced) @@ -113,7 +112,6 @@ public void TestMethod() using TestAsset testAsset = await TestAsset.GenerateAssetAsync("AnalyzersMetapackage", code); DotnetMuxerResult result = await DotnetCli.RunAsync( $"build {testAsset.TargetAssetPath}", - AcceptanceFixture.NuGetGlobalPackagesFolder.Path, warnAsError: false, cancellationToken: TestContext.CancellationToken); result.AssertOutputContains("MSTEST0014"); @@ -153,7 +151,6 @@ public void TestMethod() using TestAsset testAsset = await TestAsset.GenerateAssetAsync("AnalyzersTestFrameworkPackage", code); DotnetMuxerResult result = await DotnetCli.RunAsync( $"build {testAsset.TargetAssetPath}", - AcceptanceFixture.NuGetGlobalPackagesFolder.Path, warnAsError: false, cancellationToken: TestContext.CancellationToken); result.AssertOutputContains("MSTEST0014"); @@ -196,7 +193,6 @@ public void TestMethod() using TestAsset testAsset = await TestAsset.GenerateAssetAsync("Analyzers", code); DotnetMuxerResult result = await DotnetCli.RunAsync( $"build {testAsset.TargetAssetPath}", - AcceptanceFixture.NuGetGlobalPackagesFolder.Path, environmentVariables: new() { ["DOTNET_CLI_UI_LANGUAGE"] = "it-IT", @@ -295,7 +291,7 @@ public async void TestMethod1() private static async Task AssertAnalysisModeAsync(string mode, string[] contains, string[] doesNotContain, string targetAssetPath) { - async Task BuildTaskAsync() => await DotnetCli.RunAsync($"build {targetAssetPath}", AcceptanceFixture.NuGetGlobalPackagesFolder.Path, warnAsError: false, retryCount: 0); + async Task BuildTaskAsync() => await DotnetCli.RunAsync($"build {targetAssetPath}", warnAsError: false, retryCount: 0); string output; if (mode is "Recommended" or "All") diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/AppDomainTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/AppDomainTests.cs index 6d28370da9..fd2d423d9e 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/AppDomainTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/AppDomainTests.cs @@ -26,7 +26,7 @@ public async Task RunTests_With_VSTest(bool? disableAppDomain) null => string.Empty, }; - DotnetMuxerResult compilationResult = await DotnetCli.RunAsync($"test -c Release --no-build {AssetFixture.TargetAssetPath}{disableAppDomainCommand}", AcceptanceFixture.NuGetGlobalPackagesFolder.Path, workingDirectory: AssetFixture.TargetAssetPath, cancellationToken: TestContext.CancellationToken); + DotnetMuxerResult compilationResult = await DotnetCli.RunAsync($"test -c Release --no-build {AssetFixture.TargetAssetPath}{disableAppDomainCommand}", workingDirectory: AssetFixture.TargetAssetPath, cancellationToken: TestContext.CancellationToken); Assert.AreEqual(0, compilationResult.ExitCode); compilationResult.AssertOutputContains(@"Passed! - Failed: 0, Passed: 2, Skipped: 0, Total: 2"); @@ -45,7 +45,7 @@ public async Task DiscoverTests_With_VSTest(bool? disableAppDomain) null => string.Empty, }; - DotnetMuxerResult compilationResult = await DotnetCli.RunAsync($"test -c Release --no-build {AssetFixture.TargetAssetPath} --list-tests{disableAppDomainCommand}", AcceptanceFixture.NuGetGlobalPackagesFolder.Path, workingDirectory: AssetFixture.TargetAssetPath, cancellationToken: TestContext.CancellationToken); + DotnetMuxerResult compilationResult = await DotnetCli.RunAsync($"test -c Release --no-build {AssetFixture.TargetAssetPath} --list-tests{disableAppDomainCommand}", workingDirectory: AssetFixture.TargetAssetPath, cancellationToken: TestContext.CancellationToken); Assert.AreEqual(0, compilationResult.ExitCode); } @@ -107,7 +107,7 @@ private static string GetTestDllPath(string assetPath, string targetFramework) = public TestContext TestContext { get; set; } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { private const string SingleTestSourceCode = """ #file AppDomainTests.csproj diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/AspireSdkTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/AspireSdkTests.cs index 6c42defb8f..29b3cebadf 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/AspireSdkTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/AspireSdkTests.cs @@ -28,7 +28,6 @@ public async Task EnableAspireProperty_WhenUsingVSTest_AllowsToRunAspireTests() : testHost.FullName + ".dll"; DotnetMuxerResult dotnetTestResult = await DotnetCli.RunAsync( $"test {exeOrDllName}", - AcceptanceFixture.NuGetGlobalPackagesFolder.Path, workingDirectory: AssetFixture.AspireProjectPath, warnAsError: false, suppressPreviewDotNetMessage: false, @@ -39,7 +38,7 @@ public async Task EnableAspireProperty_WhenUsingVSTest_AllowsToRunAspireTests() dotnetTestResult.AssertOutputContains("Passed! - Failed: 0, Passed: 1, Skipped: 0, Total: 1"); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { public const string AspireProjectName = "AspireProject"; diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/AssemblyCleanupTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/AssemblyCleanupTests.cs index f82fd72139..1684e31084 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/AssemblyCleanupTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/AssemblyCleanupTests.cs @@ -26,7 +26,7 @@ In AsmCleanup """); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { public const string ProjectName = "AssemblyCleanupTests"; diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/AssemblyResolutionTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/AssemblyResolutionTests.cs index f85b11273b..93b20ee1fc 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/AssemblyResolutionTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/AssemblyResolutionTests.cs @@ -68,7 +68,7 @@ public void Dispose() public async Task InitializeAsync(CancellationToken cancellationToken) { VSSolution solution = CreateTestAsset(); - DotnetMuxerResult result = await DotnetCli.RunAsync($"build {solution.SolutionFile} -c Release", AcceptanceFixture.NuGetGlobalPackagesFolder.Path, cancellationToken: cancellationToken); + DotnetMuxerResult result = await DotnetCli.RunAsync($"build {solution.SolutionFile} -c Release", cancellationToken: cancellationToken); result.AssertExitCodeIs(0); TestHost = TestHost.LocateFrom(solution.Projects.Skip(1).Single().FolderPath, TestProjectName, TargetFramework); diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/AssemblyResolverTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/AssemblyResolverTests.cs index 71aa97d623..06a51ef005 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/AssemblyResolverTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/AssemblyResolverTests.cs @@ -24,7 +24,7 @@ public async Task RunningTests_DoesNotHitResourceRecursionIssueAndDoesNotCrashTh testHostResult.AssertExitCodeIs(ExitCodes.Success); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { public string TargetAssetPath => GetAssetPath(AssetName); diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/CancellationTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/CancellationTests.cs index 2ec5f2f69e..4e37998a0e 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/CancellationTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/CancellationTests.cs @@ -128,7 +128,7 @@ public async Task WhenCancelingTestContextTokenInTestMethod_MessageIsAsExpected( testHostResult.AssertOutputContains("Failed!"); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { public const string ProjectName = "TestCancellation"; diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/ConfigurationMSTestSettingsTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/ConfigurationMSTestSettingsTests.cs index de3fb70906..a954928988 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/ConfigurationMSTestSettingsTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/ConfigurationMSTestSettingsTests.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.Testing.Platform.Acceptance.IntegrationTests; @@ -24,7 +24,7 @@ public async Task TestConfigJson_AndRunSettingsHasMstest_Throws(string tfm) testHostResult.AssertStandardErrorContains("Both '.runsettings' and '.testconfig.json' files have been detected. Please select only one of these test configuration files."); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { public const string ProjectNameWithMSTestRunSettings = "ConfigurationMSTestSettings"; diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/ConfigurationMSTestV2SettingsTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/ConfigurationMSTestV2SettingsTests.cs index d190325882..750918d18e 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/ConfigurationMSTestV2SettingsTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/ConfigurationMSTestV2SettingsTests.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.Testing.Platform.Acceptance.IntegrationTests; @@ -24,7 +24,7 @@ public async Task TestConfigJson_AndRunSettingsHasMstestv2_Throws(string tfm) testHostResult.AssertStandardErrorContains("Both '.runsettings' and '.testconfig.json' files have been detected. Please select only one of these test configuration files."); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { public const string ProjectNameWithMSTestV2RunSettings = "ConfigurationMSTestV2Settings"; diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/ConfigurationSettingsTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/ConfigurationSettingsTests.cs index b60fa50777..7d2ef2bc25 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/ConfigurationSettingsTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/ConfigurationSettingsTests.cs @@ -80,7 +80,7 @@ public async Task TestWithConfigFromCommandLineWithNonExistingFile() testHostResult.AssertStandardErrorContains("dummyconfigfile_not_existing_file.json"); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { public const string ProjectName = "ConfigurationSettings"; diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/CustomAttributesTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/CustomAttributesTests.cs index 0e6b1113ec..5cb50ebb91 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/CustomAttributesTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/CustomAttributesTests.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.Testing.Platform.Acceptance.IntegrationTests; @@ -23,7 +23,7 @@ public async Task DuplicateTestMethodAttribute_ShouldFail(string tfm) testHostResult.AssertOutputContainsSummary(failed: 1, passed: 1, skipped: 0); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { public const string DuplicateTestMethodProjectName = "DuplicateTestMethodAttribute"; diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/DataSourceTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/DataSourceTests.cs index 66be0c8fd7..b986c076b1 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/DataSourceTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/DataSourceTests.cs @@ -96,7 +96,6 @@ public async Task TestDataSourceFromAppConfig() await DotnetCli.RunAsync( $"build {generator.TargetAssetPath} -c Release", - AcceptanceFixture.NuGetGlobalPackagesFolder.Path, retryCount: 0, cancellationToken: TestContext.CancellationToken); diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/DeadlockTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/DeadlockTests.cs index 5e05614e74..1b84601e5b 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/DeadlockTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/DeadlockTests.cs @@ -42,7 +42,7 @@ public async Task DeadlockCaseAssemblyCleanupWaitingOnTestMethod(string tfm) testHostResult.AssertOutputContainsSummary(failed: 0, passed: 1, skipped: 0); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { public const string ProjectName = "DeadlockTests"; diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/DeploymentItemTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/DeploymentItemTests.cs index 08a2abdf66..4e68371f0d 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/DeploymentItemTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/DeploymentItemTests.cs @@ -24,7 +24,7 @@ public async Task AssemblyIsLoadedOnceFromDeploymentDirectory(string runsettings testHostResult.AssertExitCodeIs(ExitCodes.Success); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { private const string Sources = """ #file DeploymentItemTests.csproj diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/DotnetTestCliTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/DotnetTestCliTests.cs index 1231e3d6c7..233e51ac21 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/DotnetTestCliTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/DotnetTestCliTests.cs @@ -25,7 +25,7 @@ public async Task DotnetTest_Should_Execute_Tests(string tfm, BuildConfiguration .PatchCodeWithReplace("$OutputType$", string.Empty) .PatchCodeWithReplace("$Extra$", string.Empty)); - DotnetMuxerResult compilationResult = await DotnetCli.RunAsync($"test {generator.TargetAssetPath}", AcceptanceFixture.NuGetGlobalPackagesFolder.Path, workingDirectory: generator.TargetAssetPath, cancellationToken: TestContext.CancellationToken); + DotnetMuxerResult compilationResult = await DotnetCli.RunAsync($"test {generator.TargetAssetPath}", workingDirectory: generator.TargetAssetPath, cancellationToken: TestContext.CancellationToken); // There is whitespace difference in output in parent and public repo that depends on the version of the dotnet SDK used. compilationResult.AssertOutputMatchesRegex(@"Passed!\s+-\s+Failed:\s+0,\s+Passed:\s+1,\s+Skipped:\s+0,\s+Total:\s+1"); diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/DuplicateTestClassAttributeTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/DuplicateTestClassAttributeTests.cs index ad6c1a0ef9..840dc19472 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/DuplicateTestClassAttributeTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/DuplicateTestClassAttributeTests.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.Testing.Platform.Acceptance.IntegrationTests; @@ -23,7 +23,7 @@ public async Task DuplicateTestClassAttribute_ShouldFail(string tfm) testHostResult.AssertStandardErrorContains("Only one attribute of type 'Microsoft.VisualStudio.TestTools.UnitTesting.TestClassAttribute' is allowed, but multiple were found."); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { public const string DuplicateTestClassProjectName = "DuplicateTestClassAttribute"; diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/DynamicDataMethodTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/DynamicDataMethodTests.cs index b2d4f991ba..2124bf44e6 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/DynamicDataMethodTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/DynamicDataMethodTests.cs @@ -51,7 +51,7 @@ public async Task DynamicDataTestWithParameterizedDataProviderMethod(string tfm) testHostResult.AssertOutputContains("TestMethodSingleParameterIntArray called with: 9"); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { public const string ProjectName = "DynamicDataMethodTests"; diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/FrameworkOnlyTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/FrameworkOnlyTests.cs index f191ad5c46..89d9abacd9 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/FrameworkOnlyTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/FrameworkOnlyTests.cs @@ -28,7 +28,7 @@ public async Task DynamicDataAttributeGetDataShouldWorkWithoutAdapter() testHostResult.AssertExitCodeIs(ExitCodes.Success); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { private const string Sources = """ #file FrameworkOnlyTests.csproj diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/GenericTestMethodTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/GenericTestMethodTests.cs index eee0e3471a..57740c28c5 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/GenericTestMethodTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/GenericTestMethodTests.cs @@ -78,7 +78,7 @@ Cannot create an instance of T\[] because Type\.ContainsGenericParameters is tru """, RegexOptions.Singleline); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { public override IEnumerable<(string ID, string Name, string Code)> GetAssetsToGenerate() { diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/HelpInfoTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/HelpInfoTests.cs index e87af996ef..5451eec7a1 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/HelpInfoTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/HelpInfoTests.cs @@ -124,7 +124,7 @@ public async Task Info_WhenMSTestExtensionRegistered_OutputInfoContentOfRegister testHostResult.AssertOutputContains(output); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { public string TargetAssetPath => GetAssetPath(AssetName); diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/IgnoreTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/IgnoreTests.cs index b7ebe3793b..a9f99f17f4 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/IgnoreTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/IgnoreTests.cs @@ -106,7 +106,7 @@ public async Task WhenSpecificDataSourceIsIgnoredViaIgnoreMessageProperty() testHostResult.AssertOutputContainsSummary(failed: 0, passed: 10, skipped: 6); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { public const string ProjectName = "TestIgnore"; diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/InconclusiveTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/InconclusiveTests.cs index 4ebaf5e17e..236cfae3b8 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/InconclusiveTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/InconclusiveTests.cs @@ -112,7 +112,7 @@ public async Task TestOutcomeShouldBeRespectedCorrectly(Lifecycle inconclusiveSt testHostResult.AssertOutputContains("AssemblyCleanup called"); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { public const string ProjectName = "TestInconclusive"; diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/LeakTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/LeakTests.cs index ddfe696468..55505197c3 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/LeakTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/LeakTests.cs @@ -20,7 +20,7 @@ public async Task TestContextInstancesShouldNotLeak(string tfm) testHostResult.AssertOutputContainsSummary(failed: 0, passed: 100, skipped: 0); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { public const string ProjectName = "LeakTests"; diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/LifecycleAttributesTaskThreadingTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/LifecycleAttributesTaskThreadingTests.cs index 782a4bd2e6..576417323c 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/LifecycleAttributesTaskThreadingTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/LifecycleAttributesTaskThreadingTests.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.Testing.Platform.Acceptance.IntegrationTests; @@ -26,7 +26,7 @@ public async Task LifecycleAttributesTaskThreading_WhenMainIsNotSTA_RunsettingsA testHostResult.AssertOutputContains("Passed!"); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { public const string ProjectName = "LifecycleAttributesTask"; diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/LifecycleAttributesValueTaskThreadingTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/LifecycleAttributesValueTaskThreadingTests.cs index b4fae8407c..955078636d 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/LifecycleAttributesValueTaskThreadingTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/LifecycleAttributesValueTaskThreadingTests.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.Testing.Platform.Acceptance.IntegrationTests; @@ -26,7 +26,7 @@ public async Task LifecycleAttributesValueTaskThreading_WhenMainIsNotSTA_Runsett testHostResult.AssertOutputContains("Passed!"); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { public const string ProjectName = "LifecycleAttributesValueTask"; diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/LifecycleAttributesVoidThreadingTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/LifecycleAttributesVoidThreadingTests.cs index 7b197fea34..f84e68227b 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/LifecycleAttributesVoidThreadingTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/LifecycleAttributesVoidThreadingTests.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.Testing.Platform.Acceptance.IntegrationTests; @@ -26,7 +26,7 @@ public async Task LifecycleAttributesVoidThreading_WhenMainIsNotSTA_RunsettingsA testHostResult.AssertOutputContains("Passed!"); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { public const string ProjectName = "LifecycleAttributesVoid"; diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/LifecycleTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/LifecycleTests.cs index 3e233f13e3..9e20cc7c70 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/LifecycleTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/LifecycleTests.cs @@ -76,7 +76,7 @@ AssemblyCleanup called. """); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { public const string ProjectName = "LifecycleTests"; diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/LifecycleWithParallelAttributesTaskThreadingTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/LifecycleWithParallelAttributesTaskThreadingTests.cs index 98d27425eb..494a4d2980 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/LifecycleWithParallelAttributesTaskThreadingTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/LifecycleWithParallelAttributesTaskThreadingTests.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.Testing.Platform.Acceptance.IntegrationTests; @@ -26,7 +26,7 @@ public async Task LifecycleAttributesTaskThreading_WhenMainIsNotSTA_RunsettingsA testHostResult.AssertOutputContains("Passed!"); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { public const string ProjectName = "LifecycleWithParallelAttributesTask"; public const string AssemblyName = "LifecycleAttributesTask"; diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/MSBuildRunnerTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/MSBuildRunnerTests.cs index 94996ff92d..560997fba7 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/MSBuildRunnerTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/MSBuildRunnerTests.cs @@ -43,10 +43,10 @@ public async Task MSBuildTestTarget_SingleAndMultiTfm_Should_Run_Solution_Tests( } // Build the solution - DotnetMuxerResult restoreResult = await DotnetCli.RunAsync($"restore {solution.SolutionFile} --configfile {nugetFile}", AcceptanceFixture.NuGetGlobalPackagesFolder.Path, cancellationToken: TestContext.CancellationToken); + DotnetMuxerResult restoreResult = await DotnetCli.RunAsync($"restore {solution.SolutionFile} --configfile {nugetFile}", cancellationToken: TestContext.CancellationToken); restoreResult.AssertOutputDoesNotContain("An approximate best match of"); - DotnetMuxerResult testResult = await DotnetCli.RunAsync($"build --no-restore /t:Test {solution.SolutionFile}", AcceptanceFixture.NuGetGlobalPackagesFolder.Path, workingDirectory: generator.TargetAssetPath, cancellationToken: TestContext.CancellationToken); + DotnetMuxerResult testResult = await DotnetCli.RunAsync($"build --no-restore /t:Test {solution.SolutionFile}", workingDirectory: generator.TargetAssetPath, cancellationToken: TestContext.CancellationToken); if (isMultiTfm) { diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/MaxFailedTestsExtensionTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/MaxFailedTestsExtensionTests.cs index 49ddd4443c..4d99b9598a 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/MaxFailedTestsExtensionTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/MaxFailedTestsExtensionTests.cs @@ -36,7 +36,7 @@ public async Task SimpleMaxFailedTestsScenario(string tfm) Assert.AreEqual(12, total); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { private const string Sources = """ #file MaxFailedTestsExtensionTests.csproj diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/NativeAotTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/NativeAotTests.cs index 711840bcd4..9e8b3c35f3 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/NativeAotTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/NativeAotTests.cs @@ -103,12 +103,10 @@ public async Task NativeAotTests_WillRunWithExitCodeZero(string tfm) await DotnetCli.RunAsync( $"restore {generator.TargetAssetPath} -r {RID}", - AcceptanceFixture.NuGetGlobalPackagesFolder.Path, retryCount: 0, cancellationToken: TestContext.CancellationToken); DotnetMuxerResult compilationResult = await DotnetCli.RunAsync( $"publish {generator.TargetAssetPath} -r {RID} -f {tfm}", - AcceptanceFixture.NuGetGlobalPackagesFolder.Path, retryCount: 0, cancellationToken: TestContext.CancellationToken); compilationResult.AssertOutputContains("Generating native code"); diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/OutputTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/OutputTests.cs index 0a2f3d678e..ef658bd8ee 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/OutputTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/OutputTests.cs @@ -27,7 +27,7 @@ Error output """); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { public const string ProjectName = "TestOutput"; diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/ParameterizedDataRowTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/ParameterizedDataRowTests.cs index 855cea695c..c7664558a9 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/ParameterizedDataRowTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/ParameterizedDataRowTests.cs @@ -32,7 +32,7 @@ private static async Task UsingDataRowThatDoesNotRoundTripUsingDataContractJsonS testHostResult.AssertOutputContainsSummary(failed: 0, passed: 3, skipped: 0); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { public override IEnumerable<(string ID, string Name, string Code)> GetAssetsToGenerate() { diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/ParameterizedDataSourceTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/ParameterizedDataSourceTests.cs index 65f5892f0f..5a5300cbc2 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/ParameterizedDataSourceTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/ParameterizedDataSourceTests.cs @@ -63,7 +63,7 @@ private static async Task RunTestsAsync(string currentTfm, string assetName, boo } } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { public override IEnumerable<(string ID, string Name, string Code)> GetAssetsToGenerate() { diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/ParameterizedTestTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/ParameterizedTestTests.cs index 41eab2f411..59a34e0e52 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/ParameterizedTestTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/ParameterizedTestTests.cs @@ -135,7 +135,7 @@ private static async Task RunTestsAsync(string currentTfm, string assetName, boo } } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { public override IEnumerable<(string ID, string Name, string Code)> GetAssetsToGenerate() { diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/PlaywrightSdkTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/PlaywrightSdkTests.cs index 770a7ba022..f4b19e3159 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/PlaywrightSdkTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/PlaywrightSdkTests.cs @@ -46,7 +46,6 @@ public async Task EnablePlaywrightProperty_WhenUsingVSTest_AllowsToRunPlaywright : testHost.FullName + ".dll"; DotnetMuxerResult dotnetTestResult = await DotnetCli.RunAsync( $"test {exeOrDllName}", - AcceptanceFixture.NuGetGlobalPackagesFolder.Path, workingDirectory: AssetFixture.PlaywrightProjectPath, failIfReturnValueIsNotZero: false, warnAsError: false, @@ -74,7 +73,7 @@ public async Task EnablePlaywrightProperty_WhenUsingVSTest_AllowsToRunPlaywright } } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { public const string PlaywrightProjectName = "PlaywrightProject"; diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/PublishAotNonNativeTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/PublishAotNonNativeTests.cs index 3145c27267..d5c9c3986e 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/PublishAotNonNativeTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/PublishAotNonNativeTests.cs @@ -24,7 +24,7 @@ public async Task RunTests_ThatEnablePublishAOT_ButDontBuildToNative() .PatchCodeWithReplace("$TargetFramework$", $"{TargetFrameworks.NetCurrent}") .PatchCodeWithReplace("$MSTestVersion$", MSTestVersion)); - DotnetMuxerResult compilationResult = await DotnetCli.RunAsync($"build -t:Test -c Debug {generator.TargetAssetPath}", AcceptanceFixture.NuGetGlobalPackagesFolder.Path, workingDirectory: generator.TargetAssetPath, failIfReturnValueIsNotZero: false, cancellationToken: TestContext.CancellationToken); + DotnetMuxerResult compilationResult = await DotnetCli.RunAsync($"build -t:Test -c Debug {generator.TargetAssetPath}", workingDirectory: generator.TargetAssetPath, failIfReturnValueIsNotZero: false, cancellationToken: TestContext.CancellationToken); // In the real-world issue, access to path C:\Program Files\dotnet\ is denied, but we run this from a local .dotnet folder, where we have write access. // So instead of relying on the test run failing because of AccessDenied, we check the output, and see where TestResults were placed. diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/RetryTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/RetryTests.cs index 54405e8e69..f64283badd 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/RetryTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/RetryTests.cs @@ -30,7 +30,7 @@ TestMethod5 executed 4 times. testHostResult.AssertOutputContainsSummary(failed: 1, passed: 4, skipped: 0); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { public const string ProjectName = "RetryTests"; diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/RunnerTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/RunnerTests.cs index d5f7d3a2ee..e35141083b 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/RunnerTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/RunnerTests.cs @@ -29,10 +29,10 @@ public async SystemTask EnableMSTestRunner_True_Will_Run_Standalone(string tfm, .PatchCodeWithReplace("$Extra$", string.Empty)); DotnetMuxerResult compilationResult = await DotnetCli.RunAsync( $"restore {generator.TargetAssetPath} -r {RID}", - AcceptanceFixture.NuGetGlobalPackagesFolder.Path, cancellationToken: TestContext.CancellationToken); + cancellationToken: TestContext.CancellationToken); compilationResult = await DotnetCli.RunAsync( $"{verb} {generator.TargetAssetPath} -c {buildConfiguration} -r {RID}", - AcceptanceFixture.NuGetGlobalPackagesFolder.Path, cancellationToken: TestContext.CancellationToken); + cancellationToken: TestContext.CancellationToken); Build binLog = Serialization.Read(compilationResult.BinlogPath); Assert.AreNotEqual(0, binLog.FindChildrenRecursive() @@ -68,10 +68,10 @@ public async SystemTask EnableMSTestRunner_True_WithCustomEntryPoint_Will_Run_St False preview """)); - await DotnetCli.RunAsync($"restore {generator.TargetAssetPath} -r {RID}", AcceptanceFixture.NuGetGlobalPackagesFolder.Path, cancellationToken: TestContext.CancellationToken); + await DotnetCli.RunAsync($"restore {generator.TargetAssetPath} -r {RID}", cancellationToken: TestContext.CancellationToken); await DotnetCli.RunAsync( $"{verb} {generator.TargetAssetPath} -c {buildConfiguration} -r {RID}", - AcceptanceFixture.NuGetGlobalPackagesFolder.Path, cancellationToken: TestContext.CancellationToken); + cancellationToken: TestContext.CancellationToken); var testHost = TestHost.LocateFrom(generator.TargetAssetPath, AssetName, tfm, buildConfiguration: buildConfiguration, verb: verb); TestHostResult testHostResult = await testHost.ExecuteAsync(cancellationToken: TestContext.CancellationToken); testHostResult.AssertOutputContainsSummary(failed: 0, passed: 1, skipped: 0); @@ -90,18 +90,18 @@ public async SystemTask EnableMSTestRunner_False_Will_Run_Empty_Program_EntryPoi .PatchCodeWithReplace("$EnableMSTestRunner$", "false") .PatchCodeWithReplace("$OutputType$", "Exe") .PatchCodeWithReplace("$Extra$", string.Empty)); - await DotnetCli.RunAsync($"restore {generator.TargetAssetPath} -r {RID}", AcceptanceFixture.NuGetGlobalPackagesFolder.Path, cancellationToken: TestContext.CancellationToken); + await DotnetCli.RunAsync($"restore {generator.TargetAssetPath} -r {RID}", cancellationToken: TestContext.CancellationToken); if (TargetFrameworks.NetFramework.Any(x => x == tfm)) { // Running under .NET Framework, which doesn't generate an empty entry point. - Exception ex = await Assert.ThrowsAsync(async () => await DotnetCli.RunAsync($"{verb} {generator.TargetAssetPath} -c {buildConfiguration} -r {RID}", AcceptanceFixture.NuGetGlobalPackagesFolder.Path, cancellationToken: TestContext.CancellationToken)); + Exception ex = await Assert.ThrowsAsync(async () => await DotnetCli.RunAsync($"{verb} {generator.TargetAssetPath} -c {buildConfiguration} -r {RID}", cancellationToken: TestContext.CancellationToken)); Assert.Contains("Program does not contain a static 'Main' method suitable for an entry point", ex.Message); return; } // Running on .NET (Core), building should succeed and we should run empty entry point. - await DotnetCli.RunAsync($"{verb} {generator.TargetAssetPath} -c {buildConfiguration} -r {RID}", AcceptanceFixture.NuGetGlobalPackagesFolder.Path, cancellationToken: TestContext.CancellationToken); + await DotnetCli.RunAsync($"{verb} {generator.TargetAssetPath} -c {buildConfiguration} -r {RID}", cancellationToken: TestContext.CancellationToken); var testHost = TestHost.LocateFrom(generator.TargetAssetPath, AssetName, tfm, buildConfiguration: buildConfiguration, verb: verb); TestHostResult testHostResult = await testHost.ExecuteAsync(cancellationToken: TestContext.CancellationToken); Assert.AreEqual(string.Empty, testHostResult.StandardOutput); @@ -122,7 +122,7 @@ public async SystemTask EnableMSTestRunner_False_Wont_Flow_TestingPlatformServer .PatchCodeWithReplace("$OutputType$", string.Empty) .PatchCodeWithReplace("$Extra$", string.Empty)); - DotnetMuxerResult result = await DotnetCli.RunAsync($"{verb} {generator.TargetAssetPath} -c {buildConfiguration} -r {RID} ", AcceptanceFixture.NuGetGlobalPackagesFolder.Path, cancellationToken: TestContext.CancellationToken); + DotnetMuxerResult result = await DotnetCli.RunAsync($"{verb} {generator.TargetAssetPath} -c {buildConfiguration} -r {RID} ", cancellationToken: TestContext.CancellationToken); Build binLog = Serialization.Read(result.BinlogPath); Assert.DoesNotContain(x => x.Title.Contains("ProjectCapability") && x.Children.Any(c => ((Item)c).Name == "TestingPlatformServer"), binLog.FindChildrenRecursive()); diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/RunsettingsTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/RunsettingsTests.cs index 2d484914f0..1ccde31e98 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/RunsettingsTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/RunsettingsTests.cs @@ -90,7 +90,7 @@ public async Task UnsupportedRunSettingsEntriesAreFlagged_Localization(string? t } } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { public const string ProjectName = "TestRunSettings"; diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/STATestClassCooperativeTimeoutTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/STATestClassCooperativeTimeoutTests.cs index f61b27a7f3..1bafbfe9dc 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/STATestClassCooperativeTimeoutTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/STATestClassCooperativeTimeoutTests.cs @@ -55,7 +55,7 @@ public async Task STATestClass_OnWindows_OnLifeCycleTestClassWithLastTestSkipped testHostResult.AssertOutputContains("LifeCycleTestClass.AssemblyCleanup"); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { public string TargetAssetPath => GetAssetPath(AssetName); diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/STATestClassTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/STATestClassTests.cs index f20122eb58..7f46ef7653 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/STATestClassTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/STATestClassTests.cs @@ -55,7 +55,7 @@ public async Task STATestClass_OnWindows_OnLifeCycleTestClassWithLastTestSkipped testHostResult.AssertOutputContains("LifeCycleTestClass.AssemblyCleanup"); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { public string TargetAssetPath => GetAssetPath(AssetName); diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/STATestClassTimeoutTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/STATestClassTimeoutTests.cs index 0b2ca0319c..a8abc5cdc5 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/STATestClassTimeoutTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/STATestClassTimeoutTests.cs @@ -55,7 +55,7 @@ public async Task STATestClass_OnWindows_OnLifeCycleTestClassWithLastTestSkipped testHostResult.AssertOutputContains("LifeCycleTestClass.AssemblyCleanup"); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { public string TargetAssetPath => GetAssetPath(AssetName); diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/STATestMethodCooperativeTimeoutTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/STATestMethodCooperativeTimeoutTests.cs index 1874e424d8..7f419678e9 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/STATestMethodCooperativeTimeoutTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/STATestMethodCooperativeTimeoutTests.cs @@ -58,7 +58,7 @@ public async Task STATestMethod_OnWindows_OnTestClassWithMultipleTests_WithCoope testHostResult.AssertOutputContains("LifeCycleTestClass.AssemblyCleanup"); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { public string TargetAssetPath => GetAssetPath(AssetName); diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/STATestMethodTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/STATestMethodTests.cs index 4fab99426c..5cfc206d09 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/STATestMethodTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/STATestMethodTests.cs @@ -58,7 +58,7 @@ public async Task STATestMethod_OnWindows_OnTestClassWithMultipleTests_MethodsAr testHostResult.AssertOutputContains("LifeCycleTestClass.AssemblyCleanup"); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { public string TargetAssetPath => GetAssetPath(AssetName); diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/STATestMethodTimeoutTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/STATestMethodTimeoutTests.cs index 0669e76339..eb5eef5673 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/STATestMethodTimeoutTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/STATestMethodTimeoutTests.cs @@ -58,7 +58,7 @@ public async Task STATestMethod_OnWindows_OnTestClassWithMultipleTests_WithTimeo testHostResult.AssertOutputContains("LifeCycleTestClass.AssemblyCleanup"); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { public string TargetAssetPath => GetAssetPath(AssetName); diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/STAThreadingTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/STAThreadingTests.cs index 90ef622cf8..402c203d9d 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/STAThreadingTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/STAThreadingTests.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.Testing.Platform.Acceptance.IntegrationTests; @@ -62,7 +62,7 @@ public async Task TestMethodThreading_MainIsSTAThread_OnWindows_RunsettingsAsksF testHostResult.AssertOutputContains("Passed!"); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { public const string ProjectName = "STATestThreading"; diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/SdkTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/SdkTests.cs index 8986cb55c0..997a162fec 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/SdkTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/SdkTests.cs @@ -72,7 +72,7 @@ public async Task RunTests_With_VSTest(string multiTfm, BuildConfiguration build .PatchCodeWithReplace("$TargetFramework$", multiTfm) .PatchCodeWithReplace("$ExtraProperties$", "true")); - DotnetMuxerResult compilationResult = await DotnetCli.RunAsync($"test -c {buildConfiguration} {testAsset.TargetAssetPath}", AcceptanceFixture.NuGetGlobalPackagesFolder.Path, workingDirectory: testAsset.TargetAssetPath, cancellationToken: TestContext.CancellationToken); + DotnetMuxerResult compilationResult = await DotnetCli.RunAsync($"test -c {buildConfiguration} {testAsset.TargetAssetPath}", workingDirectory: testAsset.TargetAssetPath, cancellationToken: TestContext.CancellationToken); compilationResult.AssertExitCodeIs(0); compilationResult.AssertOutputMatchesRegex(@"Passed! - Failed: 0, Passed: 1, Skipped: 0, Total: 1, Duration: .* [m]?s - MSTestSdk.dll \(net10\.0\)"); @@ -98,7 +98,7 @@ public async Task RunTests_With_MSTestRunner_DotnetTest(string multiTfm, BuildCo .PatchCodeWithReplace("$TargetFramework$", multiTfm) .PatchCodeWithReplace("$ExtraProperties$", string.Empty)); - DotnetMuxerResult compilationResult = await DotnetCli.RunAsync($"test -c {buildConfiguration} --project {testAsset.TargetAssetPath} --no-progress --no-ansi", AcceptanceFixture.NuGetGlobalPackagesFolder.Path, workingDirectory: testAsset.TargetAssetPath, cancellationToken: TestContext.CancellationToken); + DotnetMuxerResult compilationResult = await DotnetCli.RunAsync($"test -c {buildConfiguration} --project {testAsset.TargetAssetPath} --no-progress --no-ansi", workingDirectory: testAsset.TargetAssetPath, cancellationToken: TestContext.CancellationToken); compilationResult.AssertExitCodeIs(0); compilationResult.AssertOutputMatchesRegex(@"MSTestSdk.*? \(net10\.0\|x64\) passed"); @@ -124,7 +124,7 @@ public async Task RunTests_With_MSTestRunner_Standalone(string multiTfm, BuildCo .PatchCodeWithReplace("$TargetFramework$", multiTfm) .PatchCodeWithReplace("$ExtraProperties$", string.Empty)); - DotnetMuxerResult compilationResult = await DotnetCli.RunAsync($"build -c {buildConfiguration} {testAsset.TargetAssetPath}", AcceptanceFixture.NuGetGlobalPackagesFolder.Path, cancellationToken: TestContext.CancellationToken); + DotnetMuxerResult compilationResult = await DotnetCli.RunAsync($"build -c {buildConfiguration} {testAsset.TargetAssetPath}", cancellationToken: TestContext.CancellationToken); compilationResult.AssertExitCodeIs(0); foreach (string tfm in multiTfm.Split(";")) { @@ -145,7 +145,7 @@ public async Task RunTests_With_CentralPackageManagement_Standalone(string multi .PatchCodeWithReplace("$TargetFramework$", multiTfm) .PatchCodeWithReplace("$ExtraProperties$", string.Empty)); - DotnetMuxerResult compilationResult = await DotnetCli.RunAsync($"build -c {buildConfiguration} {testAsset.TargetAssetPath}", AcceptanceFixture.NuGetGlobalPackagesFolder.Path, cancellationToken: TestContext.CancellationToken); + DotnetMuxerResult compilationResult = await DotnetCli.RunAsync($"build -c {buildConfiguration} {testAsset.TargetAssetPath}", cancellationToken: TestContext.CancellationToken); compilationResult.AssertExitCodeIs(0); foreach (string tfm in multiTfm.Split(";")) { @@ -205,7 +205,7 @@ public async Task RunTests_With_MSTestRunner_Standalone_Selectively_Enabled_Exte .PatchCodeWithReplace("$TargetFramework$", multiTfm) .PatchCodeWithReplace("$ExtraProperties$", msbuildExtensionEnableFragment)); - DotnetMuxerResult compilationResult = await DotnetCli.RunAsync($"build -c {buildConfiguration} {testAsset.TargetAssetPath}", AcceptanceFixture.NuGetGlobalPackagesFolder.Path, cancellationToken: TestContext.CancellationToken); + DotnetMuxerResult compilationResult = await DotnetCli.RunAsync($"build -c {buildConfiguration} {testAsset.TargetAssetPath}", cancellationToken: TestContext.CancellationToken); compilationResult.AssertExitCodeIs(0); foreach (string tfm in multiTfm.Split(";")) { @@ -229,7 +229,7 @@ public async Task RunTests_With_MSTestRunner_Standalone_EnableAll_Extensions(str .PatchCodeWithReplace("$TargetFramework$", multiTfm) .PatchCodeWithReplace("$ExtraProperties$", "AllMicrosoft"), addPublicFeeds: true); - DotnetMuxerResult compilationResult = await DotnetCli.RunAsync($"build -c {buildConfiguration} {testAsset.TargetAssetPath}", AcceptanceFixture.NuGetGlobalPackagesFolder.Path, cancellationToken: TestContext.CancellationToken); + DotnetMuxerResult compilationResult = await DotnetCli.RunAsync($"build -c {buildConfiguration} {testAsset.TargetAssetPath}", cancellationToken: TestContext.CancellationToken); compilationResult.AssertExitCodeIs(0); foreach (string tfm in multiTfm.Split(";")) { @@ -259,7 +259,7 @@ public async Task RunTests_With_MSTestRunner_Standalone_Enable_Default_Extension .PatchCodeWithReplace("$TargetFramework$", multiTfm) .PatchCodeWithReplace("$ExtraProperties$", enableDefaultExtensions ? string.Empty : "None")); - DotnetMuxerResult compilationResult = await DotnetCli.RunAsync($"build -c {buildConfiguration} {testAsset.TargetAssetPath}", AcceptanceFixture.NuGetGlobalPackagesFolder.Path, cancellationToken: TestContext.CancellationToken); + DotnetMuxerResult compilationResult = await DotnetCli.RunAsync($"build -c {buildConfiguration} {testAsset.TargetAssetPath}", cancellationToken: TestContext.CancellationToken); compilationResult.AssertExitCodeIs(0); foreach (string tfm in multiTfm.Split(";")) { @@ -287,7 +287,7 @@ public async Task Invalid_TestingProfile_Name_Should_Fail(string multiTfm, Build .PatchCodeWithReplace("$TargetFramework$", multiTfm) .PatchCodeWithReplace("$ExtraProperties$", "WrongName")); - DotnetMuxerResult compilationResult = await DotnetCli.RunAsync($"build -c {buildConfiguration} {testAsset.TargetAssetPath}", AcceptanceFixture.NuGetGlobalPackagesFolder.Path, failIfReturnValueIsNotZero: false, cancellationToken: TestContext.CancellationToken); + DotnetMuxerResult compilationResult = await DotnetCli.RunAsync($"build -c {buildConfiguration} {testAsset.TargetAssetPath}", failIfReturnValueIsNotZero: false, cancellationToken: TestContext.CancellationToken); compilationResult.AssertExitCodeIs(1); compilationResult.AssertOutputContains("Invalid value for property TestingExtensionsProfile. Valid values are 'Default', 'AllMicrosoft' and 'None'."); } @@ -311,7 +311,6 @@ public async Task NativeAot_Smoke_Test() DotnetMuxerResult compilationResult = await DotnetCli.RunAsync( $"publish -r {RID} -f {TargetFrameworks.NetCurrent} {testAsset.TargetAssetPath}", - AcceptanceFixture.NuGetGlobalPackagesFolder.Path, retryCount: 0, cancellationToken: TestContext.CancellationToken); compilationResult.AssertOutputContains("Generating native code"); @@ -332,7 +331,7 @@ public async Task SettingIsTestApplicationToFalseReducesAddedExtensionsAndMakesP .PatchCodeWithReplace("$TargetFramework$", TargetFrameworks.NetCurrent) .PatchCodeWithReplace("$ExtraProperties$", "false")); - DotnetMuxerResult compilationResult = await DotnetCli.RunAsync($"test {testAsset.TargetAssetPath}", AcceptanceFixture.NuGetGlobalPackagesFolder.Path, workingDirectory: testAsset.TargetAssetPath, cancellationToken: TestContext.CancellationToken); + DotnetMuxerResult compilationResult = await DotnetCli.RunAsync($"test {testAsset.TargetAssetPath}", workingDirectory: testAsset.TargetAssetPath, cancellationToken: TestContext.CancellationToken); compilationResult.AssertExitCodeIs(0); diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/ServerModeTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/ServerModeTests.cs index 08387d111c..7a15e7aa90 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/ServerModeTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/ServerModeTests.cs @@ -69,7 +69,7 @@ public async Task WhenClientDies_Server_ShouldClose_Gracefully(string tfm) Assert.AreEqual(3, exitCode); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { public const string ProjectName = "MSTestProject"; diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/SynchronizationContextTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/SynchronizationContextTests.cs index 754b314da9..6beaedc63a 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/SynchronizationContextTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/SynchronizationContextTests.cs @@ -39,7 +39,7 @@ public async Task SynchronizationContext_WhenSetInGlobalTestInitialize_IsPreserv testHostResult.AssertOutputContainsSummary(failed: 0, passed: 1, skipped: 0); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { public const string ProjectName = "SynchronizationContextProject"; diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TestContextTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TestContextTests.cs index b38d74836a..341b0330fa 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TestContextTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TestContextTests.cs @@ -79,7 +79,7 @@ public async Task TestContext_Current_ReturnsCorrectInstance(string tfm) testHostResult.AssertOutputContainsSummary(failed: 0, passed: 1, skipped: 0); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { public const string ProjectName = "TestTestContext"; diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TestDiscoveryTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TestDiscoveryTests.cs index b335ac7385..39bef8b3f2 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TestDiscoveryTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TestDiscoveryTests.cs @@ -40,7 +40,7 @@ public async Task DiscoverTests_WithFilter_FindsOnlyFilteredOnes(string currentT testHostResult.AssertOutputDoesNotContain("Test2"); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { public string TargetAssetPath => GetAssetPath(AssetName); diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TestDiscoveryWarningsTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TestDiscoveryWarningsTests.cs index a6aca74dc1..7e6aa9bf4e 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TestDiscoveryWarningsTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TestDiscoveryWarningsTests.cs @@ -47,7 +47,7 @@ public async Task DiscoverTests_ShowsWarningsForTestsThatFailedToDiscover(string } } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { public string TargetAssetPath => GetAssetPath(AssetName); diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TestFilterTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TestFilterTests.cs index 67682d5ce4..9a5d6f32cd 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TestFilterTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TestFilterTests.cs @@ -83,7 +83,7 @@ public async Task RunWithFilterFromRunsettings(string currentTfm) testHostResult.AssertExitCodeIs(ExitCodes.Success); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { public string TargetAssetPath => GetAssetPath(AssetName); diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TestRunParametersTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TestRunParametersTests.cs index b2662026a5..0895f15ff2 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TestRunParametersTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TestRunParametersTests.cs @@ -33,7 +33,7 @@ public async Task TestRunParameters_WhenProvidingMultipleMultipleTimesTheOptionA testHostResult.AssertOutputContainsSummary(failed: 0, passed: 1, skipped: 0); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { public const string ProjectName = "TestRunParameters"; diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/ThreadContextCultureFlowsInheritanceTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/ThreadContextCultureFlowsInheritanceTests.cs index 209743e275..ee76486166 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/ThreadContextCultureFlowsInheritanceTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/ThreadContextCultureFlowsInheritanceTests.cs @@ -52,7 +52,7 @@ public async Task ThreadingContext_Inheritance_WhenUsingTimeout_CurrentCultureFl testHostResult.AssertOutputContainsSummary(failed: 0, passed: 16, skipped: 0); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { public const string ProjectName = "CultureFlowsInheritanceThreadContextProject"; diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/ThreadContextCultureFlowsTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/ThreadContextCultureFlowsTests.cs index 3b77629534..792f9e7ccd 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/ThreadContextCultureFlowsTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/ThreadContextCultureFlowsTests.cs @@ -52,7 +52,7 @@ public async Task ThreadingContext_WhenUsingTimeout_CurrentCultureFlowsBetweenMe testHostResult.AssertOutputContainsSummary(failed: 0, passed: 1, skipped: 0); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { public const string ProjectName = "CultureFlowsThreadContextProject"; diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/ThreadContextTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/ThreadContextTests.cs index 17ba633939..baf9b47c8d 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/ThreadContextTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/ThreadContextTests.cs @@ -41,7 +41,7 @@ private static async Task SetCultureInFixtureMethodAndRunTests(string tfm, strin testHostResult.AssertOutputContainsSummary(failed: 0, passed: 2, skipped: 0); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { public const string InitToTestProjectName = "InitToTestThreadContextProject"; private const string InitToTestSourceCode = """ diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/ThreadingTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/ThreadingTests.cs index a007045375..91266f104a 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/ThreadingTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/ThreadingTests.cs @@ -72,7 +72,7 @@ public async Task TestMethodThreading_WhenMainIsNotSTA_RunsettingsAsksForMTA_Thr testHostResult.AssertOutputDoesNotContain("Runsettings entry 'STA' is not supported on non-Windows OSes"); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { public const string ProjectName = "TestThreading"; diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TimeoutTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TimeoutTests.cs index d64c9c15c4..d51273e54a 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TimeoutTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TimeoutTests.cs @@ -606,7 +606,7 @@ public async Task CooperativeTimeout_WhenMethodTimeoutAndWaitInTestMethod_TestGe testHostResult.AssertOutputContains("Test 'TestMethod' timed out after 1000ms"); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { public const string AssetName = "TimeoutTest"; public const string CodeWithOneSecTimeout = nameof(CodeWithOneSecTimeout); diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TrimTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TrimTests.cs index 0226b15693..1a64ba7326 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TrimTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TrimTests.cs @@ -58,12 +58,10 @@ public async Task Publish_ShouldNotProduceTrimWarnings(string tfm) await DotnetCli.RunAsync( $"restore {generator.TargetAssetPath} -r {RID}", - AcceptanceFixture.NuGetGlobalPackagesFolder.Path, retryCount: 0, cancellationToken: TestContext.CancellationToken); await DotnetCli.RunAsync( $"publish {generator.TargetAssetPath} -r {RID} -f {tfm}", - AcceptanceFixture.NuGetGlobalPackagesFolder.Path, retryCount: 0, cancellationToken: TestContext.CancellationToken); } diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TrxReportTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TrxReportTests.cs index 2943f72d25..36fba3ea14 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TrxReportTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TrxReportTests.cs @@ -40,7 +40,7 @@ public async Task TrxReport_WhenTestFails_ContainsExceptionInfoInOutput(string t Assert.Contains("at MSTestTrxReport.UnitTest1.FailingTest()", trxContent, trxContent); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { public const string ProjectName = "MSTestTrxReport"; diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TupleDynamicDataTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TupleDynamicDataTests.cs index fd87953f65..4b8137aa28 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TupleDynamicDataTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TupleDynamicDataTests.cs @@ -52,7 +52,7 @@ public async Task TupleSupportDoesNotBreakObjectArraySupport(string tfm) testHostResult.AssertOutputContainsSummary(failed: 0, passed: 1, skipped: 0); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { public const string ProjectName = "TupleDynamicDataTests"; diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/ValueTaskTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/ValueTaskTests.cs index 54ecbb6a4e..8ffd642f81 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/ValueTaskTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/ValueTaskTests.cs @@ -21,7 +21,7 @@ public async Task CanUseValueTaskForAllKnownLocations(string tfm) testHostResult.AssertOutputContainsSummary(failed: 1, passed: 2, skipped: 1); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { public const string ProjectName = "TestValueTask"; diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/WinUITests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/WinUITests.cs index b3a9d2f615..3b6fb2c1ce 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/WinUITests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/WinUITests.cs @@ -24,7 +24,7 @@ public async Task SimpleWinUITestCase() testHostResult.AssertOutputContainsSummary(failed: 0, passed: 1, skipped: 0); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { public const string ProjectName = "WinUITests"; diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/AbortionTests.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/AbortionTests.cs index 68713b2182..34cfd00522 100644 --- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/AbortionTests.cs +++ b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/AbortionTests.cs @@ -27,7 +27,7 @@ public async Task AbortWithCTRLPlusC_TestHost_Succeeded(string tfm) testHostResult.AssertOutputContainsSummary(failed: 0, passed: 0, skipped: 0, aborted: true); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { private const string Sources = """ #file Abort.csproj diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/ConsoleTests.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/ConsoleTests.cs index b2aa908dfd..99be67fcb3 100644 --- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/ConsoleTests.cs +++ b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/ConsoleTests.cs @@ -72,7 +72,7 @@ private async Task ConsoleTestsCoreAsync(string tfm, string? environmentVariable testHostResult.AssertOutputContains("ABCDEF123"); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { private const string Sources = """ #file ConsoleTests.csproj diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/CrashDumpTests.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/CrashDumpTests.cs index 259b52d09b..1780726c43 100644 --- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/CrashDumpTests.cs +++ b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/CrashDumpTests.cs @@ -54,7 +54,7 @@ public async Task CrashDump_InvalidFormat_ShouldFail() testHostResult.AssertOutputContains("Option '--crashdump-type' has invalid arguments: 'invalid' is not a valid dump type. Valid options are 'Mini', 'Heap', 'Triage' and 'Full'"); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { private const string AssetName = "CrashDumpFixture"; diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/CrashPlusHangDumpTests.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/CrashPlusHangDumpTests.cs index e62a5a263d..668fbf0088 100644 --- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/CrashPlusHangDumpTests.cs +++ b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/CrashPlusHangDumpTests.cs @@ -54,7 +54,7 @@ public async Task CrashPlusHangDump_InCaseOfHang_CreateHangDump() Assert.IsGreaterThan(0, Directory.GetFiles(resultDirectory, "CrashPlusHangDump*_hang.dmp", SearchOption.AllDirectories).Length, $"Dump file not found '{TargetFrameworks.NetCurrent}'\n{testHostResult}'"); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { private const string AssetName = "AssetFixture"; diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/CustomBannerTests.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/CustomBannerTests.cs index 52d363b1e9..743bc58d2e 100644 --- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/CustomBannerTests.cs +++ b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/CustomBannerTests.cs @@ -64,7 +64,7 @@ public async Task WithoutUsingNoBanner_TheBannerAppears(string tfm) testHostResult.AssertOutputMatchesRegex($"{TestAssetFixture.CustomBannerPrefix} Platform info: Name: Microsoft.Testing.Platform, Version: .+?, Hash: .*?, Date: .+?"); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { public const string CustomBannerPrefix = "Custom banner |"; diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/DataConsumerThroughputTests.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/DataConsumerThroughputTests.cs index 1a427bc1d2..52945bc5fa 100644 --- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/DataConsumerThroughputTests.cs +++ b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/DataConsumerThroughputTests.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace Microsoft.Testing.Platform.Acceptance.IntegrationTests; @@ -24,7 +24,7 @@ public async Task MultipleDataConsumers_ShouldCompleteInReasonableTime(string tf Assert.IsLessThan(7, stopwatch.Elapsed.TotalSeconds, testHostResult.ToString()); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { private const string TestCode = """ #file DataConsumerThroughputTests.csproj diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/DiagnosticTests.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/DiagnosticTests.cs index a66c565539..8609bd1491 100644 --- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/DiagnosticTests.cs +++ b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/DiagnosticTests.cs @@ -229,7 +229,7 @@ private static async Task AssertDiagnosticReportWasGeneratedAsync(TestHo return (Regex.IsMatch(content, pattern), content); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { private const string TestCode = """ #file DiagnosticTest.csproj diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/EnvironmentVariablesConfigurationProviderTests.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/EnvironmentVariablesConfigurationProviderTests.cs index 00349cccf4..4144401473 100644 --- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/EnvironmentVariablesConfigurationProviderTests.cs +++ b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/EnvironmentVariablesConfigurationProviderTests.cs @@ -62,7 +62,7 @@ public async Task TestHostMessesUpExitCode(string currentTfm) testHostResult.AssertExitCodeIs(ExitCodes.ZeroTests); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { private const string Sources = """ #file EnvironmentVariablesConfigurationProvider.csproj diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/ExecutionRequestCompleteTests.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/ExecutionRequestCompleteTests.cs index dd67f22e1f..b7eeef496c 100644 --- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/ExecutionRequestCompleteTests.cs +++ b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/ExecutionRequestCompleteTests.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace Microsoft.Testing.Platform.Acceptance.IntegrationTests; @@ -20,7 +20,7 @@ public async Task Exec_Honor_Request_Complete(string tfm) Assert.IsGreaterThan(3, stopwatch.Elapsed.TotalSeconds); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { private const string TestCode = """ #file ExecutionTests2.csproj diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/ExecutionTests.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/ExecutionTests.cs index 4f4e26133f..05928c17cc 100644 --- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/ExecutionTests.cs +++ b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/ExecutionTests.cs @@ -160,7 +160,7 @@ public async Task Exec_WhenListTestsAndMinimumExpectedTestsAreSpecified_Discover testHostResult.AssertOutputContains("Error: '--list-tests' and '--minimum-expected-tests' are incompatible options"); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { private const string TestCode = """ #file ExecutionTests.csproj diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/ExitOnProcessExitTests.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/ExitOnProcessExitTests.cs index b14ea8c35f..d73f792a90 100644 --- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/ExitOnProcessExitTests.cs +++ b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/ExitOnProcessExitTests.cs @@ -56,7 +56,7 @@ public void ExitOnProcessExit_Succeed(string tfm) } } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { private const string TestCode = """ #file ExecutionTests.csproj diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/ForwardCompatibilityTests.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/ForwardCompatibilityTests.cs index 47acfea2cf..b008ec6414 100644 --- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/ForwardCompatibilityTests.cs +++ b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/ForwardCompatibilityTests.cs @@ -24,7 +24,7 @@ public async Task NewerPlatform_WithPreviousExtensions_ShouldExecuteTests() Assert.IsNotEmpty(trxFiles, $"At least one TRX file should be generated in: {testResultsPath}"); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { private const string PreviousExtensionVersion = "2.0.0"; diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HangDumpOutputTests.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HangDumpOutputTests.cs index 1daa8ffc9e..fe68a8b9b1 100644 --- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HangDumpOutputTests.cs +++ b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HangDumpOutputTests.cs @@ -29,7 +29,7 @@ public async Task HangDump_Outputs_HangingTests_EvenWhenHangingTestsHaveTheSameD testHostResult.AssertOutputContains("Test1"); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { private const string AssetName = "AssetFixture"; diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HangDumpProcessTreeTests.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HangDumpProcessTreeTests.cs index 8449b3c0fa..258022c8bc 100644 --- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HangDumpProcessTreeTests.cs +++ b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HangDumpProcessTreeTests.cs @@ -25,7 +25,7 @@ public async Task HangDump_DumpAllChildProcesses_CreateDump(string tfm) Assert.HasCount(4, dumpFiles, $"There should be 4 dumps, one for each process in the tree. {testHostResult}"); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { private const string AssetName = "AssetFixture"; diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HangDumpTests.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HangDumpTests.cs index adb139ced3..a78bdf7a9f 100644 --- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HangDumpTests.cs +++ b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HangDumpTests.cs @@ -32,7 +32,6 @@ public async Task HangDump_WithDotnetTest_CreateDump() DotnetMuxerResult testResult = await DotnetCli.RunAsync( $"test --project \"{AssetFixture.TargetAssetPath}\" --no-build -c Release -f {TargetFrameworks.NetCurrent} --hangdump --hangdump-timeout 8s --results-directory \"{resultDirectory}\"", - AcceptanceFixture.NuGetGlobalPackagesFolder.Path, environmentVariables: new Dictionary { { "SLEEPTIMEMS1", "4000" }, @@ -54,7 +53,6 @@ public async Task HangDump_WithDotnetTest_NoHangButOverallTimeGreaterThanTimeout DotnetMuxerResult testResult = await DotnetCli.RunAsync( $"test --project \"{AssetFixture.TargetAssetPath}\" --no-build -c Release -f {TargetFrameworks.NetCurrent} --hangdump --hangdump-timeout 7s --results-directory \"{resultDirectory}\"", - AcceptanceFixture.NuGetGlobalPackagesFolder.Path, environmentVariables: new Dictionary { { "SLEEPTIMEMS1", "5000" }, @@ -176,7 +174,7 @@ public async Task HangDump_WithForegroundThreadAfterSessionFinish_CreateDump() Assert.ContainsSingle(dumpFiles, $"Expected single dump file. Found: {Environment.NewLine}{string.Join(Environment.NewLine, dumpFiles)}{Environment.NewLine}{testHostResult}"); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { private const string AssetName = "AssetFixture"; diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HelpInfoAllExtensionsTests.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HelpInfoAllExtensionsTests.cs index 1861bfa08f..61282dd87d 100644 --- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HelpInfoAllExtensionsTests.cs +++ b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HelpInfoAllExtensionsTests.cs @@ -388,7 +388,7 @@ Default type is 'Full' testHostResult.AssertOutputMatchesLines(wildcardPattern); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { public const string AllExtensionsAssetName = "AllExtensionsInfoTest"; diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HelpInfoTests.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HelpInfoTests.cs index dddd21066c..381e465371 100644 --- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HelpInfoTests.cs +++ b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HelpInfoTests.cs @@ -335,7 +335,7 @@ public async Task Info_DoesNotCreateTestResultsFolder(string tfm) Assert.IsFalse(Directory.Exists(testResultsPath), "TestResults folder should not be created for info command"); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { public const string NoExtensionAssetName = "NoExtensionInfoTest"; diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/Helpers/AcceptanceFixture.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/Helpers/AcceptanceFixture.cs index 573fd3456e..336b98dd07 100644 --- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/Helpers/AcceptanceFixture.cs +++ b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/Helpers/AcceptanceFixture.cs @@ -6,16 +6,7 @@ namespace Microsoft.Testing.Platform.Acceptance.IntegrationTests; [TestClass] public static class AcceptanceFixture { - public static TempDirectory NuGetGlobalPackagesFolder { get; private set; } = null!; - [AssemblyInitialize] public static void AssemblyInitialize(TestContext context) - { - NuGetGlobalPackagesFolder = new(".packages"); - Environment.SetEnvironmentVariable("MSBUILDDISABLENODEREUSE", "1"); - } - - [AssemblyCleanup] - public static void AssemblyCleanup() - => NuGetGlobalPackagesFolder.Dispose(); + => Environment.SetEnvironmentVariable("MSBUILDDISABLENODEREUSE", "1"); } diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/IgnoreExitCodeTests.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/IgnoreExitCodeTests.cs index 2b9204b1da..b183572e01 100644 --- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/IgnoreExitCodeTests.cs +++ b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/IgnoreExitCodeTests.cs @@ -99,8 +99,7 @@ public async Task If_IgnoreExitCode_Specified_Should_Return_Success_ExitCode(str .PatchCodeWithReplace("$MicrosoftTestingPlatformVersion$", MicrosoftTestingPlatformVersion)); string assetPath = generator.TargetAssetPath; - string globalPackagesPath = AcceptanceFixture.NuGetGlobalPackagesFolder.Path; - await DotnetCli.RunAsync($"build {assetPath} -c {buildConfiguration} -r {RID}", globalPackagesPath, cancellationToken: TestContext.CancellationToken); + await DotnetCli.RunAsync($"build {assetPath} -c {buildConfiguration} -r {RID}", cancellationToken: TestContext.CancellationToken); var host = TestInfrastructure.TestHost.LocateFrom(assetPath, AssetName, tfm, buildConfiguration: buildConfiguration); TestHostResult hostResult = await host.ExecuteAsync( command: commandLine, diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/LocalizationFailingTests.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/LocalizationFailingTests.cs index ed7498e330..78118b4281 100644 --- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/LocalizationFailingTests.cs +++ b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/LocalizationFailingTests.cs @@ -43,7 +43,7 @@ public async Task Execution_WithFailingTest_OutputContainsTranslatedFailureSumma AssertOutputContainsNormalized(testHostResult, "échec: 1"); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { public const string FailingAssetName = "LocalizationTestsFailing"; diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/LocalizationTests.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/LocalizationTests.cs index ff5ae25748..796f7c1dae 100644 --- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/LocalizationTests.cs +++ b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/LocalizationTests.cs @@ -106,7 +106,7 @@ public async Task Execution_WithTestingPlatformUILanguage_TakesPrecedenceOverDot AssertOutputDoesNotContainNormalized(testHostResult, "Resumen de la serie de pruebas:"); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { private const string TestCode = """ #file LocalizationTests.csproj diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/MSBuild.KnownExtensionRegistration.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/MSBuild.KnownExtensionRegistration.cs index 58df8c81f0..a069f5d16b 100644 --- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/MSBuild.KnownExtensionRegistration.cs +++ b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/MSBuild.KnownExtensionRegistration.cs @@ -19,7 +19,7 @@ public async Task Microsoft_Testing_Platform_Extensions_ShouldBe_Correctly_Regis SourceCode .PatchCodeWithReplace("$TargetFrameworks$", tfm) .PatchCodeWithReplace("$MicrosoftTestingPlatformVersion$", MicrosoftTestingPlatformVersion)); - DotnetMuxerResult result = await DotnetCli.RunAsync($"{(verb == Verb.publish ? $"publish -f {tfm}" : "build")} -c {compilationMode} -r {RID} {testAsset.TargetAssetPath} -v:n", AcceptanceFixture.NuGetGlobalPackagesFolder.Path, cancellationToken: TestContext.CancellationToken); + DotnetMuxerResult result = await DotnetCli.RunAsync($"{(verb == Verb.publish ? $"publish -f {tfm}" : "build")} -c {compilationMode} -r {RID} {testAsset.TargetAssetPath} -v:n", cancellationToken: TestContext.CancellationToken); string binlogFile = result.BinlogPath!; var testHost = TestInfrastructure.TestHost.LocateFrom(testAsset.TargetAssetPath, AssetName, tfm, rid: RID, verb: verb, buildConfiguration: compilationMode); diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/MSBuildTests.ConfigurationFile.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/MSBuildTests.ConfigurationFile.cs index 776e60a032..9334ebe3b3 100644 --- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/MSBuildTests.ConfigurationFile.cs +++ b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/MSBuildTests.ConfigurationFile.cs @@ -17,7 +17,7 @@ public async Task ConfigFileGeneration_CorrectlyCreateAndCacheAndCleaned(string .PatchCodeWithReplace("$JsonContent$", ConfigurationContent) .PatchCodeWithReplace("$MicrosoftTestingPlatformVersion$", MicrosoftTestingPlatformVersion)); - DotnetMuxerResult compilationResult = await DotnetCli.RunAsync($"{(verb == Verb.publish ? $"publish -f {tfm}" : "build")} -v:normal {testAsset.TargetAssetPath} -c {compilationMode}", AcceptanceFixture.NuGetGlobalPackagesFolder.Path, cancellationToken: TestContext.CancellationToken); + DotnetMuxerResult compilationResult = await DotnetCli.RunAsync($"{(verb == Verb.publish ? $"publish -f {tfm}" : "build")} -v:normal {testAsset.TargetAssetPath} -c {compilationMode}", cancellationToken: TestContext.CancellationToken); var testHost = TestInfrastructure.TestHost.LocateFrom(testAsset.TargetAssetPath, "MSBuildTests", tfm, verb: verb, buildConfiguration: compilationMode); string generatedConfigurationFile = Path.Combine(testHost.DirectoryName, "MSBuildTests.testconfig.json"); @@ -25,7 +25,7 @@ public async Task ConfigFileGeneration_CorrectlyCreateAndCacheAndCleaned(string Assert.AreEqual(ConfigurationContent.Trim(), File.ReadAllText(generatedConfigurationFile).Trim()); Assert.Contains("Microsoft Testing Platform configuration file written", compilationResult.StandardOutput); - compilationResult = await DotnetCli.RunAsync($"{(verb == Verb.publish ? $"publish -f {tfm}" : "build")} -v:normal {testAsset.TargetAssetPath} -c {compilationMode}", AcceptanceFixture.NuGetGlobalPackagesFolder.Path, cancellationToken: TestContext.CancellationToken); + compilationResult = await DotnetCli.RunAsync($"{(verb == Verb.publish ? $"publish -f {tfm}" : "build")} -v:normal {testAsset.TargetAssetPath} -c {compilationMode}", cancellationToken: TestContext.CancellationToken); Assert.IsTrue(File.Exists(generatedConfigurationFile)); Assert.AreEqual(ConfigurationContent.Trim(), File.ReadAllText(generatedConfigurationFile).Trim()); // Assert is failing, probably the MSBuild regression which is being fixed in https://github.com/dotnet/msbuild/pull/12431 ? @@ -36,7 +36,7 @@ public async Task ConfigFileGeneration_CorrectlyCreateAndCacheAndCleaned(string \s*_GenerateTestingPlatformConfigurationFileCore: \s*Skipping target "_GenerateTestingPlatformConfigurationFileCore" because all output files are up\-to\-date with respect to the input files\. """)); - await DotnetCli.RunAsync($"clean -c {compilationMode} -v:normal {testAsset.TargetAssetPath}", AcceptanceFixture.NuGetGlobalPackagesFolder.Path, cancellationToken: TestContext.CancellationToken); + await DotnetCli.RunAsync($"clean -c {compilationMode} -v:normal {testAsset.TargetAssetPath}", cancellationToken: TestContext.CancellationToken); // dotnet clean doesn't clean the publish output folder if (verb == Verb.build) @@ -58,7 +58,7 @@ public async Task ConfigFileGeneration_NoConfigurationFile_TaskWontRun(string tf File.Delete(Path.Combine(testAsset.TargetAssetPath, "testconfig.json")); - DotnetMuxerResult compilationResult = await DotnetCli.RunAsync($"{(verb == Verb.publish ? $"publish -f {tfm}" : "build")} -v:diagnostic {testAsset.TargetAssetPath} -c {compilationMode}", AcceptanceFixture.NuGetGlobalPackagesFolder.Path, cancellationToken: TestContext.CancellationToken); + DotnetMuxerResult compilationResult = await DotnetCli.RunAsync($"{(verb == Verb.publish ? $"publish -f {tfm}" : "build")} -v:diagnostic {testAsset.TargetAssetPath} -c {compilationMode}", cancellationToken: TestContext.CancellationToken); var testHost = TestInfrastructure.TestHost.LocateFrom(testAsset.TargetAssetPath, "MSBuildTests", tfm, verb: verb, buildConfiguration: compilationMode); diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/MSBuildTests.GenerateEntryPoint.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/MSBuildTests.GenerateEntryPoint.cs index b820c06af2..dfb13db03f 100644 --- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/MSBuildTests.GenerateEntryPoint.cs +++ b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/MSBuildTests.GenerateEntryPoint.cs @@ -22,7 +22,6 @@ public async Task When_GenerateTestingPlatformEntryPoint_IsFalse_NoEntryPointInj DotnetMuxerResult compilationResult = await DotnetCli.RunAsync( $"{(verb == Verb.publish ? $"publish -f {tfm}" : "build")} -c {compilationMode} -r {RID} -p:GenerateTestingPlatformEntryPoint=False {testAsset.TargetAssetPath} -v:n", - AcceptanceFixture.NuGetGlobalPackagesFolder.Path, failIfReturnValueIsNotZero: false, cancellationToken: TestContext.CancellationToken); SL.Build binLog = SL.Serialization.Read(compilationResult.BinlogPath!); @@ -134,7 +133,7 @@ private async Task GenerateAndVerifyLanguageSpecificEntryPointAsync(string asset .PatchCodeWithReplace("$MicrosoftTestingPlatformVersion$", MicrosoftTestingPlatformVersion); using TestAsset testAsset = await TestAsset.GenerateAssetAsync(assetName, finalSourceCode); - DotnetMuxerResult buildResult = await DotnetCli.RunAsync($"{(verb == Verb.publish ? $"publish -f {tfm}" : "build")} -c {compilationMode} -r {RID} {testAsset.TargetAssetPath} -v:n", AcceptanceFixture.NuGetGlobalPackagesFolder.Path, cancellationToken: TestContext.CancellationToken); + DotnetMuxerResult buildResult = await DotnetCli.RunAsync($"{(verb == Verb.publish ? $"publish -f {tfm}" : "build")} -c {compilationMode} -r {RID} {testAsset.TargetAssetPath} -v:n", cancellationToken: TestContext.CancellationToken); SL.Build binLog = SL.Serialization.Read(buildResult.BinlogPath!); SL.Target[] generateTestingPlatformEntryPointTargets = binLog.FindChildrenRecursive().Where(t => t.Name == "_GenerateTestingPlatformEntryPoint").ToArray(); Assert.HasCount(1, generateTestingPlatformEntryPointTargets, "Expected exactly one _GenerateTestingPlatformEntryPoint target"); @@ -162,7 +161,7 @@ private async Task GenerateAndVerifyLanguageSpecificEntryPointAsync(string asset Assert.IsNotNull(sourceFilePathInObj); File.Delete(buildResult.BinlogPath!); - buildResult = await DotnetCli.RunAsync($"{(verb == Verb.publish ? $"publish -f {tfm}" : "build")} -c {compilationMode} -r {RID} {testAsset.TargetAssetPath} -v:n", AcceptanceFixture.NuGetGlobalPackagesFolder.Path, cancellationToken: TestContext.CancellationToken); + buildResult = await DotnetCli.RunAsync($"{(verb == Verb.publish ? $"publish -f {tfm}" : "build")} -c {compilationMode} -r {RID} {testAsset.TargetAssetPath} -v:n", cancellationToken: TestContext.CancellationToken); binLog = SL.Serialization.Read(buildResult.BinlogPath!); generateTestingPlatformEntryPointTargets = binLog.FindChildrenRecursive().Where(t => t.Name == "_GenerateTestingPlatformEntryPoint" && t.Children.Count > 0).ToArray(); Assert.HasCount(1, generateTestingPlatformEntryPointTargets, "Expected exactly one _GenerateTestingPlatformEntryPoint target with children on rebuild"); diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/MSBuildTests.Solution.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/MSBuildTests.Solution.cs index e593906c77..2660b93313 100644 --- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/MSBuildTests.Solution.cs +++ b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/MSBuildTests.Solution.cs @@ -45,9 +45,9 @@ public async Task MSBuildTests_UseMSBuildTestInfrastructure_Should_Run_Solution_ } // Build the solution - DotnetMuxerResult restoreResult = await DotnetCli.RunAsync($"restore {solution.SolutionFile} --configfile {nugetFile}", AcceptanceFixture.NuGetGlobalPackagesFolder.Path, cancellationToken: TestContext.CancellationToken); + DotnetMuxerResult restoreResult = await DotnetCli.RunAsync($"restore {solution.SolutionFile} --configfile {nugetFile}", cancellationToken: TestContext.CancellationToken); restoreResult.AssertOutputDoesNotContain("An approximate best match of"); - DotnetMuxerResult testResult = await DotnetCli.RunAsync($"build --no-restore -t:Test -p:UseMSBuildTestInfrastructure=true {solution.SolutionFile}", AcceptanceFixture.NuGetGlobalPackagesFolder.Path, workingDirectory: solution.FolderPath, cancellationToken: TestContext.CancellationToken); + DotnetMuxerResult testResult = await DotnetCli.RunAsync($"build --no-restore -t:Test -p:UseMSBuildTestInfrastructure=true {solution.SolutionFile}", workingDirectory: solution.FolderPath, cancellationToken: TestContext.CancellationToken); if (isMultiTfm) { diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/MSBuildTests.Test.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/MSBuildTests.Test.cs index ccd340b91f..1b8c2acf77 100644 --- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/MSBuildTests.Test.cs +++ b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/MSBuildTests.Test.cs @@ -53,7 +53,7 @@ private async Task InvokeTestingPlatform_Target_Should_Execute_Tests_Without_Sho .PatchCodeWithReplace("$AssertValue$", testSucceeded.ToString().ToLowerInvariant()) .PatchCodeWithReplace("$MicrosoftTestingPlatformVersion$", MicrosoftTestingPlatformVersion)); string testResultFolder = Path.Combine(testAsset.TargetAssetPath, Guid.NewGuid().ToString("N")); - DotnetMuxerResult compilationResult = await DotnetCli.RunAsync($"{testCommand} -p:TestingPlatformCommandLineArguments=\"--results-directory %22{testResultFolder}%22\" -p:Configuration={compilationMode} \"{testAsset.TargetAssetPath}\"", AcceptanceFixture.NuGetGlobalPackagesFolder.Path, workingDirectory: testAsset.TargetAssetPath, failIfReturnValueIsNotZero: false, cancellationToken: TestContext.CancellationToken); + DotnetMuxerResult compilationResult = await DotnetCli.RunAsync($"{testCommand} -p:TestingPlatformCommandLineArguments=\"--results-directory %22{testResultFolder}%22\" -p:Configuration={compilationMode} \"{testAsset.TargetAssetPath}\"", workingDirectory: testAsset.TargetAssetPath, failIfReturnValueIsNotZero: false, cancellationToken: TestContext.CancellationToken); foreach (string tfmToAssert in tfmsToAssert) { @@ -85,11 +85,9 @@ private async Task InvokeTestingPlatform_Target_Should_Build_Without_Warnings_An DotnetMuxerResult compilationResult = testCommand.StartsWith("test", StringComparison.OrdinalIgnoreCase) ? await DotnetCli.RunAsync( $"{testCommand} -p:Configuration={compilationMode} \"{testAsset.TargetAssetPath}\" -- --treenode-filter --results-directory \"{testResultFolder}\"", - AcceptanceFixture.NuGetGlobalPackagesFolder.Path, workingDirectory: testAsset.TargetAssetPath, cancellationToken: TestContext.CancellationToken) : await DotnetCli.RunAsync( $"{testCommand} -p:TestingPlatformCommandLineArguments=\"--treenode-filter --results-directory \"{testResultFolder}\"\" -p:Configuration={compilationMode} \"{testAsset.TargetAssetPath}\"", - AcceptanceFixture.NuGetGlobalPackagesFolder.Path, workingDirectory: testAsset.TargetAssetPath, cancellationToken: TestContext.CancellationToken); foreach (string tfmToAssert in tfmsToAssert) @@ -144,7 +142,6 @@ public async Task Invoke_TestTarget_With_Arch_Switch_x86_Should_Work() .PatchCodeWithReplace("$MicrosoftTestingPlatformVersion$", MicrosoftTestingPlatformVersion)); await DotnetCli.RunAsync( $"build -t:Test --arch x86 -p:Configuration=Release \"{testAsset.TargetAssetPath}\"", - AcceptanceFixture.NuGetGlobalPackagesFolder.Path, workingDirectory: testAsset.TargetAssetPath, environmentVariables: dotnetRootX86, failIfReturnValueIsNotZero: false, @@ -179,7 +176,6 @@ public async Task Invoke_TestTarget_With_Incompatible_Arch() .PatchCodeWithReplace("$MicrosoftTestingPlatformVersion$", MicrosoftTestingPlatformVersion)); DotnetMuxerResult result = await DotnetCli.RunAsync( $"build -t:Test --arch {incompatibleArchitecture} \"{testAsset.TargetAssetPath}\"", - AcceptanceFixture.NuGetGlobalPackagesFolder.Path, workingDirectory: testAsset.TargetAssetPath, failIfReturnValueIsNotZero: false, cancellationToken: TestContext.CancellationToken); @@ -231,7 +227,6 @@ public async Task Invoke_TestTarget_With_DOTNET_HOST_PATH_Should_Work() .PatchCodeWithReplace("$MicrosoftTestingPlatformVersion$", MicrosoftTestingPlatformVersion)); await DotnetCli.RunAsync( $"build -t:Test -p:Configuration=Release \"{testAsset.TargetAssetPath}\"", - AcceptanceFixture.NuGetGlobalPackagesFolder.Path, workingDirectory: testAsset.TargetAssetPath, environmentVariables: dotnetHostPathEnvVar, failIfReturnValueIsNotZero: false, @@ -281,7 +276,7 @@ public async Task InvokeTestingPlatform_Target_Showing_Error_And_Do_Not_Capture_ .PatchCodeWithReplace("$TargetFrameworks$", $"{tfm}") .PatchCodeWithReplace("$AssertValue$", testSucceeded.ToString().ToLowerInvariant()) .PatchCodeWithReplace("$MicrosoftTestingPlatformVersion$", MicrosoftTestingPlatformVersion)); - DotnetMuxerResult compilationResult = await DotnetCli.RunAsync($"{testCommand} -p:TestingPlatformShowTestsFailure=True -p:TestingPlatformCaptureOutput=False -p:Configuration={compilationMode} {testAsset.TargetAssetPath}", AcceptanceFixture.NuGetGlobalPackagesFolder.Path, workingDirectory: testAsset.TargetAssetPath, failIfReturnValueIsNotZero: false, cancellationToken: TestContext.CancellationToken); + DotnetMuxerResult compilationResult = await DotnetCli.RunAsync($"{testCommand} -p:TestingPlatformShowTestsFailure=True -p:TestingPlatformCaptureOutput=False -p:Configuration={compilationMode} {testAsset.TargetAssetPath}", workingDirectory: testAsset.TargetAssetPath, failIfReturnValueIsNotZero: false, cancellationToken: TestContext.CancellationToken); compilationResult.AssertOutputContains("error test failed: Test2 ("); compilationResult.AssertOutputContains("FAILED: Expected 'true', but got 'false'."); @@ -298,7 +293,7 @@ public async Task TestingPlatformDisableCustomTestTarget_Should_Cause_UserDefine .PatchCodeWithReplace("$TargetFrameworks$", $"{TargetFrameworks.NetCurrent}") .PatchCodeWithReplace("$AssertValue$", "true") .PatchCodeWithReplace("$MicrosoftTestingPlatformVersion$", MicrosoftTestingPlatformVersion)); - DotnetMuxerResult compilationResult = await DotnetCli.RunAsync($"build {testAsset.TargetAssetPath} -p:TestingPlatformDisableCustomTestTarget=true -p:ImportUserDefinedTestTarget=true -t:\"Build;Test\"", AcceptanceFixture.NuGetGlobalPackagesFolder.Path, failIfReturnValueIsNotZero: false, cancellationToken: TestContext.CancellationToken); + DotnetMuxerResult compilationResult = await DotnetCli.RunAsync($"build {testAsset.TargetAssetPath} -p:TestingPlatformDisableCustomTestTarget=true -p:ImportUserDefinedTestTarget=true -t:\"Build;Test\"", failIfReturnValueIsNotZero: false, cancellationToken: TestContext.CancellationToken); compilationResult.AssertOutputContains("Error from UserDefinedTestTarget.targets"); } diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/MaxFailedTestsExtensionTests.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/MaxFailedTestsExtensionTests.cs index 528de217d2..de89eb7ab1 100644 --- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/MaxFailedTestsExtensionTests.cs +++ b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/MaxFailedTestsExtensionTests.cs @@ -36,7 +36,7 @@ public async Task WhenCapabilityIsMissingShouldFail() testHostResult.AssertOutputContains("The current test framework does not implement 'IGracefulStopTestExecutionCapability' which is required for '--maximum-failed-tests' feature."); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { private const string Sources = """ #file MaxFailedTestsExtensionTests.csproj diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/NativeAotTests.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/NativeAotTests.cs index 8ab182749e..e4acea3c4c 100644 --- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/NativeAotTests.cs +++ b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/NativeAotTests.cs @@ -87,7 +87,6 @@ public async Task NativeAotTests_WillRunWithExitCodeZero(string tfm) DotnetMuxerResult compilationResult = await DotnetCli.RunAsync( $"publish {generator.TargetAssetPath} -r {RID}", - AcceptanceFixture.NuGetGlobalPackagesFolder.Path, retryCount: 0, cancellationToken: TestContext.CancellationToken); compilationResult.AssertOutputContains("Generating native code"); diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/NoBannerTests.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/NoBannerTests.cs index f3776e8d31..f33b08985a 100644 --- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/NoBannerTests.cs +++ b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/NoBannerTests.cs @@ -65,7 +65,7 @@ public async Task WithoutUsingNoBanner_TheBannerAppears(string tfm) testHostResult.AssertOutputMatchesRegex(_bannerRegexMatchPattern); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { private const string NoBannerTestCode = """ #file NoBannerTest.csproj diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/RetryFailedTestsTests.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/RetryFailedTestsTests.cs index a74623bbf7..b59784f054 100644 --- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/RetryFailedTestsTests.cs +++ b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/RetryFailedTestsTests.cs @@ -187,7 +187,6 @@ public async Task RetryFailedTests_PassingFromFirstTime_UsingTestTarget_MoveFile DotnetMuxerResult result = await DotnetCli.RunAsync( $"build \"{AssetFixture.TargetAssetPath}\" -c Release -t:DispatchToInnerBuildsWithMTPTestTarget -p:TestingPlatformCommandLineArguments=\"--retry-failed-tests 1 --results-directory %22{resultDirectory}%22\"", - AcceptanceFixture.NuGetGlobalPackagesFolder.Path, workingDirectory: AssetFixture.TargetAssetPath, cancellationToken: TestContext.CancellationToken); result.AssertExitCodeIs(ExitCodes.Success); @@ -205,7 +204,7 @@ public async Task RetryFailedTests_PassingFromFirstTime_UsingTestTarget_MoveFile } } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { public string TargetAssetPath => GetAssetPath(AssetName); diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/ServerLoggingTests.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/ServerLoggingTests.cs index c3f6254533..14f5c6ba99 100644 --- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/ServerLoggingTests.cs +++ b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/ServerLoggingTests.cs @@ -78,7 +78,7 @@ public async Task RunningInServerMode_BannerIsSkipped() await jsonClient.Exit(); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { private const string AssetName = "AssetFixture"; diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/TelemetryDisabledTests.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/TelemetryDisabledTests.cs index 77ff118e29..279c37c2b7 100644 --- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/TelemetryDisabledTests.cs +++ b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/TelemetryDisabledTests.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.Testing.Platform.Configurations; @@ -55,7 +55,7 @@ private static async Task AssertDiagnosticReportAsync(TestHostResult tes return (Regex.IsMatch(content, pattern), content); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { private const string WithoutTelemetry = nameof(WithoutTelemetry); diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/TelemetryTests.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/TelemetryTests.cs index 301db49a0e..81c1c940b7 100644 --- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/TelemetryTests.cs +++ b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/TelemetryTests.cs @@ -111,7 +111,7 @@ private static async Task AssertDiagnosticReportAsync(TestHostResult tes return (Regex.IsMatch(content, pattern), content); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { private const string WithTelemetry = nameof(WithTelemetry); diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/TestHostProcessLifetimeHandlerTests.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/TestHostProcessLifetimeHandlerTests.cs index b09d1975a2..695acd4bbf 100644 --- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/TestHostProcessLifetimeHandlerTests.cs +++ b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/TestHostProcessLifetimeHandlerTests.cs @@ -20,7 +20,7 @@ public async Task All_Interface_Methods_ShouldBe_Invoked(string currentTfm) Assert.AreEqual("TestHostProcessLifetimeHandler.OnTestHostProcessExitedAsync", File.ReadAllText(Path.Combine(testHost.DirectoryName, "OnTestHostProcessExitedAsync.txt"))); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { private const string Sources = """ #file TestHostProcessLifetimeHandler.csproj diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/TimeoutTests.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/TimeoutTests.cs index c85a264d61..ea7bed4e1a 100644 --- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/TimeoutTests.cs +++ b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/TimeoutTests.cs @@ -83,7 +83,7 @@ public async Task TimeoutWithValidArg_WithHourAsSuffix_WithTestNotTimeOut_Output testHostResult.AssertOutputDoesNotContain("Canceling the test session"); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { public const string AssetName = "TimeoutTest"; diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/TrimTests.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/TrimTests.cs index 06d71cd477..aa72cc5ba1 100644 --- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/TrimTests.cs +++ b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/TrimTests.cs @@ -49,7 +49,6 @@ public async Task Publish_ShouldNotProduceTrimWarnings(string tfm) await DotnetCli.RunAsync( $"publish {generator.TargetAssetPath} -r {RID}", - AcceptanceFixture.NuGetGlobalPackagesFolder.Path, retryCount: 0, cancellationToken: TestContext.CancellationToken); } diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/TrxDataRowTests.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/TrxDataRowTests.cs index b24ba7fd15..84e3ca34ff 100644 --- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/TrxDataRowTests.cs +++ b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/TrxDataRowTests.cs @@ -47,7 +47,7 @@ private static async Task CheckTrxContentsMatchAsync(string path, string p return Regex.IsMatch(await reader.ReadToEndAsync(), pattern); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { public const string AssetNameUsingMSTest = "TrxTestUsingMSTest"; private const string WithDataRow = nameof(WithDataRow); diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/TrxFailingTestTests.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/TrxFailingTestTests.cs index 067990f55b..f43277554c 100644 --- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/TrxFailingTestTests.cs +++ b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/TrxFailingTestTests.cs @@ -38,7 +38,7 @@ public async Task Trx_WhenTestFails_ContainsExceptionInfoInOutput(string tfm) Assert.Contains("at DummyTestFramework.ExecuteRequestAsync", trxContent, trxContent); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { public const string AssetName = "TrxTest"; private const string WithFailingTest = nameof(WithFailingTest); diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/TrxSkippedTestTests.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/TrxSkippedTestTests.cs index 0d2a6a76f7..c02021dfba 100644 --- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/TrxSkippedTestTests.cs +++ b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/TrxSkippedTestTests.cs @@ -53,7 +53,7 @@ public async Task Trx_UsingDataDriven_CreatesUnitTestTagForEachOneInsideTheTrx(s Assert.IsTrue(Regex.IsMatch(trxContent, trxContentsPattern)); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { public const string AssetNameUsingMSTest = "TrxTestUsingMSTest"; private const string WithSkippedTest = nameof(WithSkippedTest); diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/TrxTests.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/TrxTests.cs index 7f867b9c21..9860d5254e 100644 --- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/TrxTests.cs +++ b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/TrxTests.cs @@ -65,7 +65,6 @@ public async Task Trx_WhenTestHostCrash_RunningUnderDotnetTest_ErrorIsDisplayedI DotnetMuxerResult result = await DotnetCli.RunAsync( $"test --project \"{AssetFixture.TargetAssetPath}\" --no-build -c Release -f {tfm} --crashdump --report-trx --report-trx-filename {fileName}.trx --results-directory \"{testResultsPath}\"", - AcceptanceFixture.NuGetGlobalPackagesFolder.Path, workingDirectory: AssetFixture.TargetAssetPath, environmentVariables: new() { { "CRASHPROCESS", "1" } }, failIfReturnValueIsNotZero: false, @@ -173,7 +172,7 @@ private static async Task CheckTrxContentsMatchAsync(string path, string p return Regex.IsMatch(await reader.ReadToEndAsync(), pattern); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { public const string AssetName = "TrxTest"; diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/TypeForwardingTests.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/TypeForwardingTests.cs index 1da6bef30c..67aa81c055 100644 --- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/TypeForwardingTests.cs +++ b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/TypeForwardingTests.cs @@ -68,7 +68,7 @@ public async Task SettingDisplayNameFromNetStandardLibraryDuringNetCurrentRuntim .PatchCodeWithReplace("$MicrosoftTestingPlatformVersion$", MicrosoftTestingPlatformVersion); using TestAsset testAsset = await TestAsset.GenerateAssetAsync(AssetName, patchedSources); - await DotnetCli.RunAsync($"build {testAsset.TargetAssetPath}/ConsoleApp -c Release", AcceptanceFixture.NuGetGlobalPackagesFolder.Path, cancellationToken: TestContext.CancellationToken); + await DotnetCli.RunAsync($"build {testAsset.TargetAssetPath}/ConsoleApp -c Release", cancellationToken: TestContext.CancellationToken); var testHost = TestInfrastructure.TestHost.LocateFrom($"{testAsset.TargetAssetPath}/ConsoleApp", "ConsoleApp", TargetFrameworks.NetCurrent); TestHostResult testHostResult = await testHost.ExecuteAsync(cancellationToken: TestContext.CancellationToken); diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/UnhandledExceptionPolicyTests.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/UnhandledExceptionPolicyTests.cs index b1675e268f..f8eb69df25 100644 --- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/UnhandledExceptionPolicyTests.cs +++ b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/UnhandledExceptionPolicyTests.cs @@ -157,7 +157,7 @@ public async Task UnhandledExceptionPolicy_EnvironmentVariable_UnhandledExceptio } } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture() : TestAssetFixtureBase() { private const string AssetName = "UnhandledExceptionPolicyTests"; diff --git a/test/Performance/MSTest.Performance.Runner/Steps/DotnetMuxer.cs b/test/Performance/MSTest.Performance.Runner/Steps/DotnetMuxer.cs index 71a40f3f27..5b19dba9e8 100644 --- a/test/Performance/MSTest.Performance.Runner/Steps/DotnetMuxer.cs +++ b/test/Performance/MSTest.Performance.Runner/Steps/DotnetMuxer.cs @@ -20,10 +20,9 @@ public async Task ExecuteAsync(SingleProject payload, IContext co throw new NotSupportedException(); } - string nugetRestoreFolder = Path.Combine(payload.TestAsset.TargetAssetPath, ".packages"); string buildCommand = $"build {payload.TestAsset.TargetAssetPath} -c {_buildConfiguration}"; Console.WriteLine($"Building: '{buildCommand}'"); - await DotnetCli.RunAsync(buildCommand, nugetRestoreFolder); + await DotnetCli.RunAsync(buildCommand); var testHost = TestHost.LocateFrom(payload.TestAsset.TargetAssetPath, payload.AssetName, payload.Tfms.Single(), buildConfiguration: _buildConfiguration); return new BuildArtifact(testHost, payload.TestAsset); } diff --git a/test/Performance/MSTest.Performance.Runner/Steps/DotnetTrace.cs b/test/Performance/MSTest.Performance.Runner/Steps/DotnetTrace.cs index 5742d70b20..7c67087ec3 100644 --- a/test/Performance/MSTest.Performance.Runner/Steps/DotnetTrace.cs +++ b/test/Performance/MSTest.Performance.Runner/Steps/DotnetTrace.cs @@ -24,8 +24,7 @@ public DotnetTrace(string arguments, string reportFileName, CompressionLevel com public async Task ExecuteAsync(BuildArtifact payload, IContext context) { - string nugetRestoreFolder = Path.Combine(payload.TestAsset.TargetAssetPath, ".packages"); - await DotnetCli.RunAsync($"tool install --tool-path \"{payload.TestAsset.TargetAssetPath}\" dotnet-trace", nugetRestoreFolder); + await DotnetCli.RunAsync($"tool install --tool-path \"{payload.TestAsset.TargetAssetPath}\" dotnet-trace"); string dotnetTrace = Path.Combine(payload.TestAsset.TargetAssetPath, "dotnet-trace" + (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? ".exe" : string.Empty)); diff --git a/test/Utilities/Microsoft.Testing.TestInfrastructure/DotnetCli.cs b/test/Utilities/Microsoft.Testing.TestInfrastructure/DotnetCli.cs index 6b89e1600a..af080999b7 100644 --- a/test/Utilities/Microsoft.Testing.TestInfrastructure/DotnetCli.cs +++ b/test/Utilities/Microsoft.Testing.TestInfrastructure/DotnetCli.cs @@ -48,7 +48,6 @@ public static int MaxOutstandingCommands public static async Task RunAsync( string args, - string nugetGlobalPackagesFolder, string? workingDirectory = null, Dictionary? environmentVariables = null, bool failIfReturnValueIsNotZero = true, @@ -94,8 +93,6 @@ public static async Task RunAsync( environmentVariables.Add("DOTNET_CLI_TELEMETRY_OPTOUT", "1"); } - environmentVariables["NUGET_PACKAGES"] = nugetGlobalPackagesFolder; - string extraArgs = warnAsError ? " -p:MSBuildTreatWarningsAsErrors=true -p:TreatWarningsAsErrors=true" : string.Empty; extraArgs += suppressPreviewDotNetMessage ? " -p:SuppressNETCoreSdkPreviewMessage=true" : string.Empty; if (args.IndexOf("-- ", StringComparison.Ordinal) is int platformArgsIndex && platformArgsIndex > 0) diff --git a/test/Utilities/Microsoft.Testing.TestInfrastructure/TestAsset.cs b/test/Utilities/Microsoft.Testing.TestInfrastructure/TestAsset.cs index 61b0849333..fc48834022 100644 --- a/test/Utilities/Microsoft.Testing.TestInfrastructure/TestAsset.cs +++ b/test/Utilities/Microsoft.Testing.TestInfrastructure/TestAsset.cs @@ -135,9 +135,6 @@ public static string GetNuGetConfig(bool addPublicFeeds = false, bool addHashFil - - - {publicFeedsMapping} diff --git a/test/Utilities/Microsoft.Testing.TestInfrastructure/TestAssetFixtureBase.cs b/test/Utilities/Microsoft.Testing.TestInfrastructure/TestAssetFixtureBase.cs index 5178272cca..fcac9b1078 100644 --- a/test/Utilities/Microsoft.Testing.TestInfrastructure/TestAssetFixtureBase.cs +++ b/test/Utilities/Microsoft.Testing.TestInfrastructure/TestAssetFixtureBase.cs @@ -21,12 +21,8 @@ public abstract class TestAssetFixtureBase : ITestAssetFixture { private readonly ConcurrentDictionary _testAssets = new(); private readonly TempDirectory _tempDirectory = new(); - private readonly TempDirectory _nugetGlobalPackagesDirectory; private bool _disposedValue; - protected TestAssetFixtureBase(TempDirectory nugetGlobalPackagesDirectory) - => _nugetGlobalPackagesDirectory = nugetGlobalPackagesDirectory; - public string GetAssetPath(string assetID) => !_testAssets.TryGetValue(assetID, out TestAsset? testAsset) ? throw new ArgumentNullException(nameof(assetID), $"Cannot find target path for test asset '{assetID}'") @@ -38,7 +34,7 @@ public async Task InitializeAsync(CancellationToken cancellationToken) => await Parallel.ForEachAsync(GetAssetsToGenerate(), async (asset, _) => { TestAsset testAsset = await TestAsset.GenerateAssetAsync(asset.ID, asset.Code, _tempDirectory); - DotnetMuxerResult result = await DotnetCli.RunAsync($"build {testAsset.TargetAssetPath} -c Release", _nugetGlobalPackagesDirectory.Path, callerMemberName: asset.Name, cancellationToken: cancellationToken); + DotnetMuxerResult result = await DotnetCli.RunAsync($"build {testAsset.TargetAssetPath} -c Release", callerMemberName: asset.Name, cancellationToken: cancellationToken); testAsset.DotnetResult = result; _testAssets.TryAdd(asset.ID, testAsset); }); @@ -46,7 +42,7 @@ await Parallel.ForEachAsync(GetAssetsToGenerate(), async (asset, _) => await Task.WhenAll(GetAssetsToGenerate().Select(async asset => { TestAsset testAsset = await TestAsset.GenerateAssetAsync(asset.Name, asset.Code, _tempDirectory); - DotnetMuxerResult result = await DotnetCli.RunAsync($"build {testAsset.TargetAssetPath} -c Release", _nugetGlobalPackagesDirectory.Path, callerMemberName: asset.Name, cancellationToken: cancellationToken); + DotnetMuxerResult result = await DotnetCli.RunAsync($"build {testAsset.TargetAssetPath} -c Release", callerMemberName: asset.Name, cancellationToken: cancellationToken); testAsset.DotnetResult = result; _testAssets.TryAdd(asset.ID, testAsset); })); From 6674b9ea69e9cc4f56200b23a86340b7ebc209d6 Mon Sep 17 00:00:00 2001 From: Youssef1313 Date: Tue, 24 Mar 2026 12:41:30 +0100 Subject: [PATCH 2/5] Fix build errors after last merge --- .../TimeoutCooperativeCancellationTests.cs | 2 +- .../TimeoutCooperativeTestMethodTests.cs | 2 +- .../TimeoutFromRunSettingsTests.cs | 2 +- .../TimeoutTestMethodTests.cs | 2 +- .../MSTest.Acceptance.IntegrationTests/TimeoutTests.cs | 2 +- .../TimeoutWhenCanceledTests.cs | 2 +- .../TimeoutWhenExpiresTests.cs | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TimeoutCooperativeCancellationTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TimeoutCooperativeCancellationTests.cs index f05652755d..ac2a78dcc7 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TimeoutCooperativeCancellationTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TimeoutCooperativeCancellationTests.cs @@ -196,7 +196,7 @@ public async Task CooperativeCancellation_WhenTestCleanupTimeoutExpiresAndUserCh testHostResult.AssertOutputContains("Test cleanup method 'TestClass.TestCleanup' timed out after 1000ms"); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture : TestAssetFixtureBase { public const string ProjectName = "TimeoutCooperativeTimeout"; diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TimeoutCooperativeTestMethodTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TimeoutCooperativeTestMethodTests.cs index 6bc8b552b7..437d80b1aa 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TimeoutCooperativeTestMethodTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TimeoutCooperativeTestMethodTests.cs @@ -74,7 +74,7 @@ public async Task CooperativeTimeout_WhenMethodTimeoutAndWaitInTestMethod_TestGe testHostResult.AssertOutputContains("Test 'TestMethod' timed out after 1000ms"); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture : TestAssetFixtureBase { public const string ProjectName = "TimeoutCooperativeTestMethodTimeout"; diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TimeoutFromRunSettingsTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TimeoutFromRunSettingsTests.cs index 3923cc0295..0b7d4e49c7 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TimeoutFromRunSettingsTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TimeoutFromRunSettingsTests.cs @@ -84,7 +84,7 @@ private static async Task RunAndAssertFromRunSettingsAsync(string tfm, string en testHostResult.AssertOutputContains($"{InfoByKind[entryKind].Prefix} method '{InfoByKind[entryKind].MethodFullName}' timed out after {timeoutValue}ms"); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture : TestAssetFixtureBase { public const string ProjectName = "TimeoutCodeWithNoTimeout"; diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TimeoutTestMethodTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TimeoutTestMethodTests.cs index 82a6f3afb7..ea164974ad 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TimeoutTestMethodTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TimeoutTestMethodTests.cs @@ -74,7 +74,7 @@ public async Task Timeout_WhenMethodTimeoutAndWaitInTestMethod_TestGetsCanceled( testHostResult.AssertOutputContains("Test 'TestMethod' timed out after 1000ms"); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture : TestAssetFixtureBase { public const string ProjectName = "TimeoutTestMethodTimeout"; diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TimeoutTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TimeoutTests.cs index 5958a3d9b3..1e7dbe6ae5 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TimeoutTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TimeoutTests.cs @@ -66,7 +66,7 @@ public async Task Timeout_WhenTimeoutValueGreaterThanTestDuration_OutputDoesNotC testHostResult.AssertOutputDoesNotContain("Canceling the test session"); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture : TestAssetFixtureBase { public const string ProjectName = "TimeoutTest"; diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TimeoutWhenCanceledTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TimeoutWhenCanceledTests.cs index 99a539d2fd..112314e7fd 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TimeoutWhenCanceledTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TimeoutWhenCanceledTests.cs @@ -38,7 +38,7 @@ private static async Task RunAndAssertTestWasCanceledAsync(string tfm, string en testHostResult.AssertOutputContains($"{InfoByKind[entryKind].Prefix} method '{InfoByKind[entryKind].MethodFullName}' was canceled"); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture : TestAssetFixtureBase { public const string ProjectName = "TimeoutCodeWithSixtySecTimeout"; diff --git a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TimeoutWhenExpiresTests.cs b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TimeoutWhenExpiresTests.cs index 6babcaa655..1483e7ee7f 100644 --- a/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TimeoutWhenExpiresTests.cs +++ b/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TimeoutWhenExpiresTests.cs @@ -149,7 +149,7 @@ private static async Task RunAndAssertAttributeTakesPrecedenceAsync(string tfm, testHostResult.AssertOutputContains($"{InfoByKind[entryKind].Prefix} method '{InfoByKind[entryKind].MethodFullName}' timed out after 1000ms"); } - public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.NuGetGlobalPackagesFolder) + public sealed class TestAssetFixture : TestAssetFixtureBase { public const string ProjectName = "TimeoutCodeWithOneSecTimeout"; From 77b4500e31f10c865eb49299d814b45c4a5630f7 Mon Sep 17 00:00:00 2001 From: Youssef1313 Date: Tue, 24 Mar 2026 14:00:00 +0100 Subject: [PATCH 3/5] Set NUGET_PACKAGES centrally in asm init --- .../Helpers/AcceptanceFixture.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/Helpers/AcceptanceFixture.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/Helpers/AcceptanceFixture.cs index 336b98dd07..65161ee6f7 100644 --- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/Helpers/AcceptanceFixture.cs +++ b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/Helpers/AcceptanceFixture.cs @@ -8,5 +8,17 @@ public static class AcceptanceFixture { [AssemblyInitialize] public static void AssemblyInitialize(TestContext context) - => Environment.SetEnvironmentVariable("MSBUILDDISABLENODEREUSE", "1"); + { + Environment.SetEnvironmentVariable("MSBUILDDISABLENODEREUSE", "1"); + + // Ensure all integration tests restore packages in a centralized place other than the NuGet cache. + // The centralized place also changes between runs (RandomId.Next()) so that re-packaging locally works as expected. + // So, when running Build.cmd -pack, running test, running Build.cmd -pack again, and running test again, the latest + // packages should be picked. + // If we restore to the same place (whether or not it is the machine-wide cache), NuGet will consider restore up-to-date and + // will use stale packages. + string directoryPath = Path.Combine(TempDirectory.TestSuiteDirectory, RandomId.Next(), ".packages"); + Directory.CreateDirectory(directoryPath); + Environment.SetEnvironmentVariable("NUGET_PACKAGES", directoryPath); + } } From 4b1ddfe8b28fdb69688fb8b05437a4665a5460ba Mon Sep 17 00:00:00 2001 From: Youssef1313 Date: Tue, 24 Mar 2026 14:20:40 +0100 Subject: [PATCH 4/5] Cleanup --- .../Helpers/AcceptanceFixture.cs | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/Helpers/AcceptanceFixture.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/Helpers/AcceptanceFixture.cs index 65161ee6f7..4e5af2455e 100644 --- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/Helpers/AcceptanceFixture.cs +++ b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/Helpers/AcceptanceFixture.cs @@ -6,6 +6,8 @@ namespace Microsoft.Testing.Platform.Acceptance.IntegrationTests; [TestClass] public static class AcceptanceFixture { + private static string? s_nugetCache; + [AssemblyInitialize] public static void AssemblyInitialize(TestContext context) { @@ -17,8 +19,23 @@ public static void AssemblyInitialize(TestContext context) // packages should be picked. // If we restore to the same place (whether or not it is the machine-wide cache), NuGet will consider restore up-to-date and // will use stale packages. - string directoryPath = Path.Combine(TempDirectory.TestSuiteDirectory, RandomId.Next(), ".packages"); - Directory.CreateDirectory(directoryPath); - Environment.SetEnvironmentVariable("NUGET_PACKAGES", directoryPath); + s_nugetCache = Path.Combine(TempDirectory.TestSuiteDirectory, RandomId.Next(), ".packages"); + Directory.CreateDirectory(s_nugetCache); + Environment.SetEnvironmentVariable("NUGET_PACKAGES", s_nugetCache); + } + + [AssemblyCleanup] + public static void AssemblyCleanup(TestContext context) + { + if (s_nugetCache is not null) + { + try + { + Directory.Delete(s_nugetCache, recursive: true); + } + catch (IOException) + { + } + } } } From 398d42cdfaf29b2cd5f4e86c84fc502c1707d0e4 Mon Sep 17 00:00:00 2001 From: Youssef Victor Date: Thu, 26 Mar 2026 17:11:04 +0100 Subject: [PATCH 5/5] Refactor VSTestConsoleLocator to fallback to global nuget cache --- .../Automation.CLI/VSTestConsoleLocator.cs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/test/Utilities/Automation.CLI/VSTestConsoleLocator.cs b/test/Utilities/Automation.CLI/VSTestConsoleLocator.cs index 3966fa7f8e..75206bd4a0 100644 --- a/test/Utilities/Automation.CLI/VSTestConsoleLocator.cs +++ b/test/Utilities/Automation.CLI/VSTestConsoleLocator.cs @@ -20,10 +20,7 @@ public static class VSTestConsoleLocator /// Full path to vstest.console.exe. public static string GetConsoleRunnerPath() { - string testPlatformNuGetPackageFolder = Path.Combine( - GetNugetPackageFolder(), - TestPlatformPackageName, - GetTestPlatformVersion()); + string testPlatformNuGetPackageFolder = GetNugetPackageFolder(TestPlatformPackageName, GetTestPlatformVersion()); if (!Directory.Exists(testPlatformNuGetPackageFolder)) { throw new DirectoryNotFoundException($"Test platform NuGet package folder '{testPlatformNuGetPackageFolder}' does not exist"); @@ -51,14 +48,17 @@ InvalidOperationException GetExceptionForVSTestConsoleNotFound(string expectedPa } } - private static string GetNugetPackageFolder() + private static string GetNugetPackageFolder(string packageName, string packageVersion) { string? nugetPackagesFolderPath = Environment.GetEnvironmentVariable("NUGET_PACKAGES"); if (!string.IsNullOrEmpty(nugetPackagesFolderPath)) { Assert.IsTrue(Directory.Exists(nugetPackagesFolderPath), $"Found environment variable 'NUGET_PACKAGES' and NuGet package folder '{nugetPackagesFolderPath}' should exist"); - - return nugetPackagesFolderPath; + string fullPackagePath = Path.Combine(nugetPackagesFolderPath, packageName, packageVersion); + if (Directory.Exists(fullPackagePath)) + { + return fullPackagePath; + } } string? userProfile = Environment.GetEnvironmentVariable("USERPROFILE"); @@ -70,7 +70,9 @@ private static string GetNugetPackageFolder() nugetPackagesFolderPath = Path.Combine(userProfile, ".nuget", "packages"); Assert.IsTrue(Directory.Exists(nugetPackagesFolderPath), $"NuGet package folder '{nugetPackagesFolderPath}' should exist"); - return nugetPackagesFolderPath; + string fullPackagePathFromUserProfile = Path.Combine(nugetPackagesFolderPath, packageName, packageVersion); + Assert.IsTrue(Directory.Exists(fullPackagePathFromUserProfile), $"NuGet package folder '{fullPackagePathFromUserProfile}' should exist"); + return fullPackagePathFromUserProfile; } private static string GetTestPlatformVersion()