diff --git a/src/Platform/Microsoft.Testing.Platform/CommandLine/CommandLineManager.cs b/src/Platform/Microsoft.Testing.Platform/CommandLine/CommandLineManager.cs index 8729bdba2c..796a345413 100644 --- a/src/Platform/Microsoft.Testing.Platform/CommandLine/CommandLineManager.cs +++ b/src/Platform/Microsoft.Testing.Platform/CommandLine/CommandLineManager.cs @@ -11,22 +11,28 @@ namespace Microsoft.Testing.Platform.CommandLine; internal sealed class CommandLineManager(IRuntimeFeature runtimeFeature, ITestApplicationModuleInfo testApplicationModuleInfo) : ICommandLineManager { - private readonly List> _commandLineProviderFactory = []; + private readonly List> _commandLineProviderFactory = []; private readonly IRuntimeFeature _runtimeFeature = runtimeFeature; private readonly ITestApplicationModuleInfo _testApplicationModuleInfo = testApplicationModuleInfo; public void AddProvider(Func commandLineProviderFactory) + { + Guard.NotNull(commandLineProviderFactory); + _commandLineProviderFactory.Add(_ => commandLineProviderFactory()); + } + + public void AddProvider(Func commandLineProviderFactory) { Guard.NotNull(commandLineProviderFactory); _commandLineProviderFactory.Add(commandLineProviderFactory); } - internal async Task BuildAsync(CommandLineParseResult parseResult) + internal async Task BuildAsync(CommandLineParseResult parseResult, IServiceProvider serviceProvider) { List commandLineOptionsProviders = []; - foreach (Func commandLineProviderFactory in _commandLineProviderFactory) + foreach (Func commandLineProviderFactory in _commandLineProviderFactory) { - ICommandLineOptionsProvider commandLineOptionsProvider = commandLineProviderFactory(); + ICommandLineOptionsProvider commandLineOptionsProvider = commandLineProviderFactory(serviceProvider); if (!await commandLineOptionsProvider.IsEnabledAsync()) { continue; diff --git a/src/Platform/Microsoft.Testing.Platform/CommandLine/ICommandLineManager.cs b/src/Platform/Microsoft.Testing.Platform/CommandLine/ICommandLineManager.cs index 3155669676..9865b5e69f 100644 --- a/src/Platform/Microsoft.Testing.Platform/CommandLine/ICommandLineManager.cs +++ b/src/Platform/Microsoft.Testing.Platform/CommandLine/ICommandLineManager.cs @@ -1,6 +1,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. +using System.Diagnostics.CodeAnalysis; + using Microsoft.Testing.Platform.Extensions.CommandLine; namespace Microsoft.Testing.Platform.CommandLine; @@ -15,4 +17,11 @@ public interface ICommandLineManager /// /// The factory method for creating the command line options provider. void AddProvider(Func commandLineProviderFactory); + + /// + /// Adds a command line options provider. + /// + /// The factory method for creating the command line options provider, given a service provider. + [Experimental("TPEXP", UrlFormat = "https://aka.ms/testingplatform/diagnostics#{0}")] + void AddProvider(Func commandLineProviderFactory); } diff --git a/src/Platform/Microsoft.Testing.Platform/CommandLine/MaxFailedTestsCommandLineOptionsProvider.cs b/src/Platform/Microsoft.Testing.Platform/CommandLine/MaxFailedTestsCommandLineOptionsProvider.cs index e81cc907b7..bf8842c405 100644 --- a/src/Platform/Microsoft.Testing.Platform/CommandLine/MaxFailedTestsCommandLineOptionsProvider.cs +++ b/src/Platform/Microsoft.Testing.Platform/CommandLine/MaxFailedTestsCommandLineOptionsProvider.cs @@ -3,14 +3,16 @@ using System.Globalization; +using Microsoft.Testing.Platform.Capabilities.TestFramework; using Microsoft.Testing.Platform.Extensions; using Microsoft.Testing.Platform.Extensions.CommandLine; using Microsoft.Testing.Platform.Helpers; using Microsoft.Testing.Platform.Resources; +using Microsoft.Testing.Platform.Services; namespace Microsoft.Testing.Platform.CommandLine; -internal sealed class MaxFailedTestsCommandLineOptionsProvider(IExtension extension) : ICommandLineOptionsProvider +internal sealed class MaxFailedTestsCommandLineOptionsProvider(IExtension extension, IServiceProvider serviceProvider) : ICommandLineOptionsProvider { internal const string MaxFailedTestsOptionKey = "maximum-failed-tests"; @@ -44,10 +46,15 @@ public Task ValidateOptionArgumentsAsync(CommandLineOption com // The idea is that we stop the execution when we *reach* the max failed tests, not when *exceed*. // So the value 1 means, stop execution on the first failure. return int.TryParse(arg, out int maxFailedTestsResult) && maxFailedTestsResult > 0 - ? ValidationResult.ValidTask + ? ValidateCapabilityAsync() : ValidationResult.InvalidTask(string.Format(CultureInfo.InvariantCulture, PlatformResources.MaxFailedTestsMustBePositive, arg)); } throw ApplicationStateGuard.Unreachable(); } + + private Task ValidateCapabilityAsync() + => serviceProvider.GetTestFrameworkCapabilities().Capabilities.OfType().Any() + ? ValidationResult.ValidTask + : ValidationResult.InvalidTask(PlatformResources.AbortForMaxFailedTestsCapabilityNotAvailable); } diff --git a/src/Platform/Microsoft.Testing.Platform/Helpers/TestApplicationBuilderExtensions.cs b/src/Platform/Microsoft.Testing.Platform/Helpers/TestApplicationBuilderExtensions.cs index bae0af6c00..247c72a156 100644 --- a/src/Platform/Microsoft.Testing.Platform/Helpers/TestApplicationBuilderExtensions.cs +++ b/src/Platform/Microsoft.Testing.Platform/Helpers/TestApplicationBuilderExtensions.cs @@ -22,5 +22,5 @@ public static void AddTreeNodeFilterService(this ITestApplicationBuilder testApp /// The test application builder. [Experimental("TPEXP", UrlFormat = "https://aka.ms/testingplatform/diagnostics#{0}")] public static void AddMaximumFailedTestsService(this ITestApplicationBuilder builder, IExtension extension) - => builder.CommandLine.AddProvider(() => new MaxFailedTestsCommandLineOptionsProvider(extension)); + => builder.CommandLine.AddProvider(serviceProvider => new MaxFailedTestsCommandLineOptionsProvider(extension, serviceProvider)); } diff --git a/src/Platform/Microsoft.Testing.Platform/Hosts/TestHostBuilder.cs b/src/Platform/Microsoft.Testing.Platform/Hosts/TestHostBuilder.cs index b071f4fb9f..5f27a72103 100644 --- a/src/Platform/Microsoft.Testing.Platform/Hosts/TestHostBuilder.cs +++ b/src/Platform/Microsoft.Testing.Platform/Hosts/TestHostBuilder.cs @@ -201,7 +201,7 @@ public async Task BuildAsync( // Build the command line service - we need special treatment because is possible that an extension query it during the creation. // Add Retry default argument commandlines - CommandLineHandler commandLineHandler = await ((CommandLineManager)CommandLine).BuildAsync(loggingState.CommandLineParseResult); + CommandLineHandler commandLineHandler = await ((CommandLineManager)CommandLine).BuildAsync(loggingState.CommandLineParseResult, serviceProvider); // Set the concrete command line options to the proxy. commandLineOptionsProxy.SetCommandLineOptions(commandLineHandler); @@ -247,6 +247,9 @@ public async Task BuildAsync( await testFrameworkCapabilitiesAsyncInitializable.InitializeAsync(); } + // Register the test framework capabilities to be used by services + serviceProvider.AddService(testFrameworkCapabilities); + // If command line is not valid we return immediately. ValidationResult commandLineValidationResult = await CommandLineOptionsValidator.ValidateAsync( loggingState.CommandLineParseResult, @@ -254,9 +257,6 @@ public async Task BuildAsync( commandLineHandler.ExtensionsCommandLineOptionsProviders, commandLineHandler); - // Register the test framework capabilities to be used by services - serviceProvider.AddService(testFrameworkCapabilities); - if (!loggingState.CommandLineParseResult.HasTool && !commandLineValidationResult.IsValid) { await DisplayBannerIfEnabledAsync(loggingState, proxyOutputDevice, testFrameworkCapabilities); diff --git a/src/Platform/Microsoft.Testing.Platform/PublicAPI/PublicAPI.Unshipped.txt b/src/Platform/Microsoft.Testing.Platform/PublicAPI/PublicAPI.Unshipped.txt index 1d1c2b5ca1..6b57520132 100644 --- a/src/Platform/Microsoft.Testing.Platform/PublicAPI/PublicAPI.Unshipped.txt +++ b/src/Platform/Microsoft.Testing.Platform/PublicAPI/PublicAPI.Unshipped.txt @@ -8,6 +8,7 @@ Microsoft.Testing.Platform.OutputDevice.WarningMessageOutputDeviceData.Message.g Microsoft.Testing.Platform.OutputDevice.WarningMessageOutputDeviceData.WarningMessageOutputDeviceData(string! message) -> void [TPEXP]Microsoft.Testing.Platform.Capabilities.TestFramework.IGracefulStopTestExecutionCapability [TPEXP]Microsoft.Testing.Platform.Capabilities.TestFramework.IGracefulStopTestExecutionCapability.StopTestExecutionAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task! +[TPEXP]Microsoft.Testing.Platform.CommandLine.ICommandLineManager.AddProvider(System.Func! commandLineProviderFactory) -> void [TPEXP]Microsoft.Testing.Platform.Extensions.Messages.StandardOutputProperty [TPEXP]Microsoft.Testing.Platform.Extensions.Messages.StandardOutputProperty.StandardOutput.get -> string! [TPEXP]Microsoft.Testing.Platform.Extensions.Messages.StandardOutputProperty.StandardOutput.init -> void diff --git a/src/Platform/Microsoft.Testing.Platform/Resources/PlatformResources.resx b/src/Platform/Microsoft.Testing.Platform/Resources/PlatformResources.resx index 4047fa6895..4ca08c4751 100644 --- a/src/Platform/Microsoft.Testing.Platform/Resources/PlatformResources.resx +++ b/src/Platform/Microsoft.Testing.Platform/Resources/PlatformResources.resx @@ -713,4 +713,7 @@ Takes one argument as string in the format <value>[h|m|s] where 'value' is Test session is aborting due to reaching failures ('{0}') specified by the '--maximum-failed-tests' option. {0} is the number of max failed tests. - + + The current test framework does not implement 'IGracefulStopTestExecutionCapability' which is required for '--maximum-failed-tests' feature. + + \ No newline at end of file diff --git a/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.cs.xlf b/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.cs.xlf index 95c3be44f2..ca36bd9618 100644 --- a/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.cs.xlf +++ b/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.cs.xlf @@ -2,6 +2,11 @@ + + The current test framework does not implement 'IGracefulStopTestExecutionCapability' which is required for '--maximum-failed-tests' feature. + The current test framework does not implement 'IGracefulStopTestExecutionCapability' which is required for '--maximum-failed-tests' feature. + + Extension used to support '--maximum-failed-tests'. When a given failures threshold is reached, the test run will be aborted. Extension used to support '--maximum-failed-tests'. When a given failures threshold is reached, the test run will be aborted. diff --git a/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.de.xlf b/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.de.xlf index 5ad7e52816..cfc90b90b2 100644 --- a/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.de.xlf +++ b/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.de.xlf @@ -2,6 +2,11 @@ + + The current test framework does not implement 'IGracefulStopTestExecutionCapability' which is required for '--maximum-failed-tests' feature. + The current test framework does not implement 'IGracefulStopTestExecutionCapability' which is required for '--maximum-failed-tests' feature. + + Extension used to support '--maximum-failed-tests'. When a given failures threshold is reached, the test run will be aborted. Extension used to support '--maximum-failed-tests'. When a given failures threshold is reached, the test run will be aborted. diff --git a/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.es.xlf b/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.es.xlf index 58c731750f..574d5a6100 100644 --- a/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.es.xlf +++ b/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.es.xlf @@ -2,6 +2,11 @@ + + The current test framework does not implement 'IGracefulStopTestExecutionCapability' which is required for '--maximum-failed-tests' feature. + The current test framework does not implement 'IGracefulStopTestExecutionCapability' which is required for '--maximum-failed-tests' feature. + + Extension used to support '--maximum-failed-tests'. When a given failures threshold is reached, the test run will be aborted. Extension used to support '--maximum-failed-tests'. When a given failures threshold is reached, the test run will be aborted. diff --git a/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.fr.xlf b/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.fr.xlf index 6529f58252..db05b6bf0f 100644 --- a/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.fr.xlf +++ b/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.fr.xlf @@ -2,6 +2,11 @@ + + The current test framework does not implement 'IGracefulStopTestExecutionCapability' which is required for '--maximum-failed-tests' feature. + The current test framework does not implement 'IGracefulStopTestExecutionCapability' which is required for '--maximum-failed-tests' feature. + + Extension used to support '--maximum-failed-tests'. When a given failures threshold is reached, the test run will be aborted. Extension used to support '--maximum-failed-tests'. When a given failures threshold is reached, the test run will be aborted. diff --git a/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.it.xlf b/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.it.xlf index 15d86d4003..88f67644df 100644 --- a/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.it.xlf +++ b/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.it.xlf @@ -2,6 +2,11 @@ + + The current test framework does not implement 'IGracefulStopTestExecutionCapability' which is required for '--maximum-failed-tests' feature. + The current test framework does not implement 'IGracefulStopTestExecutionCapability' which is required for '--maximum-failed-tests' feature. + + Extension used to support '--maximum-failed-tests'. When a given failures threshold is reached, the test run will be aborted. Extension used to support '--maximum-failed-tests'. When a given failures threshold is reached, the test run will be aborted. diff --git a/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.ja.xlf b/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.ja.xlf index 18e1d555d3..1a1153b17d 100644 --- a/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.ja.xlf +++ b/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.ja.xlf @@ -2,6 +2,11 @@ + + The current test framework does not implement 'IGracefulStopTestExecutionCapability' which is required for '--maximum-failed-tests' feature. + The current test framework does not implement 'IGracefulStopTestExecutionCapability' which is required for '--maximum-failed-tests' feature. + + Extension used to support '--maximum-failed-tests'. When a given failures threshold is reached, the test run will be aborted. Extension used to support '--maximum-failed-tests'. When a given failures threshold is reached, the test run will be aborted. diff --git a/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.ko.xlf b/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.ko.xlf index c8b3cbeb40..6cdc2939a2 100644 --- a/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.ko.xlf +++ b/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.ko.xlf @@ -2,6 +2,11 @@ + + The current test framework does not implement 'IGracefulStopTestExecutionCapability' which is required for '--maximum-failed-tests' feature. + The current test framework does not implement 'IGracefulStopTestExecutionCapability' which is required for '--maximum-failed-tests' feature. + + Extension used to support '--maximum-failed-tests'. When a given failures threshold is reached, the test run will be aborted. Extension used to support '--maximum-failed-tests'. When a given failures threshold is reached, the test run will be aborted. diff --git a/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.pl.xlf b/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.pl.xlf index 010f80b6d0..76988a0949 100644 --- a/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.pl.xlf +++ b/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.pl.xlf @@ -2,6 +2,11 @@ + + The current test framework does not implement 'IGracefulStopTestExecutionCapability' which is required for '--maximum-failed-tests' feature. + The current test framework does not implement 'IGracefulStopTestExecutionCapability' which is required for '--maximum-failed-tests' feature. + + Extension used to support '--maximum-failed-tests'. When a given failures threshold is reached, the test run will be aborted. Extension used to support '--maximum-failed-tests'. When a given failures threshold is reached, the test run will be aborted. diff --git a/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.pt-BR.xlf b/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.pt-BR.xlf index 6046c82389..f7bc2cd692 100644 --- a/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.pt-BR.xlf +++ b/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.pt-BR.xlf @@ -2,6 +2,11 @@ + + The current test framework does not implement 'IGracefulStopTestExecutionCapability' which is required for '--maximum-failed-tests' feature. + The current test framework does not implement 'IGracefulStopTestExecutionCapability' which is required for '--maximum-failed-tests' feature. + + Extension used to support '--maximum-failed-tests'. When a given failures threshold is reached, the test run will be aborted. Extension used to support '--maximum-failed-tests'. When a given failures threshold is reached, the test run will be aborted. diff --git a/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.ru.xlf b/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.ru.xlf index 59ba762b05..3d61daf175 100644 --- a/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.ru.xlf +++ b/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.ru.xlf @@ -2,6 +2,11 @@ + + The current test framework does not implement 'IGracefulStopTestExecutionCapability' which is required for '--maximum-failed-tests' feature. + The current test framework does not implement 'IGracefulStopTestExecutionCapability' which is required for '--maximum-failed-tests' feature. + + Extension used to support '--maximum-failed-tests'. When a given failures threshold is reached, the test run will be aborted. Extension used to support '--maximum-failed-tests'. When a given failures threshold is reached, the test run will be aborted. diff --git a/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.tr.xlf b/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.tr.xlf index bbaf34f0ff..8fdc73e97e 100644 --- a/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.tr.xlf +++ b/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.tr.xlf @@ -2,6 +2,11 @@ + + The current test framework does not implement 'IGracefulStopTestExecutionCapability' which is required for '--maximum-failed-tests' feature. + The current test framework does not implement 'IGracefulStopTestExecutionCapability' which is required for '--maximum-failed-tests' feature. + + Extension used to support '--maximum-failed-tests'. When a given failures threshold is reached, the test run will be aborted. Extension used to support '--maximum-failed-tests'. When a given failures threshold is reached, the test run will be aborted. diff --git a/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.zh-Hans.xlf b/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.zh-Hans.xlf index 1e6719edca..78ea6cc7c5 100644 --- a/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.zh-Hans.xlf +++ b/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.zh-Hans.xlf @@ -2,6 +2,11 @@ + + The current test framework does not implement 'IGracefulStopTestExecutionCapability' which is required for '--maximum-failed-tests' feature. + The current test framework does not implement 'IGracefulStopTestExecutionCapability' which is required for '--maximum-failed-tests' feature. + + Extension used to support '--maximum-failed-tests'. When a given failures threshold is reached, the test run will be aborted. Extension used to support '--maximum-failed-tests'. When a given failures threshold is reached, the test run will be aborted. diff --git a/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.zh-Hant.xlf b/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.zh-Hant.xlf index 5d8b20aad0..99c5b7b0c9 100644 --- a/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.zh-Hant.xlf +++ b/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.zh-Hant.xlf @@ -2,6 +2,11 @@ + + The current test framework does not implement 'IGracefulStopTestExecutionCapability' which is required for '--maximum-failed-tests' feature. + The current test framework does not implement 'IGracefulStopTestExecutionCapability' which is required for '--maximum-failed-tests' feature. + + Extension used to support '--maximum-failed-tests'. When a given failures threshold is reached, the test run will be aborted. Extension used to support '--maximum-failed-tests'. When a given failures threshold is reached, the test run will be aborted. diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/MaxFailedTestsExtensionTests.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/MaxFailedTestsExtensionTests.cs index 1f9883dbec..7456dea256 100644 --- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/MaxFailedTestsExtensionTests.cs +++ b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/MaxFailedTestsExtensionTests.cs @@ -26,6 +26,18 @@ public async Task TestMaxFailedTestsShouldCallStopTestExecutionAsync() testHostResult.AssertOutputContainsSummary(failed: 3, passed: 3, skipped: 0); } + public async Task WhenCapabilityIsMissingShouldFail() + { + var testHost = TestInfrastructure.TestHost.LocateFrom(_testAssetFixture.TargetAssetPath, AssetName, TargetFrameworks.NetCurrent.Arguments); + TestHostResult testHostResult = await testHost.ExecuteAsync("--maximum-failed-tests 2", environmentVariables: new() + { + ["DO_NOT_ADD_CAPABILITY"] = "1", + }); + + testHostResult.AssertExitCodeIs(ExitCodes.InvalidCommandLine); + testHostResult.AssertOutputContains("The current test framework does not implement 'IGracefulStopTestExecutionCapability' which is required for '--maximum-failed-tests' feature."); + } + [TestFixture(TestFixtureSharingStrategy.PerTestGroup)] public sealed class TestAssetFixture(AcceptanceFixture acceptanceFixture) : TestAssetFixtureBase(acceptanceFixture.NuGetGlobalPackagesFolder) { @@ -127,7 +139,18 @@ public async Task ExecuteRequestAsync(ExecuteRequestContext context) internal class Capabilities : ITestFrameworkCapabilities { - IReadOnlyCollection ICapabilities.Capabilities => [GracefulStop.Instance]; + IReadOnlyCollection ICapabilities.Capabilities + { + get + { + if (Environment.GetEnvironmentVariable("DO_NOT_ADD_CAPABILITY") == "1") + { + return []; + } + + return [GracefulStop.Instance]; + } + } } #pragma warning disable TPEXP // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.