From 6096f6e26aa6532f7fc8d70cdc593aaa10cb86d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jare=C5=A1?= Date: Tue, 14 Jun 2022 13:01:45 +0200 Subject: [PATCH 01/12] Fix provider lookup --- .../DesignModeTestEventsRegistrar.cs | 1 + .../EventRegistrarToWarningLoggerAdapter.cs | 31 +++++++ .../TestPlatform.cs | 15 ++-- .../Engine/ClientProtocol/ITestEngine.cs | 9 ++- .../Parallel/ParallelProxyDiscoveryManager.cs | 12 ++- .../Parallel/ParallelProxyExecutionManager.cs | 13 ++- .../Parallel/ParallelRunDataAggregator.cs | 9 +++ .../Client/TestRuntimeProviderInfo.cs | 4 +- .../Resources/Resources.Designer.cs | 24 +++++- .../Resources/Resources.resx | 8 +- .../TestEngine.cs | 80 ++++++++++++++----- .../Client/Interfaces/ITestPlatform.cs | 21 ++++- .../SourceDetail.cs | 1 + .../TestPlatformHelpers/TestRequestManager.cs | 8 +- 14 files changed, 192 insertions(+), 44 deletions(-) create mode 100644 src/Microsoft.TestPlatform.Client/EventRegistrarToWarningLoggerAdapter.cs diff --git a/src/Microsoft.TestPlatform.Client/DesignMode/DesignModeTestEventsRegistrar.cs b/src/Microsoft.TestPlatform.Client/DesignMode/DesignModeTestEventsRegistrar.cs index f945491853..100d58aac8 100644 --- a/src/Microsoft.TestPlatform.Client/DesignMode/DesignModeTestEventsRegistrar.cs +++ b/src/Microsoft.TestPlatform.Client/DesignMode/DesignModeTestEventsRegistrar.cs @@ -63,3 +63,4 @@ public void LogWarning(string? message) _designModeClient.SendTestMessage(TestMessageLevel.Warning, message); } } + diff --git a/src/Microsoft.TestPlatform.Client/EventRegistrarToWarningLoggerAdapter.cs b/src/Microsoft.TestPlatform.Client/EventRegistrarToWarningLoggerAdapter.cs new file mode 100644 index 0000000000..ceeffeae27 --- /dev/null +++ b/src/Microsoft.TestPlatform.Client/EventRegistrarToWarningLoggerAdapter.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using Microsoft.VisualStudio.TestPlatform.Common.Interfaces; +using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client; + +namespace Microsoft.VisualStudio.TestPlatform.Client; + +public class EventRegistrarToWarningLoggerAdapter : IWarningLogger +{ + private readonly IBaseTestEventsRegistrar _testEventsRegistrar; + + public EventRegistrarToWarningLoggerAdapter(IBaseTestEventsRegistrar? testEventsRegistrar) + { + _testEventsRegistrar = testEventsRegistrar; + } + + public void LogWarning(string message) + { + //TODO: Implement registrar in StartTestSession instead of passing null. + _testEventsRegistrar.LogWarning(message); + } +} + +public class NullWarningLogger : IWarningLogger +{ + public void LogWarning(string message) + { + //TODO: Implement registrar in StartTestSession instead of passing null, and stop using this class. + } +} diff --git a/src/Microsoft.TestPlatform.Client/TestPlatform.cs b/src/Microsoft.TestPlatform.Client/TestPlatform.cs index a07f6618db..45447ac58d 100644 --- a/src/Microsoft.TestPlatform.Client/TestPlatform.cs +++ b/src/Microsoft.TestPlatform.Client/TestPlatform.cs @@ -80,7 +80,8 @@ public IDiscoveryRequest CreateDiscoveryRequest( IRequestData requestData, DiscoveryCriteria discoveryCriteria, TestPlatformOptions? options, - Dictionary sourceToSourceDetailMap) + Dictionary sourceToSourceDetailMap, + IWarningLogger warningLogger) { ValidateArg.NotNull(discoveryCriteria, nameof(discoveryCriteria)); @@ -90,7 +91,7 @@ public IDiscoveryRequest CreateDiscoveryRequest( ITestLoggerManager loggerManager = _testEngine.GetLoggerManager(requestData); loggerManager.Initialize(discoveryCriteria.RunSettings); - IProxyDiscoveryManager discoveryManager = _testEngine.GetDiscoveryManager(requestData, discoveryCriteria, sourceToSourceDetailMap); + IProxyDiscoveryManager discoveryManager = _testEngine.GetDiscoveryManager(requestData, discoveryCriteria, sourceToSourceDetailMap, warningLogger); discoveryManager.Initialize(options?.SkipDefaultAdapters ?? false); return new DiscoveryRequest(requestData, discoveryCriteria, discoveryManager, loggerManager); @@ -101,7 +102,8 @@ public ITestRunRequest CreateTestRunRequest( IRequestData requestData, TestRunCriteria testRunCriteria, TestPlatformOptions? options, - Dictionary sourceToSourceDetailMap) + Dictionary sourceToSourceDetailMap, + IWarningLogger warningLogger) { ValidateArg.NotNull(testRunCriteria, nameof(testRunCriteria)); @@ -112,7 +114,7 @@ public ITestRunRequest CreateTestRunRequest( ITestLoggerManager loggerManager = _testEngine.GetLoggerManager(requestData); loggerManager.Initialize(testRunCriteria.TestRunSettings); - IProxyExecutionManager executionManager = _testEngine.GetExecutionManager(requestData, testRunCriteria, sourceToSourceDetailMap); + IProxyExecutionManager executionManager = _testEngine.GetExecutionManager(requestData, testRunCriteria, sourceToSourceDetailMap, warningLogger); executionManager.Initialize(options?.SkipDefaultAdapters ?? false); return new TestRunRequest(requestData, testRunCriteria, executionManager, loggerManager); @@ -123,7 +125,8 @@ public bool StartTestSession( IRequestData requestData, StartTestSessionCriteria testSessionCriteria, ITestSessionEventsHandler eventsHandler, - Dictionary sourceToSourceDetailMap) + Dictionary sourceToSourceDetailMap, + IWarningLogger warningLogger) { ValidateArg.NotNull(testSessionCriteria, nameof(testSessionCriteria)); @@ -137,7 +140,7 @@ public bool StartTestSession( return false; } - IProxyTestSessionManager? testSessionManager = _testEngine.GetTestSessionManager(requestData, testSessionCriteria, sourceToSourceDetailMap); + IProxyTestSessionManager? testSessionManager = _testEngine.GetTestSessionManager(requestData, testSessionCriteria, sourceToSourceDetailMap, warningLogger); if (testSessionManager == null) { // The test session manager is null because the combination of runsettings and diff --git a/src/Microsoft.TestPlatform.Common/Interfaces/Engine/ClientProtocol/ITestEngine.cs b/src/Microsoft.TestPlatform.Common/Interfaces/Engine/ClientProtocol/ITestEngine.cs index 369049c605..abf9f1ce6b 100644 --- a/src/Microsoft.TestPlatform.Common/Interfaces/Engine/ClientProtocol/ITestEngine.cs +++ b/src/Microsoft.TestPlatform.Common/Interfaces/Engine/ClientProtocol/ITestEngine.cs @@ -29,7 +29,8 @@ public interface ITestEngine IProxyDiscoveryManager GetDiscoveryManager( IRequestData requestData, DiscoveryCriteria discoveryCriteria, - IDictionary sourceToSourceDetailMap); + IDictionary sourceToSourceDetailMap, + IWarningLogger warningLogger); /// /// Fetches the ExecutionManager for this engine. This manager would provide all @@ -46,7 +47,8 @@ IProxyDiscoveryManager GetDiscoveryManager( IProxyExecutionManager GetExecutionManager( IRequestData requestData, TestRunCriteria testRunCriteria, - IDictionary sourceToSourceDetailMap); + IDictionary sourceToSourceDetailMap, + IWarningLogger warningLogger); /// /// Fetches the TestSessionManager for this engine. This manager would provide all @@ -64,7 +66,8 @@ IProxyExecutionManager GetExecutionManager( IProxyTestSessionManager GetTestSessionManager( IRequestData requestData, StartTestSessionCriteria testSessionCriteria, - IDictionary sourceToSourceDetailMap); + IDictionary sourceToSourceDetailMap, + IWarningLogger warningLogger); /// /// Fetches the extension manager for this engine. This manager would provide extensibility diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/ParallelProxyDiscoveryManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/ParallelProxyDiscoveryManager.cs index ec86e4ea34..7f764744e1 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/ParallelProxyDiscoveryManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/ParallelProxyDiscoveryManager.cs @@ -83,7 +83,15 @@ public void DiscoverTests(DiscoveryCriteria discoveryCriteria, ITestDiscoveryEve var workloads = SplitToWorkloads(discoveryCriteria, _sourceToTestHostProviderMap); _availableTestSources = workloads.SelectMany(w => w.Work.Sources).Count(); - _availableWorkloads = workloads.Count(); + var runnableWorkloads = workloads.Where(workload => workload.HasProvider).ToList(); + var nonRunnableWorkloads = workloads.Where(workload => !workload.HasProvider).ToList(); + if (nonRunnableWorkloads.Count > 0) + { + // We found some sources that don't associate to any runtime provider and so they cannot run. + // Mark the run as aborted. + _dataAggregator.MarkAsAborted(); + } + _availableWorkloads = runnableWorkloads.Count(); EqtTrace.Verbose("ParallelProxyDiscoveryManager.DiscoverTests: Start discovery. Total sources: " + _availableTestSources); @@ -95,7 +103,7 @@ public void DiscoverTests(DiscoveryCriteria discoveryCriteria, ITestDiscoveryEve // marked as NotDiscovered. _dataAggregator.MarkSourcesWithStatus(discoveryCriteria.Sources, DiscoveryStatus.NotDiscovered); - _parallelOperationManager.StartWork(workloads, eventHandler, GetParallelEventHandler, DiscoverTestsOnConcurrentManager); + _parallelOperationManager.StartWork(runnableWorkloads, eventHandler, GetParallelEventHandler, DiscoverTestsOnConcurrentManager); } private ITestDiscoveryEventsHandler2 GetParallelEventHandler(ITestDiscoveryEventsHandler2 eventHandler, IProxyDiscoveryManager concurrentManager) diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/ParallelProxyExecutionManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/ParallelProxyExecutionManager.cs index a9266d0256..351d456119 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/ParallelProxyExecutionManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/ParallelProxyExecutionManager.cs @@ -94,7 +94,10 @@ public void Initialize(bool skipDefaultAdapters) public int StartTestRun(TestRunCriteria testRunCriteria, IInternalTestRunEventsHandler eventHandler) { var workloads = SplitToWorkloads(testRunCriteria, _sourceToTestHostProviderMap); - _availableWorkloads = workloads.Count; + var runnableWorkloads = workloads.Where(workload => workload.HasProvider).ToList(); + var nonRunnableWorkloads = workloads.Where(workload => !workload.HasProvider).ToList(); + + _availableWorkloads = runnableWorkloads.Count; EqtTrace.Verbose("ParallelProxyExecutionManager: Start execution. Total sources: " + _availableWorkloads); @@ -103,8 +106,12 @@ public int StartTestRun(TestRunCriteria testRunCriteria, IInternalTestRunEventsH // One data aggregator per parallel run _currentRunDataAggregator = new ParallelRunDataAggregator(testRunCriteria.TestRunSettings); + if (nonRunnableWorkloads.Count > 0) + { + _currentRunDataAggregator.MarkAsAborted(); + } - _parallelOperationManager.StartWork(workloads, eventHandler, GetParallelEventHandler, StartTestRunOnConcurrentManager); + _parallelOperationManager.StartWork(runnableWorkloads, eventHandler, GetParallelEventHandler, StartTestRunOnConcurrentManager); // Why 1? Because this is supposed to be a processId, and that is just the default that was chosen by someone before me, // and maybe is checked somewhere, but I don't see it checked in our codebase. @@ -409,6 +416,8 @@ internal class ProviderSpecificWorkload public TestRuntimeProviderInfo Provider { get; protected set; } + public bool HasProvider => Provider.Type is not null; + public ProviderSpecificWorkload(T work, TestRuntimeProviderInfo provider) { Provider = provider; diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/ParallelRunDataAggregator.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/ParallelRunDataAggregator.cs index ba4b56f9c6..c6968b56b6 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/ParallelRunDataAggregator.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/ParallelRunDataAggregator.cs @@ -210,4 +210,13 @@ public void AggregateRunDataMetrics(IDictionary metrics) } } } + + + public void MarkAsAborted() + { + lock (_dataUpdateSyncObject) + { + IsAborted = true; + } + } } diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/TestRuntimeProviderInfo.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/TestRuntimeProviderInfo.cs index 1369e89f55..38374fdcfe 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/TestRuntimeProviderInfo.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/TestRuntimeProviderInfo.cs @@ -10,12 +10,12 @@ namespace Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client; public class TestRuntimeProviderInfo { - public Type Type { get; } + public Type? Type { get; } public bool Shared { get; } public string RunSettings { get; } public List SourceDetails { get; } - public TestRuntimeProviderInfo(Type type, bool shared, string runSettings, List sourceDetails) + public TestRuntimeProviderInfo(Type? type, bool shared, string runSettings, List sourceDetails) { Type = type; Shared = shared; diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/Resources.Designer.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/Resources.Designer.cs index 16c486e848..847038f2b9 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/Resources.Designer.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/Resources.Designer.cs @@ -11,7 +11,7 @@ namespace Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Resources { using System; using System.Reflection; - + /// /// A strongly-typed resource class, for looking up localized strings, etc. /// @@ -19,7 +19,7 @@ namespace Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Resources { // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { @@ -277,7 +277,16 @@ internal static string NoSuchProxyId { } /// - /// Looks up a localized string similar to No suitable test runtime provider found for this run.. + /// Looks up a localized string similar to No suitable test runtime provider was found:. + /// + internal static string NoSuitableRuntimeProviderFound { + get { + return ResourceManager.GetString("NoSuitableRuntimeProviderFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No suitable test runtime provider was found for any source in this run.. /// internal static string NoTestHostProviderFound { get { @@ -321,6 +330,15 @@ internal static string ProxyIsAlreadyAvailable { } } + /// + /// Looks up a localized string similar to Skipping source:. + /// + internal static string SkippingSource { + get { + return ResourceManager.GetString("SkippingSource", resourceCulture); + } + } + /// /// Looks up a localized string similar to , . /// diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/Resources.resx b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/Resources.resx index a7f9b33437..ebbda678c9 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/Resources.resx +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/Resources.resx @@ -214,7 +214,7 @@ Proxy with id {0} is already available and cannot be re-enqueued. - No suitable test runtime provider found for this run. + No suitable test runtime provider was found for any source in this run. The runsettings changed between the time when the test session was established and the time of the current run/discovery request. @@ -225,4 +225,10 @@ Attachments: + + No suitable test runtime provider was found: + + + Skipping source: + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/TestEngine.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/TestEngine.cs index 08a2a113d5..cfe69b2217 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/TestEngine.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/TestEngine.cs @@ -68,7 +68,8 @@ internal TestEngine( public IProxyDiscoveryManager GetDiscoveryManager( IRequestData requestData, DiscoveryCriteria discoveryCriteria, - IDictionary sourceToSourceDetailMap) + IDictionary sourceToSourceDetailMap, + IWarningLogger warningLogger) { // Parallel level determines how many processes at most we should start at the same time. We take the number from settings, and if user // has no preference or the preference is 0 then we use the number of logical processors. Or the number of sources, whatever is lower. @@ -86,7 +87,7 @@ public IProxyDiscoveryManager GetDiscoveryManager( requestData.MetricsCollection.Add(TelemetryDataConstants.TestSessionId, discoveryCriteria.TestSessionInfo?.Id.ToString() ?? string.Empty); // Get testhost managers by configuration, and either use it for in-process run. or for single source run. - List testHostManagers = GetTestRuntimeProvidersForUniqueConfigurations(discoveryCriteria.RunSettings, sourceToSourceDetailMap, out ITestRuntimeProvider testHostManager); + List testHostManagers = GetTestRuntimeProvidersForUniqueConfigurations(discoveryCriteria.RunSettings, sourceToSourceDetailMap, warningLogger, out ITestRuntimeProvider testHostManager); // This is a big if that figures out if we can run in process. In process run is very restricted, it is non-parallel run // that has the same target framework as the current process, and it also must not be running in DesignMode (server mode / under IDE) @@ -186,7 +187,8 @@ public IProxyDiscoveryManager GetDiscoveryManager( public IProxyExecutionManager GetExecutionManager( IRequestData requestData, TestRunCriteria testRunCriteria, - IDictionary sourceToSourceDetailMap) + IDictionary sourceToSourceDetailMap, + IWarningLogger warningLogger) { // We use mulitple "different" runsettings here. We have runsettings that come with the testRunCriteria, // and we use that to figure out the common stuff before we try to setup the run. Later we patch the settings @@ -205,7 +207,7 @@ public IProxyExecutionManager GetExecutionManager( var isDataCollectorEnabled = XmlRunSettingsUtilities.IsDataCollectionEnabled(testRunCriteria.TestRunSettings); var isInProcDataCollectorEnabled = XmlRunSettingsUtilities.IsInProcDataCollectionEnabled(testRunCriteria.TestRunSettings); - var testHostProviders = GetTestRuntimeProvidersForUniqueConfigurations(testRunCriteria.TestRunSettings, sourceToSourceDetailMap, out ITestRuntimeProvider testHostManager); + var testHostProviders = GetTestRuntimeProvidersForUniqueConfigurations(testRunCriteria.TestRunSettings, sourceToSourceDetailMap, warningLogger, out ITestRuntimeProvider testHostManager); if (ShouldRunInProcess( testRunCriteria.TestRunSettings, @@ -340,7 +342,8 @@ internal IProxyExecutionManager CreateNonParallelExecutionManager(IRequestData r public IProxyTestSessionManager GetTestSessionManager( IRequestData requestData, StartTestSessionCriteria testSessionCriteria, - IDictionary sourceToSourceDetailMap) + IDictionary sourceToSourceDetailMap, + IWarningLogger warningLogger) { var parallelLevel = VerifyParallelSettingAndCalculateParallelLevel( testSessionCriteria.Sources.Count, @@ -354,7 +357,7 @@ public IProxyTestSessionManager GetTestSessionManager( var isDataCollectorEnabled = XmlRunSettingsUtilities.IsDataCollectionEnabled(testSessionCriteria.RunSettings); var isInProcDataCollectorEnabled = XmlRunSettingsUtilities.IsInProcDataCollectionEnabled(testSessionCriteria.RunSettings); - List testRuntimeProviders = GetTestRuntimeProvidersForUniqueConfigurations(testSessionCriteria.RunSettings, sourceToSourceDetailMap, out var _); + List testRuntimeProviders = GetTestRuntimeProvidersForUniqueConfigurations(testSessionCriteria.RunSettings, sourceToSourceDetailMap, warningLogger, out var _); if (ShouldRunInProcess( testSessionCriteria.RunSettings, @@ -425,6 +428,7 @@ public IProxyTestSessionManager GetTestSessionManager( private List GetTestRuntimeProvidersForUniqueConfigurations( string runSettings, IDictionary sourceToSourceDetailMap, + IWarningLogger warningLogger, out ITestRuntimeProvider mostRecentlyCreatedInstance) { // Group source details to get unique frameworks and architectures for which we will run, so we can figure @@ -440,17 +444,29 @@ private List GetTestRuntimeProvidersForUniqueConfigurat var sources = runConfiguration.Select(c => c.Source).ToList(); var testRuntimeProvider = _testHostProviderManager.GetTestHostManagerByRunConfiguration(runsettingsXml, sources); - // Initialize here, because Shared is picked up from the instance, and it can be set during initalization. - testRuntimeProvider?.Initialize(TestSessionMessageLogger.Instance, runsettingsXml); - // If the type is null, we throw in ThrowExceptionIfAnyTestHostManagerIsNullOrNoneAreFound - var testRuntimeProviderInfo = new TestRuntimeProviderInfo(testRuntimeProvider?.GetType(), testRuntimeProvider?.Shared ?? false, runsettingsXml, sourceDetails: runConfiguration.ToList()); + if (testRuntimeProvider != null) + { + testRuntimeProviders.Add(new TestRuntimeProviderInfo(testRuntimeProvider.GetType(), testRuntimeProvider.Shared, + runsettingsXml, sourceDetails: runConfiguration.ToList())); + + // Initialize here, because Shared is picked up from the instance, and it can be set during initalization. + testRuntimeProvider.Initialize(TestSessionMessageLogger.Instance, runsettingsXml); - // Outputting the instance, because the code for in-process run uses it, and we don't want to resolve it another time. - mostRecentlyCreatedInstance = testRuntimeProvider; - testRuntimeProviders.Add(testRuntimeProviderInfo); + // Outputting the instance, because the code for in-process run uses it, and we don't want to resolve it one more time. + mostRecentlyCreatedInstance = testRuntimeProvider; + } + else + { + testRuntimeProviders.Add(new TestRuntimeProviderInfo(type: null, shared: false, runsettingsXml, sourceDetails: runConfiguration.ToList())); + } } - ThrowExceptionIfAnyTestHostManagerIsNullOrNoneAreFound(testRuntimeProviders); + WarnAboutNotFoundRuntimeProvidersOrThrowWhenNoneAreFound(testRuntimeProviders, warningLogger); + + // Do NOT return just found providers here, instead return all of them. Later sources will be split to criteria + // and we need to have all the sources available there, and filter them down to skip the ones that don't + // have runtime providers there. + // var foundRuntimeProviders = testRuntimeProviders.Where(runtimeProvider => runtimeProvider.Type != null).ToList(); return testRuntimeProviders; } @@ -607,23 +623,49 @@ private static void ThrowExceptionIfTestHostManagerIsNull(ITestRuntimeProvider t } } - private static void ThrowExceptionIfAnyTestHostManagerIsNullOrNoneAreFound(List testRuntimeProviders) + private static void WarnAboutNotFoundRuntimeProvidersOrThrowWhenNoneAreFound(List testRuntimeProviders, IWarningLogger warningLogger) { if (!testRuntimeProviders.Any()) throw new ArgumentException(null, nameof(testRuntimeProviders)); + // Throw when we did not find any runtime provider for any of the provided sources. + var shouldThrow = testRuntimeProviders.All(runtimeProvider => runtimeProvider == null); + var missingRuntimeProviders = testRuntimeProviders.Where(p => p.Type == null); if (missingRuntimeProviders.Any()) { var stringBuilder = new StringBuilder(); - stringBuilder.AppendLine(string.Format(CultureInfo.CurrentCulture, Resources.Resources.NoTestHostProviderFound)); + stringBuilder.AppendLine(string.Format(CultureInfo.CurrentCulture, Resources.Resources.NoSuitableRuntimeProviderFound)); foreach (var missingRuntimeProvider in missingRuntimeProviders) { - EqtTrace.Error($"{nameof(TestEngine)}.{nameof(ThrowExceptionIfAnyTestHostManagerIsNullOrNoneAreFound)}: No suitable testHostProvider found for sources {missingRuntimeProvider.SourceDetails.Select(s => s.Source)} and runsettings: {missingRuntimeProvider.RunSettings}"); - missingRuntimeProvider.SourceDetails.ForEach(detail => stringBuilder.AppendLine(detail.Source)); + var text = $"{nameof(TestEngine)}.{nameof(WarnAboutNotFoundRuntimeProvidersOrThrowWhenNoneAreFound)}: No suitable testHostProvider found for sources {string.Join(", ", missingRuntimeProvider.SourceDetails.Select(s => s.Source))} and runsettings: {missingRuntimeProvider.RunSettings}"; + if (shouldThrow) + { + EqtTrace.Error(text); + } + else + { + EqtTrace.Warning(text); + } + missingRuntimeProvider.SourceDetails.ForEach(detail => + { + if (!shouldThrow) + { + stringBuilder.Append(Resources.Resources.SkippingSource).Append(' '); + } + stringBuilder.AppendLine($"{detail.Source} ({detail.Framework}, {detail.Architecture})"); + }); } - throw new TestPlatformException(stringBuilder.ToString()); + if (shouldThrow) + { + stringBuilder.AppendLine().AppendLine(Resources.Resources.NoTestHostProviderFound); + throw new TestPlatformException(stringBuilder.ToString()); + } + else + { + warningLogger.LogWarning(stringBuilder.ToString()); + } } } } diff --git a/src/Microsoft.TestPlatform.ObjectModel/Client/Interfaces/ITestPlatform.cs b/src/Microsoft.TestPlatform.ObjectModel/Client/Interfaces/ITestPlatform.cs index 4df3088b58..479be9f086 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Client/Interfaces/ITestPlatform.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/Client/Interfaces/ITestPlatform.cs @@ -46,7 +46,8 @@ IDiscoveryRequest CreateDiscoveryRequest( IRequestData requestData, DiscoveryCriteria discoveryCriteria, TestPlatformOptions options, - Dictionary sourceToSourceDetailMap); + Dictionary sourceToSourceDetailMap, + IWarningLogger warningLogger); /// /// Creates a test run request. @@ -61,7 +62,8 @@ ITestRunRequest CreateTestRunRequest( IRequestData requestData, TestRunCriteria testRunCriteria, TestPlatformOptions options, - Dictionary sourceToSourceDetailMap); + Dictionary sourceToSourceDetailMap, + IWarningLogger warningLogger); /// /// Starts a test session. @@ -78,5 +80,18 @@ bool StartTestSession( IRequestData requestData, StartTestSessionCriteria criteria, ITestSessionEventsHandler eventsHandler, - Dictionary sourceToSourceDetailMap); + Dictionary sourceToSourceDetailMap, + IWarningLogger warningLogger); +} + +/// +/// DO NOT use this to extend TestPlatform, it is public only because some other internal interfaces and classes are public, and will be made internal later. +/// +public interface IWarningLogger +{ + /// + /// Log warning message that will be shown to user. + /// + /// message string + void LogWarning(string message); } diff --git a/src/Microsoft.TestPlatform.ObjectModel/SourceDetail.cs b/src/Microsoft.TestPlatform.ObjectModel/SourceDetail.cs index 4270aa9518..e8090faba4 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/SourceDetail.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/SourceDetail.cs @@ -9,5 +9,6 @@ public class SourceDetail { public string Source { get; internal set; } public Architecture Architecture { get; internal set; } + public Architecture FallbackArchitecture { get; internal set; } public Framework Framework { get; internal set; } } diff --git a/src/vstest.console/TestPlatformHelpers/TestRequestManager.cs b/src/vstest.console/TestPlatformHelpers/TestRequestManager.cs index bc40c0d72f..a7cf09071d 100644 --- a/src/vstest.console/TestPlatformHelpers/TestRequestManager.cs +++ b/src/vstest.console/TestPlatformHelpers/TestRequestManager.cs @@ -226,7 +226,8 @@ public void DiscoverTests( requestData, criteria, discoveryPayload.TestPlatformOptions, - sourceToSourceDetailMap); + sourceToSourceDetailMap, + new EventRegistrarToWarningLoggerAdapter(discoveryEventsRegistrar)); discoveryEventsRegistrar?.RegisterDiscoveryEvents(_currentDiscoveryRequest); // Notify start of discovery start. @@ -509,7 +510,7 @@ public void StartTestSession( TestHostLauncher = testHostLauncher }; - var testSessionStarted = _testPlatform.StartTestSession(requestData, criteria, eventsHandler, sourceToSourceDetailMap); + var testSessionStarted = _testPlatform.StartTestSession(requestData, criteria, eventsHandler, sourceToSourceDetailMap, new NullWarningLogger()); if (!testSessionStarted) { EqtTrace.Warning("TestRequestManager.StartTestSession: Unable to start test session."); @@ -1124,7 +1125,8 @@ private void RunTests( requestData, testRunCriteria, options, - sourceToSourceDetailMap); + sourceToSourceDetailMap, + new EventRegistrarToWarningLoggerAdapter(testRunEventsRegistrar)); _testRunResultAggregator.RegisterTestRunEvents(_currentTestRunRequest); testRunEventsRegistrar?.RegisterTestRunEvents(_currentTestRunRequest); From 90186e5ec323bba178ac9b0109df9fbe0dd4906c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jare=C5=A1?= Date: Tue, 14 Jun 2022 13:56:58 +0200 Subject: [PATCH 02/12] Resources --- .../Resources/xlf/Resources.cs.xlf | 14 ++++++++++++-- .../Resources/xlf/Resources.de.xlf | 14 ++++++++++++-- .../Resources/xlf/Resources.es.xlf | 14 ++++++++++++-- .../Resources/xlf/Resources.fr.xlf | 14 ++++++++++++-- .../Resources/xlf/Resources.it.xlf | 14 ++++++++++++-- .../Resources/xlf/Resources.ja.xlf | 14 ++++++++++++-- .../Resources/xlf/Resources.ko.xlf | 14 ++++++++++++-- .../Resources/xlf/Resources.pl.xlf | 14 ++++++++++++-- .../Resources/xlf/Resources.pt-BR.xlf | 14 ++++++++++++-- .../Resources/xlf/Resources.ru.xlf | 14 ++++++++++++-- .../Resources/xlf/Resources.tr.xlf | 14 ++++++++++++-- .../Resources/xlf/Resources.xlf | 12 +++++++++++- .../Resources/xlf/Resources.zh-Hans.xlf | 14 ++++++++++++-- .../Resources/xlf/Resources.zh-Hant.xlf | 14 ++++++++++++-- 14 files changed, 167 insertions(+), 27 deletions(-) diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.cs.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.cs.xlf index eb196e9f0a..0983db0304 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.cs.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.cs.xlf @@ -158,8 +158,8 @@ - No suitable test runtime provider found for this run. - Pro tento běh se nenašel žádný vhodný zprostředkovatel testů v režimu runtime. + No suitable test runtime provider was found for any source in this run. + Pro tento běh se nenašel žádný vhodný zprostředkovatel testů v režimu runtime. @@ -177,6 +177,16 @@ Přílohy: + + No suitable test runtime provider was found: + No suitable test runtime provider was found: + + + + Skipping source: + Skipping source: + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.de.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.de.xlf index fecf791420..0e8b40de15 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.de.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.de.xlf @@ -158,8 +158,8 @@ - No suitable test runtime provider found for this run. - Für diese Ausführung wurde kein geeigneter Testlaufzeitanbieter gefunden. + No suitable test runtime provider was found for any source in this run. + Für diese Ausführung wurde kein geeigneter Testlaufzeitanbieter gefunden. @@ -177,6 +177,16 @@ Anlagen: + + No suitable test runtime provider was found: + No suitable test runtime provider was found: + + + + Skipping source: + Skipping source: + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.es.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.es.xlf index 6136c2c671..4c3b9c5414 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.es.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.es.xlf @@ -158,8 +158,8 @@ - No suitable test runtime provider found for this run. - No se encontró un proveedor de tiempo de ejecución de prueba adecuado para esta ejecución. + No suitable test runtime provider was found for any source in this run. + No se encontró un proveedor de tiempo de ejecución de prueba adecuado para esta ejecución. @@ -177,6 +177,16 @@ Datos adjuntos: + + No suitable test runtime provider was found: + No suitable test runtime provider was found: + + + + Skipping source: + Skipping source: + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.fr.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.fr.xlf index 221d695db9..ed714a10d0 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.fr.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.fr.xlf @@ -158,8 +158,8 @@ - No suitable test runtime provider found for this run. - Aucun fournisseur d'exécution de tests approprié n'a été trouvé pour cette série. + No suitable test runtime provider was found for any source in this run. + Aucun fournisseur d'exécution de tests approprié n'a été trouvé pour cette série. @@ -177,6 +177,16 @@ Pièces jointes : + + No suitable test runtime provider was found: + No suitable test runtime provider was found: + + + + Skipping source: + Skipping source: + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.it.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.it.xlf index 1b7a288297..f4fe40f2d6 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.it.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.it.xlf @@ -158,8 +158,8 @@ - No suitable test runtime provider found for this run. - Non è stato trovato alcun provider di runtime dei test adatto per questa esecuzione. + No suitable test runtime provider was found for any source in this run. + Non è stato trovato alcun provider di runtime dei test adatto per questa esecuzione. @@ -177,6 +177,16 @@ Allegati: + + No suitable test runtime provider was found: + No suitable test runtime provider was found: + + + + Skipping source: + Skipping source: + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ja.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ja.xlf index 2a79f9c193..7c2bab3467 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ja.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ja.xlf @@ -158,8 +158,8 @@ - No suitable test runtime provider found for this run. - この実行に対して適切なテスト ランタイム プロバイダーが見つかりませんでした。 + No suitable test runtime provider was found for any source in this run. + この実行に対して適切なテスト ランタイム プロバイダーが見つかりませんでした。 @@ -177,6 +177,16 @@ 添付ファイル: + + No suitable test runtime provider was found: + No suitable test runtime provider was found: + + + + Skipping source: + Skipping source: + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ko.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ko.xlf index 6986ed00e9..4b519ff692 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ko.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ko.xlf @@ -158,8 +158,8 @@ - No suitable test runtime provider found for this run. - 이 실행에 적합한 테스트 런타임 공급자를 찾지 못했습니다. + No suitable test runtime provider was found for any source in this run. + 이 실행에 적합한 테스트 런타임 공급자를 찾지 못했습니다. @@ -177,6 +177,16 @@ 첨부 파일: + + No suitable test runtime provider was found: + No suitable test runtime provider was found: + + + + Skipping source: + Skipping source: + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.pl.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.pl.xlf index 472f48372e..d31300fc9b 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.pl.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.pl.xlf @@ -158,8 +158,8 @@ - No suitable test runtime provider found for this run. - Nie znaleziono odpowiedniego dostawcy testowego środowiska uruchomieniowego dla tego uruchomienia. + No suitable test runtime provider was found for any source in this run. + Nie znaleziono odpowiedniego dostawcy testowego środowiska uruchomieniowego dla tego uruchomienia. @@ -177,6 +177,16 @@ Załączniki: + + No suitable test runtime provider was found: + No suitable test runtime provider was found: + + + + Skipping source: + Skipping source: + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.pt-BR.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.pt-BR.xlf index b4572a38bf..362702a031 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.pt-BR.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.pt-BR.xlf @@ -158,8 +158,8 @@ - No suitable test runtime provider found for this run. - Nenhum provedor de runtime de teste encontrado para esta execução. + No suitable test runtime provider was found for any source in this run. + Nenhum provedor de runtime de teste encontrado para esta execução. @@ -177,6 +177,16 @@ Anexos: + + No suitable test runtime provider was found: + No suitable test runtime provider was found: + + + + Skipping source: + Skipping source: + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ru.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ru.xlf index bc17b4ac02..996081f67d 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ru.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ru.xlf @@ -158,8 +158,8 @@ - No suitable test runtime provider found for this run. - Не найден подходящий поставщик среды выполнения теста для этого запуска. + No suitable test runtime provider was found for any source in this run. + Не найден подходящий поставщик среды выполнения теста для этого запуска. @@ -177,6 +177,16 @@ Вложения: + + No suitable test runtime provider was found: + No suitable test runtime provider was found: + + + + Skipping source: + Skipping source: + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.tr.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.tr.xlf index e0f1397ff7..2dae4e8f5c 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.tr.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.tr.xlf @@ -158,8 +158,8 @@ - No suitable test runtime provider found for this run. - Bu çalıştırma için uygun bir test çalışma zamanı sağlayıcısı yok. + No suitable test runtime provider was found for any source in this run. + Bu çalıştırma için uygun bir test çalışma zamanı sağlayıcısı yok. @@ -177,6 +177,16 @@ Ekler: + + No suitable test runtime provider was found: + No suitable test runtime provider was found: + + + + Skipping source: + Skipping source: + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.xlf index 4c6eba4a84..2cd35c2e0b 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.xlf @@ -144,7 +144,7 @@ - No suitable test runtime provider found for this run. + No suitable test runtime provider was found for any source in this run. No suitable test runtime provider found for this run. @@ -163,6 +163,16 @@ Attachments: + + No suitable test runtime provider was found: + No suitable test runtime provider was found: + + + + Skipping source: + Skipping source: + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.zh-Hans.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.zh-Hans.xlf index e6cb06ca3a..e8c460aa96 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.zh-Hans.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.zh-Hans.xlf @@ -158,8 +158,8 @@ - No suitable test runtime provider found for this run. - 对于此运行,未找到适合的测试运行时提供程序。 + No suitable test runtime provider was found for any source in this run. + 对于此运行,未找到适合的测试运行时提供程序。 @@ -177,6 +177,16 @@ 附件: + + No suitable test runtime provider was found: + No suitable test runtime provider was found: + + + + Skipping source: + Skipping source: + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.zh-Hant.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.zh-Hant.xlf index a3e7d4a62c..71b3b643da 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.zh-Hant.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.zh-Hant.xlf @@ -158,8 +158,8 @@ - No suitable test runtime provider found for this run. - 找不到適用於此回合的測試執行階段提供者。 + No suitable test runtime provider was found for any source in this run. + 找不到適用於此回合的測試執行階段提供者。 @@ -177,6 +177,16 @@ 附件: + + No suitable test runtime provider was found: + No suitable test runtime provider was found: + + + + Skipping source: + Skipping source: + + \ No newline at end of file From 9872b7c6a6e615e89d61d391f26f6bd8dcb6d152 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jare=C5=A1?= Date: Tue, 14 Jun 2022 16:14:46 +0200 Subject: [PATCH 03/12] Wrap discovered sources --- playground/TestPlatform.Playground/Program.cs | 6 +- .../Messages/DiscoveryCompletePayload.cs | 7 +- .../ParallelDiscoveryEventsHandler.cs | 8 +- .../Discovery/DiscoveryManager.cs | 12 +- .../Events/DiscoveryCompleteEventArgs.cs | 25 ++++- .../EventHandler/DiscoveryEventHandler.cs | 6 +- .../TestPlatformTests.cs | 69 ++++++------ .../TestEngineTests.cs | 96 +++++++++------- .../VsTestConsoleRequestSenderTests.cs | 8 +- ...llyQualifiedTestsArgumentProcessorTests.cs | 12 +- .../ListTestsArgumentProcessorTests.cs | 10 +- .../RunSpecificTestsArgumentProcessorTests.cs | 62 +++++------ .../RunTestsArgumentProcessorTests.cs | 10 +- .../TestRequestManagerTests.cs | 104 +++++++++--------- 14 files changed, 238 insertions(+), 197 deletions(-) diff --git a/playground/TestPlatform.Playground/Program.cs b/playground/TestPlatform.Playground/Program.cs index 3520b7b67b..1ef9285ea4 100644 --- a/playground/TestPlatform.Playground/Program.cs +++ b/playground/TestPlatform.Playground/Program.cs @@ -163,9 +163,9 @@ private static string WriteTests(IEnumerable testCases) ? "\t" + string.Join("\n\t", testCases.Select(r => r.Source + " " + r.DisplayName)) : "\t"; - private static string WriteSources(IEnumerable sources) - => sources?.Any() == true - ? "\t" + string.Join("\n\t", sources) + private static string WriteSources(IEnumerable sources) + => sources?.Select(s => s.Source).Any() == true + ? "\t" + string.Join("\n\t", sources.Select(s => s.Source)) : "\t"; } diff --git a/src/Microsoft.TestPlatform.CommunicationUtilities/Messages/DiscoveryCompletePayload.cs b/src/Microsoft.TestPlatform.CommunicationUtilities/Messages/DiscoveryCompletePayload.cs index d08b59dc2d..d6823b61e8 100644 --- a/src/Microsoft.TestPlatform.CommunicationUtilities/Messages/DiscoveryCompletePayload.cs +++ b/src/Microsoft.TestPlatform.CommunicationUtilities/Messages/DiscoveryCompletePayload.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using Microsoft.VisualStudio.TestPlatform.ObjectModel; +using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client; #nullable disable @@ -37,17 +38,17 @@ public class DiscoveryCompletePayload /// /// Gets or sets list of sources which were fully discovered. /// - public IList FullyDiscoveredSources { get; set; } = new List(); + public IList FullyDiscoveredSources { get; set; } = new List(); /// /// Gets or sets list of sources which were partially discovered (started discover tests, but then discovery aborted). /// - public IList PartiallyDiscoveredSources { get; set; } = new List(); + public IList PartiallyDiscoveredSources { get; set; } = new List(); /// /// Gets or sets list of sources which were not discovered at all. /// - public IList NotDiscoveredSources { get; set; } = new List(); + public IList NotDiscoveredSources { get; set; } = new List(); /// /// Gets or sets the collection of discovered extensions. diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/ParallelDiscoveryEventsHandler.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/ParallelDiscoveryEventsHandler.cs index c3d9f18b22..0ff75ec9e7 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/ParallelDiscoveryEventsHandler.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/ParallelDiscoveryEventsHandler.cs @@ -1,7 +1,9 @@ // 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; using System.Collections.Generic; +using System.Linq; using Microsoft.VisualStudio.TestPlatform.Common.Telemetry; using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities; @@ -86,9 +88,9 @@ public void HandleDiscoveryComplete(DiscoveryCompleteEventArgs discoveryComplete // Manager said we are ready to publish the test discovery completed and we haven't yet // published it. - var fullyDiscovered = _discoveryDataAggregator.GetSourcesWithStatus(DiscoveryStatus.FullyDiscovered); - var partiallyDiscovered = _discoveryDataAggregator.GetSourcesWithStatus(DiscoveryStatus.PartiallyDiscovered); - var notDiscovered = _discoveryDataAggregator.GetSourcesWithStatus(DiscoveryStatus.NotDiscovered); + var fullyDiscovered = DiscoveredSource.ToDiscoveredSources(_discoveryDataAggregator.GetSourcesWithStatus(DiscoveryStatus.FullyDiscovered)); + var partiallyDiscovered = DiscoveredSource.ToDiscoveredSources(_discoveryDataAggregator.GetSourcesWithStatus(DiscoveryStatus.PartiallyDiscovered)); + var notDiscovered = DiscoveredSource.ToDiscoveredSources(_discoveryDataAggregator.GetSourcesWithStatus(DiscoveryStatus.NotDiscovered)); // As we immediately return results to IDE in case of aborting we need to set // isAborted = true and totalTests = -1 diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Discovery/DiscoveryManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Discovery/DiscoveryManager.cs index 21a79ac77e..030c18866f 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Discovery/DiscoveryManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Discovery/DiscoveryManager.cs @@ -172,9 +172,9 @@ public void DiscoverTests(DiscoveryCriteria discoveryCriteria, ITestDiscoveryEve var discoveryCompleteEventsArgs = new DiscoveryCompleteEventArgs(isAborted ? -1 : totalDiscoveredTestCount, isAborted) { - FullyDiscoveredSources = _discoveryDataAggregator.GetSourcesWithStatus(DiscoveryStatus.FullyDiscovered), - PartiallyDiscoveredSources = _discoveryDataAggregator.GetSourcesWithStatus(DiscoveryStatus.PartiallyDiscovered), - NotDiscoveredSources = _discoveryDataAggregator.GetSourcesWithStatus(DiscoveryStatus.NotDiscovered), + FullyDiscoveredSources = DiscoveredSource.ToDiscoveredSources(_discoveryDataAggregator.GetSourcesWithStatus(DiscoveryStatus.FullyDiscovered)), + PartiallyDiscoveredSources = DiscoveredSource.ToDiscoveredSources(_discoveryDataAggregator.GetSourcesWithStatus(DiscoveryStatus.PartiallyDiscovered)), + NotDiscoveredSources = DiscoveredSource.ToDiscoveredSources(_discoveryDataAggregator.GetSourcesWithStatus(DiscoveryStatus.NotDiscovered)), DiscoveredExtensions = TestPluginCache.Instance.TestExtensions?.GetCachedExtensions(), Metrics = _requestData.MetricsCollection.Metrics, }; @@ -211,9 +211,9 @@ public void Abort(ITestDiscoveryEventsHandler2 eventHandler) var discoveryCompleteEventArgs = new DiscoveryCompleteEventArgs(-1, true) { - FullyDiscoveredSources = _discoveryDataAggregator.GetSourcesWithStatus(DiscoveryStatus.FullyDiscovered), - PartiallyDiscoveredSources = _discoveryDataAggregator.GetSourcesWithStatus(DiscoveryStatus.PartiallyDiscovered), - NotDiscoveredSources = _discoveryDataAggregator.GetSourcesWithStatus(DiscoveryStatus.NotDiscovered), + FullyDiscoveredSources = DiscoveredSource.ToDiscoveredSources(_discoveryDataAggregator.GetSourcesWithStatus(DiscoveryStatus.FullyDiscovered)), + PartiallyDiscoveredSources = DiscoveredSource.ToDiscoveredSources(_discoveryDataAggregator.GetSourcesWithStatus(DiscoveryStatus.PartiallyDiscovered)), + NotDiscoveredSources = DiscoveredSource.ToDiscoveredSources(_discoveryDataAggregator.GetSourcesWithStatus(DiscoveryStatus.NotDiscovered)), }; eventHandler.HandleDiscoveryComplete(discoveryCompleteEventArgs, null); } diff --git a/src/Microsoft.TestPlatform.ObjectModel/Client/Events/DiscoveryCompleteEventArgs.cs b/src/Microsoft.TestPlatform.ObjectModel/Client/Events/DiscoveryCompleteEventArgs.cs index c7334ec504..9d7d667afc 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Client/Events/DiscoveryCompleteEventArgs.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/Client/Events/DiscoveryCompleteEventArgs.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.Linq; using System.Runtime.Serialization; #nullable disable @@ -50,19 +51,25 @@ public DiscoveryCompleteEventArgs(long totalTests, bool isAborted) /// Gets the list of sources which were fully discovered. /// [DataMember] - public IList FullyDiscoveredSources { get; set; } = new List(); + public IList FullyDiscoveredSources { get; set; } = new List(); /// /// Gets the list of sources which were partially discovered (started discover tests, but then discovery aborted). /// [DataMember] - public IList PartiallyDiscoveredSources { get; set; } = new List(); + public IList PartiallyDiscoveredSources { get; set; } = new List(); + + /// + /// Gets a list of sources that were skipped during discovery. + /// + [DataMember] + public IList SkippedDiscoveredSources { get; set; } = new List(); /// /// Gets the list of sources which were not discovered at all. /// [DataMember] - public IList NotDiscoveredSources { get; set; } = new List(); + public IList NotDiscoveredSources { get; set; } = new List(); /// /// Gets or sets the collection of discovered extensions. @@ -70,3 +77,15 @@ public DiscoveryCompleteEventArgs(long totalTests, bool isAborted) [DataMember] public Dictionary> DiscoveredExtensions { get; set; } = new(); } + + +public class DiscoveredSource +{ + [DataMember] + public string Source { get; set; } + + public static List ToDiscoveredSources(List sources) + { + return sources.Select(source => new DiscoveredSource { Source = source }).ToList(); + } +} diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/TranslationLayerTests/EventHandler/DiscoveryEventHandler.cs b/test/Microsoft.TestPlatform.AcceptanceTests/TranslationLayerTests/EventHandler/DiscoveryEventHandler.cs index 5f7b825de2..11418bc454 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/TranslationLayerTests/EventHandler/DiscoveryEventHandler.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/TranslationLayerTests/EventHandler/DiscoveryEventHandler.cs @@ -73,9 +73,9 @@ public class DiscoveryEventHandler2 : ITestDiscoveryEventsHandler2 /// public List DiscoveredTestCases { get; } - public IList FullyDiscoveredSources { get; private set; } - public IList PartiallyDiscoveredSources { get; private set; } - public IList NotDiscoveredSources { get; private set; } + public IList FullyDiscoveredSources { get; private set; } + public IList PartiallyDiscoveredSources { get; private set; } + public IList NotDiscoveredSources { get; private set; } public List TestMessages; diff --git a/test/Microsoft.TestPlatform.Client.UnitTests/TestPlatformTests.cs b/test/Microsoft.TestPlatform.Client.UnitTests/TestPlatformTests.cs index ae968206a4..14f69fe448 100644 --- a/test/Microsoft.TestPlatform.Client.UnitTests/TestPlatformTests.cs +++ b/test/Microsoft.TestPlatform.Client.UnitTests/TestPlatformTests.cs @@ -55,12 +55,12 @@ public void CreateDiscoveryRequestShouldInitializeDiscoveryManagerAndCreateDisco _hostManager.Setup(hm => hm.GetTestSources(discoveryCriteria.Sources)) .Returns(discoveryCriteria.Sources); - _testEngine.Setup(te => te.GetDiscoveryManager(_mockRequestData.Object, It.IsAny(), It.IsAny>())).Returns(_discoveryManager.Object); + _testEngine.Setup(te => te.GetDiscoveryManager(_mockRequestData.Object, It.IsAny(), It.IsAny>(), It.IsAny())).Returns(_discoveryManager.Object); _testEngine.Setup(te => te.GetExtensionManager()).Returns(_extensionManager.Object); _testEngine.Setup(te => te.GetLoggerManager(_mockRequestData.Object)).Returns(_loggerManager.Object); var tp = new TestableTestPlatform(_testEngine.Object, _hostManager.Object); - var discoveryRequest = tp.CreateDiscoveryRequest(_mockRequestData.Object, discoveryCriteria, new TestPlatformOptions(), It.IsAny>()); + var discoveryRequest = tp.CreateDiscoveryRequest(_mockRequestData.Object, discoveryCriteria, new TestPlatformOptions(), It.IsAny>(), It.IsAny()); _discoveryManager.Verify(dm => dm.Initialize(false), Times.Once); Assert.AreEqual(discoveryCriteria, discoveryRequest.DiscoveryCriteria); @@ -105,7 +105,7 @@ public void CreateDiscoveryRequestThrowsIfDiscoveryCriteriaIsNull() { TestPlatform tp = new(); - Assert.ThrowsException(() => tp.CreateDiscoveryRequest(_mockRequestData.Object, null!, new TestPlatformOptions(), It.IsAny>())); + Assert.ThrowsException(() => tp.CreateDiscoveryRequest(_mockRequestData.Object, null!, new TestPlatformOptions(), It.IsAny>(), It.IsAny())); } [TestMethod] @@ -152,13 +152,13 @@ public void CreateTestRunRequestShouldUpdateLoggerExtensionWhenDesingModeIsFalse _hostManager.Setup(hm => hm.GetTestSources(testRunCriteria.Sources)) .Returns(testRunCriteria.Sources); - _testEngine.Setup(te => te.GetExecutionManager(_mockRequestData.Object, It.IsAny(), It.IsAny>())).Returns(_executionManager.Object); + _testEngine.Setup(te => te.GetExecutionManager(_mockRequestData.Object, It.IsAny(), It.IsAny>(), It.IsAny())).Returns(_executionManager.Object); _testEngine.Setup(te => te.GetExtensionManager()).Returns(_extensionManager.Object); _testEngine.Setup(te => te.GetLoggerManager(_mockRequestData.Object)).Returns(_loggerManager.Object); var tp = new TestableTestPlatform(_testEngine.Object, _mockFileHelper.Object, _hostManager.Object); - var testRunRequest = tp.CreateTestRunRequest(_mockRequestData.Object, testRunCriteria, new TestPlatformOptions(), It.IsAny>()); + var testRunRequest = tp.CreateTestRunRequest(_mockRequestData.Object, testRunCriteria, new TestPlatformOptions(), It.IsAny>(), It.IsAny()); _extensionManager.Verify(em => em.UseAdditionalExtensions(additionalExtensions, false)); } @@ -181,13 +181,13 @@ public void CreateTestRunRequestShouldUpdateLoggerExtensionWhenDesignModeIsFalse var testRunCriteria = new TestRunCriteria(new List { new TestCase("dll1.class1.test1", new Uri("hello://x/"), $"xyz{Path.DirectorySeparatorChar}1.dll") }, 10, false, settingsXml); - _testEngine.Setup(te => te.GetExecutionManager(_mockRequestData.Object, It.IsAny(), It.IsAny>())).Returns(_executionManager.Object); + _testEngine.Setup(te => te.GetExecutionManager(_mockRequestData.Object, It.IsAny(), It.IsAny>(), It.IsAny())).Returns(_executionManager.Object); _testEngine.Setup(te => te.GetExtensionManager()).Returns(_extensionManager.Object); _testEngine.Setup(te => te.GetLoggerManager(_mockRequestData.Object)).Returns(_loggerManager.Object); var tp = new TestableTestPlatform(_testEngine.Object, _mockFileHelper.Object, _hostManager.Object); - var testRunRequest = tp.CreateTestRunRequest(_mockRequestData.Object, testRunCriteria, new TestPlatformOptions(), It.IsAny>()); + var testRunRequest = tp.CreateTestRunRequest(_mockRequestData.Object, testRunCriteria, new TestPlatformOptions(), It.IsAny>(), It.IsAny()); _extensionManager.Verify(em => em.UseAdditionalExtensions(additionalExtensions, false)); } @@ -212,13 +212,13 @@ public void CreateTestRunRequestShouldNotUpdateTestSourcesIfSelectedTestAreRun() _hostManager.Setup(hm => hm.GetTestSources(It.IsAny>())) .Returns(new List { $"xyz{Path.DirectorySeparatorChar}1.dll" }); - _testEngine.Setup(te => te.GetExecutionManager(_mockRequestData.Object, It.IsAny(), It.IsAny>())).Returns(_executionManager.Object); + _testEngine.Setup(te => te.GetExecutionManager(_mockRequestData.Object, It.IsAny(), It.IsAny>(), It.IsAny())).Returns(_executionManager.Object); _testEngine.Setup(te => te.GetExtensionManager()).Returns(_extensionManager.Object); _testEngine.Setup(te => te.GetLoggerManager(_mockRequestData.Object)).Returns(_loggerManager.Object); var tp = new TestableTestPlatform(_testEngine.Object, _mockFileHelper.Object, _hostManager.Object); - tp.CreateTestRunRequest(_mockRequestData.Object, testRunCriteria, new TestPlatformOptions(), It.IsAny>()); + tp.CreateTestRunRequest(_mockRequestData.Object, testRunCriteria, new TestPlatformOptions(), It.IsAny>(), It.IsAny()); _extensionManager.Verify(em => em.UseAdditionalExtensions(additionalExtensions, false)); _hostManager.Verify(hm => hm.GetTestSources(It.IsAny>()), Times.Never); } @@ -227,7 +227,7 @@ public void CreateTestRunRequestShouldNotUpdateTestSourcesIfSelectedTestAreRun() public void CreateTestRunRequestShouldInitializeManagersAndCreateTestRunRequestWithSpecifiedCriteria() { _executionManager.Setup(dm => dm.Initialize(false)).Verifiable(); - _testEngine.Setup(te => te.GetExecutionManager(_mockRequestData.Object, It.IsAny(), It.IsAny>())).Returns(_executionManager.Object); + _testEngine.Setup(te => te.GetExecutionManager(_mockRequestData.Object, It.IsAny(), It.IsAny>(), It.IsAny())).Returns(_executionManager.Object); _testEngine.Setup(te => te.GetExtensionManager()).Returns(_extensionManager.Object); _testEngine.Setup(te => te.GetLoggerManager(_mockRequestData.Object)).Returns(_loggerManager.Object); @@ -236,7 +236,7 @@ public void CreateTestRunRequestShouldInitializeManagersAndCreateTestRunRequestW _hostManager.Setup(hm => hm.GetTestSources(testRunCriteria.Sources)) .Returns(testRunCriteria.Sources); - var testRunRequest = tp.CreateTestRunRequest(_mockRequestData.Object, testRunCriteria, new TestPlatformOptions(), It.IsAny>()); + var testRunRequest = tp.CreateTestRunRequest(_mockRequestData.Object, testRunCriteria, new TestPlatformOptions(), It.IsAny>(), It.IsAny()); var actualTestRunRequest = testRunRequest as TestRunRequest; @@ -283,7 +283,7 @@ public void CreateTestRunRequestThrowsIfTestRunCriteriaIsNull() { var tp = new TestPlatform(); - Assert.ThrowsException(() => tp.CreateTestRunRequest(_mockRequestData.Object, null!, new TestPlatformOptions(), It.IsAny>())); + Assert.ThrowsException(() => tp.CreateTestRunRequest(_mockRequestData.Object, null!, new TestPlatformOptions(), It.IsAny>(), It.IsAny())); } /// @@ -311,13 +311,13 @@ public void CreateDiscoveryRequestShouldUpdateLoggerExtensionWhenDesignModeIsFal _hostManager.Setup(hm => hm.GetTestSources(discoveryCriteria.Sources)) .Returns(discoveryCriteria.Sources); - _testEngine.Setup(te => te.GetDiscoveryManager(It.IsAny(), It.IsAny(), It.IsAny>())).Returns(_discoveryManager.Object); + _testEngine.Setup(te => te.GetDiscoveryManager(It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Returns(_discoveryManager.Object); _testEngine.Setup(te => te.GetExtensionManager()).Returns(_extensionManager.Object); _testEngine.Setup(te => te.GetLoggerManager(_mockRequestData.Object)).Returns(_loggerManager.Object); var tp = new TestableTestPlatform(_testEngine.Object, _mockFileHelper.Object, _hostManager.Object); // Action - var discoveryRequest = tp.CreateDiscoveryRequest(_mockRequestData.Object, discoveryCriteria, new TestPlatformOptions(), It.IsAny>()); + var discoveryRequest = tp.CreateDiscoveryRequest(_mockRequestData.Object, discoveryCriteria, new TestPlatformOptions(), It.IsAny>(), It.IsAny()); // Verify _extensionManager.Verify(em => em.UseAdditionalExtensions(additionalExtensions, false)); @@ -329,7 +329,7 @@ public void CreateDiscoveryRequestShouldUpdateLoggerExtensionWhenDesignModeIsFal [TestMethod] public void CreateTestRunRequestShouldInitializeLoggerManagerForDesignMode() { - _testEngine.Setup(te => te.GetExecutionManager(_mockRequestData.Object, It.IsAny(), It.IsAny>())).Returns(_executionManager.Object); + _testEngine.Setup(te => te.GetExecutionManager(_mockRequestData.Object, It.IsAny(), It.IsAny>(), It.IsAny())).Returns(_executionManager.Object); _testEngine.Setup(te => te.GetLoggerManager(_mockRequestData.Object)).Returns(_loggerManager.Object); string settingsXml = @@ -342,7 +342,7 @@ public void CreateTestRunRequestShouldInitializeLoggerManagerForDesignMode() var testRunCriteria = new TestRunCriteria(new List { @"x:dummy\foo.dll" }, 10, false, settingsXml); var tp = new TestableTestPlatform(_testEngine.Object, _hostManager.Object); - tp.CreateTestRunRequest(_mockRequestData.Object, testRunCriteria, new TestPlatformOptions(), It.IsAny>()); + tp.CreateTestRunRequest(_mockRequestData.Object, testRunCriteria, new TestPlatformOptions(), It.IsAny>(), It.IsAny()); _loggerManager.Verify(lm => lm.Initialize(settingsXml)); } @@ -353,7 +353,7 @@ public void CreateTestRunRequestShouldInitializeLoggerManagerForDesignMode() [TestMethod] public void CreateDiscoveryRequestShouldInitializeLoggerManagerForDesignMode() { - _testEngine.Setup(te => te.GetDiscoveryManager(_mockRequestData.Object, It.IsAny(), It.IsAny>())).Returns(_discoveryManager.Object); + _testEngine.Setup(te => te.GetDiscoveryManager(_mockRequestData.Object, It.IsAny(), It.IsAny>(), It.IsAny())).Returns(_discoveryManager.Object); _testEngine.Setup(te => te.GetLoggerManager(_mockRequestData.Object)).Returns(_loggerManager.Object); string settingsXml = @@ -366,7 +366,7 @@ public void CreateDiscoveryRequestShouldInitializeLoggerManagerForDesignMode() var discoveryCriteria = new DiscoveryCriteria(new List { @"x:dummy\foo.dll" }, 10, settingsXml); var tp = new TestableTestPlatform(_testEngine.Object, _hostManager.Object); - tp.CreateDiscoveryRequest(_mockRequestData.Object, discoveryCriteria, new TestPlatformOptions(), It.IsAny>()); + tp.CreateDiscoveryRequest(_mockRequestData.Object, discoveryCriteria, new TestPlatformOptions(), It.IsAny>(), It.IsAny()); _loggerManager.Verify(lm => lm.Initialize(settingsXml)); } @@ -377,7 +377,7 @@ public void CreateDiscoveryRequestShouldInitializeLoggerManagerForDesignMode() [TestMethod] public void CreateTestRunRequestShouldInitializeLoggerManagerForNonDesignMode() { - _testEngine.Setup(te => te.GetExecutionManager(_mockRequestData.Object, It.IsAny(), It.IsAny>())).Returns(_executionManager.Object); + _testEngine.Setup(te => te.GetExecutionManager(_mockRequestData.Object, It.IsAny(), It.IsAny>(), It.IsAny())).Returns(_executionManager.Object); _testEngine.Setup(te => te.GetLoggerManager(_mockRequestData.Object)).Returns(_loggerManager.Object); string settingsXml = @@ -390,7 +390,7 @@ public void CreateTestRunRequestShouldInitializeLoggerManagerForNonDesignMode() var testRunCriteria = new TestRunCriteria(new List { "foo" }, 10, false, settingsXml); var tp = new TestableTestPlatform(_testEngine.Object, _hostManager.Object); - tp.CreateTestRunRequest(_mockRequestData.Object, testRunCriteria, new TestPlatformOptions(), It.IsAny>()); + tp.CreateTestRunRequest(_mockRequestData.Object, testRunCriteria, new TestPlatformOptions(), It.IsAny>(), It.IsAny()); _loggerManager.Verify(lm => lm.Initialize(settingsXml)); } @@ -401,7 +401,7 @@ public void CreateTestRunRequestShouldInitializeLoggerManagerForNonDesignMode() [TestMethod] public void CreateDiscoveryRequestShouldInitializeLoggerManagerForNonDesignMode() { - _testEngine.Setup(te => te.GetDiscoveryManager(_mockRequestData.Object, It.IsAny(), It.IsAny>())).Returns(_discoveryManager.Object); + _testEngine.Setup(te => te.GetDiscoveryManager(_mockRequestData.Object, It.IsAny(), It.IsAny>(), It.IsAny())).Returns(_discoveryManager.Object); _testEngine.Setup(te => te.GetLoggerManager(_mockRequestData.Object)).Returns(_loggerManager.Object); string settingsXml = @@ -414,7 +414,7 @@ public void CreateDiscoveryRequestShouldInitializeLoggerManagerForNonDesignMode( var discoveryCriteria = new DiscoveryCriteria(new List { "foo" }, 10, settingsXml); var tp = new TestableTestPlatform(_testEngine.Object, _hostManager.Object); - tp.CreateDiscoveryRequest(_mockRequestData.Object, discoveryCriteria, new TestPlatformOptions(), It.IsAny>()); + tp.CreateDiscoveryRequest(_mockRequestData.Object, discoveryCriteria, new TestPlatformOptions(), It.IsAny>(), It.IsAny()); _loggerManager.Verify(lm => lm.Initialize(settingsXml)); } @@ -429,7 +429,8 @@ public void StartTestSessionShouldThrowExceptionIfTestSessionCriteriaIsNull() new Mock().Object, null!, new Mock().Object, - new Dictionary())); + new Dictionary(), + new Mock().Object)); } [TestMethod] @@ -452,7 +453,7 @@ public void StartTestSessionShouldReturnFalseIfDesignModeIsDisabled() new Mock().Object, testSessionCriteria, new Mock().Object, - It.IsAny>())); + It.IsAny>(), It.IsAny())); } [TestMethod] @@ -462,7 +463,7 @@ public void StartTestSessionShouldReturnFalseIfTestSessionManagerIsNull() te => te.GetTestSessionManager( It.IsAny(), It.IsAny(), - It.IsAny>())) + It.IsAny>(), It.IsAny())) .Returns((IProxyTestSessionManager)null!); var tp = new TestableTestPlatform(_testEngine.Object, _hostManager.Object); @@ -492,7 +493,7 @@ public void StartTestSessionShouldReturnFalseIfTestSessionManagerIsNull() new Mock().Object, testSessionCriteria, mockEventsHandler.Object, - It.IsAny>())); + It.IsAny>(), It.IsAny())); mockEventsHandler.Verify( eh => eh.HandleStartTestSessionComplete(It.IsAny()), @@ -526,7 +527,7 @@ public void StartTestSessionShouldReturnTrueIfTestSessionManagerStartSessionRetu te => te.GetTestSessionManager( It.IsAny(), It.IsAny(), - It.IsAny>())) + It.IsAny>(), It.IsAny())) .Returns(mockTestSessionManager.Object); Assert.IsTrue( @@ -534,7 +535,7 @@ public void StartTestSessionShouldReturnTrueIfTestSessionManagerStartSessionRetu new Mock().Object, testSessionCriteria, mockEventsHandler.Object, - It.IsAny>())); + It.IsAny>(), It.IsAny())); mockTestSessionManager.Verify( tsm => tsm.StartSession(mockEventsHandler.Object, It.IsAny()), @@ -568,7 +569,7 @@ public void StartTestSessionShouldReturnFalseIfTestSessionManagerStartSessionRet te => te.GetTestSessionManager( It.IsAny(), It.IsAny(), - It.IsAny>())) + It.IsAny>(), It.IsAny())) .Returns(mockTestSessionManager.Object); Assert.IsFalse( @@ -576,7 +577,7 @@ public void StartTestSessionShouldReturnFalseIfTestSessionManagerStartSessionRet mockRequestData.Object, testSessionCriteria, mockEventsHandler.Object, - It.IsAny>())); + It.IsAny>(), It.IsAny())); mockTestSessionManager.Verify( tsm => tsm.StartSession(mockEventsHandler.Object, mockRequestData.Object), @@ -590,18 +591,18 @@ private void InvokeCreateDiscoveryRequest(TestPlatformOptions? options = null) _hostManager.Setup(hm => hm.GetTestSources(discoveryCriteria.Sources)) .Returns(discoveryCriteria.Sources); - _testEngine.Setup(te => te.GetDiscoveryManager(_mockRequestData.Object, It.IsAny(), It.IsAny>())).Returns(_discoveryManager.Object); + _testEngine.Setup(te => te.GetDiscoveryManager(_mockRequestData.Object, It.IsAny(), It.IsAny>(), It.IsAny())).Returns(_discoveryManager.Object); _testEngine.Setup(te => te.GetExtensionManager()).Returns(_extensionManager.Object); _testEngine.Setup(te => te.GetLoggerManager(_mockRequestData.Object)).Returns(_loggerManager.Object); var tp = new TestableTestPlatform(_testEngine.Object, _hostManager.Object); - tp.CreateDiscoveryRequest(_mockRequestData.Object, discoveryCriteria, options, new Dictionary()); + tp.CreateDiscoveryRequest(_mockRequestData.Object, discoveryCriteria, options, new Dictionary(), new Mock().Object); } private void InvokeCreateTestRunRequest(TestPlatformOptions? options = null) { _executionManager.Setup(dm => dm.Initialize(false)).Verifiable(); - _testEngine.Setup(te => te.GetExecutionManager(_mockRequestData.Object, It.IsAny(), It.IsAny>())).Returns(_executionManager.Object); + _testEngine.Setup(te => te.GetExecutionManager(_mockRequestData.Object, It.IsAny(), It.IsAny>(), It.IsAny())).Returns(_executionManager.Object); _testEngine.Setup(te => te.GetExtensionManager()).Returns(_extensionManager.Object); _testEngine.Setup(te => te.GetLoggerManager(_mockRequestData.Object)).Returns(_loggerManager.Object); @@ -610,7 +611,7 @@ private void InvokeCreateTestRunRequest(TestPlatformOptions? options = null) _hostManager.Setup(hm => hm.GetTestSources(testRunCriteria.Sources)) .Returns(testRunCriteria.Sources); - tp.CreateTestRunRequest(_mockRequestData.Object, testRunCriteria, options, new Dictionary()); + tp.CreateTestRunRequest(_mockRequestData.Object, testRunCriteria, options, new Dictionary(), new Mock().Object); } private class TestableTestPlatform : TestPlatform diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/TestEngineTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/TestEngineTests.cs index 6a62a2657d..b1678cce6a 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/TestEngineTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/TestEngineTests.cs @@ -57,7 +57,7 @@ public void GetDiscoveryManagerShouldReturnANonNullInstance() ["1.dll"] = new SourceDetail { Source = "1.dll", Architecture = Architecture.X86, Framework = Framework.DefaultFramework }, }; - Assert.IsNotNull(_testEngine.GetDiscoveryManager(_mockRequestData.Object, discoveryCriteria, sourceToSourceDetailMap)); + Assert.IsNotNull(_testEngine.GetDiscoveryManager(_mockRequestData.Object, discoveryCriteria, sourceToSourceDetailMap, new Mock().Object)); } @@ -76,7 +76,7 @@ public void GetDiscoveryManagerShouldReturnParallelProxyDiscoveryManagerIfNotRun ["1.dll"] = new SourceDetail { Source = "1.dll", Architecture = Architecture.X86, Framework = Framework.DefaultFramework }, }; - var discoveryManager = _testEngine.GetDiscoveryManager(_mockRequestData.Object, discoveryCriteria, sourceToSourceDetailMap); + var discoveryManager = _testEngine.GetDiscoveryManager(_mockRequestData.Object, discoveryCriteria, sourceToSourceDetailMap, new Mock().Object); Assert.IsNotNull(discoveryManager); Assert.IsInstanceOfType(discoveryManager, typeof(ParallelProxyDiscoveryManager)); } @@ -98,7 +98,7 @@ public void GetDiscoveryManagerShouldNotReturnInProcessProxyDiscoveryManagerIfCu _mockProcessHelper.Setup(o => o.GetCurrentProcessFileName()).Returns("dotnet.exe"); - var discoveryManager = _testEngine.GetDiscoveryManager(_mockRequestData.Object, discoveryCriteria, sourceToSourceDetailMap); + var discoveryManager = _testEngine.GetDiscoveryManager(_mockRequestData.Object, discoveryCriteria, sourceToSourceDetailMap, new Mock().Object); Assert.IsNotNull(discoveryManager); Assert.IsNotInstanceOfType(discoveryManager, typeof(InProcessProxyDiscoveryManager)); } @@ -122,7 +122,7 @@ public void GetDiscoveryManagerShouldNotReturnInProcessProxyDiscoveryManagerIfDi ["1.dll"] = new SourceDetail { Source = "1.dll", Architecture = Architecture.X86, Framework = Framework.DefaultFramework }, }; - var discoveryManager = _testEngine.GetDiscoveryManager(_mockRequestData.Object, discoveryCriteria, sourceToSourceDetailMap); + var discoveryManager = _testEngine.GetDiscoveryManager(_mockRequestData.Object, discoveryCriteria, sourceToSourceDetailMap, new Mock().Object); Assert.IsNotNull(discoveryManager); Assert.IsNotInstanceOfType(discoveryManager, typeof(InProcessProxyDiscoveryManager)); } @@ -146,7 +146,7 @@ public void GetDiscoveryManagerShouldNotReturnInProcessProxyDiscoveryManagerIfDe ["1.dll"] = new SourceDetail { Source = "1.dll", Architecture = Architecture.X86, Framework = Framework.DefaultFramework }, }; - var discoveryManager = _testEngine.GetDiscoveryManager(_mockRequestData.Object, discoveryCriteria, sourceToSourceDetailMap); + var discoveryManager = _testEngine.GetDiscoveryManager(_mockRequestData.Object, discoveryCriteria, sourceToSourceDetailMap, new Mock().Object); Assert.IsNotNull(discoveryManager); Assert.IsNotInstanceOfType(discoveryManager, typeof(InProcessProxyDiscoveryManager)); } @@ -170,7 +170,7 @@ public void GetDiscoveryManagerShouldNotReturnInProcessProxyDiscoveryManagereIfT ["1.dll"] = new SourceDetail { Source = "1.dll", Architecture = Architecture.X86, Framework = Framework.DefaultFramework }, }; - var discoveryManager = _testEngine.GetDiscoveryManager(_mockRequestData.Object, discoveryCriteria, sourceToSourceDetailMap); + var discoveryManager = _testEngine.GetDiscoveryManager(_mockRequestData.Object, discoveryCriteria, sourceToSourceDetailMap, new Mock().Object); Assert.IsNotNull(discoveryManager); Assert.IsNotInstanceOfType(discoveryManager, typeof(InProcessProxyDiscoveryManager)); } @@ -194,7 +194,7 @@ public void GetDiscoveryManagerShouldNotReturnInProcessProxyDiscoveryManagereIfT ["1.dll"] = new SourceDetail { Source = "1.dll", Architecture = Architecture.X86, Framework = Framework.DefaultFramework }, }; - var discoveryManager = _testEngine.GetDiscoveryManager(_mockRequestData.Object, discoveryCriteria, sourceToSourceDetailMap); + var discoveryManager = _testEngine.GetDiscoveryManager(_mockRequestData.Object, discoveryCriteria, sourceToSourceDetailMap, new Mock().Object); Assert.IsNotNull(discoveryManager); Assert.IsNotInstanceOfType(discoveryManager, typeof(InProcessProxyDiscoveryManager)); } @@ -218,7 +218,7 @@ public void GetDiscoveryManagerShouldNotReturnInProcessProxyDiscoveryManagereIfT ["1.dll"] = new SourceDetail { Source = "1.dll", Architecture = Architecture.X86, Framework = Framework.DefaultFramework }, }; - var discoveryManager = _testEngine.GetDiscoveryManager(_mockRequestData.Object, discoveryCriteria, sourceToSourceDetailMap); + var discoveryManager = _testEngine.GetDiscoveryManager(_mockRequestData.Object, discoveryCriteria, sourceToSourceDetailMap, new Mock().Object); Assert.IsNotNull(discoveryManager); Assert.IsNotInstanceOfType(discoveryManager, typeof(InProcessProxyDiscoveryManager)); } @@ -245,7 +245,7 @@ public void GetDiscoveryManagerShouldNotReturnInProcessProxyDiscoveryManagereIfr ["1.dll"] = new SourceDetail { Source = "1.dll", Architecture = Architecture.X86, Framework = Framework.DefaultFramework }, }; - var discoveryManager = _testEngine.GetDiscoveryManager(_mockRequestData.Object, discoveryCriteria, sourceToSourceDetailMap); + var discoveryManager = _testEngine.GetDiscoveryManager(_mockRequestData.Object, discoveryCriteria, sourceToSourceDetailMap, new Mock().Object); Assert.IsNotNull(discoveryManager); Assert.IsNotInstanceOfType(discoveryManager, typeof(InProcessProxyDiscoveryManager)); } @@ -269,7 +269,7 @@ public void GetDiscoveryManagerShouldReturnsInProcessProxyDiscoveryManager() ["1.dll"] = new SourceDetail { Source = "1.dll", Architecture = Architecture.X86, Framework = Framework.DefaultFramework }, }; - var discoveryManager = _testEngine.GetDiscoveryManager(_mockRequestData.Object, discoveryCriteria, sourceToSourceDetailMap); + var discoveryManager = _testEngine.GetDiscoveryManager(_mockRequestData.Object, discoveryCriteria, sourceToSourceDetailMap, new Mock().Object); Assert.IsNotNull(discoveryManager); Assert.IsInstanceOfType(discoveryManager, typeof(InProcessProxyDiscoveryManager)); } @@ -284,7 +284,7 @@ public void GetExecutionManagerShouldReturnANonNullInstance() ["1.dll"] = new SourceDetail { Source = "1.dll", Architecture = Architecture.X86, Framework = Framework.DefaultFramework }, }; - Assert.IsNotNull(_testEngine.GetExecutionManager(_mockRequestData.Object, testRunCriteria, sourceToSourceDetailMap)); + Assert.IsNotNull(_testEngine.GetExecutionManager(_mockRequestData.Object, testRunCriteria, sourceToSourceDetailMap, new Mock().Object)); } [TestMethod] @@ -296,9 +296,9 @@ public void GetExecutionManagerShouldReturnNewInstance() { ["1.dll"] = new SourceDetail { Source = "1.dll", Architecture = Architecture.X86, Framework = Framework.DefaultFramework }, }; - var executionManager = _testEngine.GetExecutionManager(_mockRequestData.Object, testRunCriteria, sourceToSourceDetailMap); + var executionManager = _testEngine.GetExecutionManager(_mockRequestData.Object, testRunCriteria, sourceToSourceDetailMap, new Mock().Object); - Assert.AreNotSame(executionManager, _testEngine.GetExecutionManager(_mockRequestData.Object, testRunCriteria, sourceToSourceDetailMap)); + Assert.AreNotSame(executionManager, _testEngine.GetExecutionManager(_mockRequestData.Object, testRunCriteria, sourceToSourceDetailMap, new Mock().Object)); } [TestMethod] @@ -318,8 +318,8 @@ public void GetExecutionManagerShouldReturnParallelExecutionManagerIfParallelEna ["2.dll"] = new SourceDetail { Source = "2.dll", Architecture = Architecture.X86, Framework = Framework.DefaultFramework }, }; - Assert.IsNotNull(_testEngine.GetExecutionManager(_mockRequestData.Object, testRunCriteria, sourceToSourceDetailMap)); - Assert.IsInstanceOfType(_testEngine.GetExecutionManager(_mockRequestData.Object, testRunCriteria, sourceToSourceDetailMap), typeof(ParallelProxyExecutionManager)); + Assert.IsNotNull(_testEngine.GetExecutionManager(_mockRequestData.Object, testRunCriteria, sourceToSourceDetailMap, new Mock().Object)); + Assert.IsInstanceOfType(_testEngine.GetExecutionManager(_mockRequestData.Object, testRunCriteria, sourceToSourceDetailMap, new Mock().Object), typeof(ParallelProxyExecutionManager)); } [TestMethod] @@ -339,8 +339,8 @@ public void GetExecutionManagerShouldReturnParallelExecutionManagerIfHostIsNotSh ["2.dll"] = new SourceDetail { Source = "2.dll", Architecture = Architecture.X86, Framework = Framework.DefaultFramework }, }; - Assert.IsNotNull(_testEngine.GetExecutionManager(_mockRequestData.Object, testRunCriteria, sourceToSourceDetailMap)); - Assert.IsInstanceOfType(_testEngine.GetExecutionManager(_mockRequestData.Object, testRunCriteria, sourceToSourceDetailMap), typeof(ParallelProxyExecutionManager)); + Assert.IsNotNull(_testEngine.GetExecutionManager(_mockRequestData.Object, testRunCriteria, sourceToSourceDetailMap, new Mock().Object)); + Assert.IsInstanceOfType(_testEngine.GetExecutionManager(_mockRequestData.Object, testRunCriteria, sourceToSourceDetailMap, new Mock().Object), typeof(ParallelProxyExecutionManager)); } [TestMethod] @@ -363,7 +363,7 @@ public void GetExecutionManagerShouldNotReturnInProcessProxyexecutionManagerIfIn ["2.dll"] = new SourceDetail { Source = "2.dll", Architecture = Architecture.X86, Framework = Framework.DefaultFramework }, }; - var executionManager = _testEngine.GetExecutionManager(_mockRequestData.Object, testRunCriteria, sourceToSourceDetailMap); + var executionManager = _testEngine.GetExecutionManager(_mockRequestData.Object, testRunCriteria, sourceToSourceDetailMap, new Mock().Object); Assert.IsNotNull(executionManager); Assert.IsNotInstanceOfType(executionManager, typeof(InProcessProxyExecutionManager)); @@ -389,7 +389,7 @@ public void GetExecutionManagerShouldNotReturnInProcessProxyexecutionManagerIfPa ["2.dll"] = new SourceDetail { Source = "2.dll", Architecture = Architecture.X86, Framework = Framework.DefaultFramework }, }; - var executionManager = _testEngine.GetExecutionManager(_mockRequestData.Object, testRunCriteria, sourceToSourceDetailMap); + var executionManager = _testEngine.GetExecutionManager(_mockRequestData.Object, testRunCriteria, sourceToSourceDetailMap, new Mock().Object); Assert.IsNotNull(executionManager); Assert.IsNotInstanceOfType(executionManager, typeof(InProcessProxyExecutionManager)); @@ -421,7 +421,7 @@ public void GetExecutionManagerShouldNotReturnInProcessProxyexecutionManagerIfDa ["2.dll"] = new SourceDetail { Source = "2.dll", Architecture = Architecture.X86, Framework = Framework.DefaultFramework }, }; - var executionManager = _testEngine.GetExecutionManager(_mockRequestData.Object, testRunCriteria, sourceToSourceDetailMap); + var executionManager = _testEngine.GetExecutionManager(_mockRequestData.Object, testRunCriteria, sourceToSourceDetailMap, new Mock().Object); Assert.IsNotNull(executionManager); Assert.IsNotInstanceOfType(executionManager, typeof(InProcessProxyExecutionManager)); @@ -456,7 +456,7 @@ public void GetExecutionManagerShouldNotReturnInProcessProxyexecutionManagerIfIn ["2.dll"] = new SourceDetail { Source = "2.dll", Architecture = Architecture.X86, Framework = Framework.DefaultFramework }, }; - var executionManager = _testEngine.GetExecutionManager(_mockRequestData.Object, testRunCriteria, sourceToSourceDetailMap); + var executionManager = _testEngine.GetExecutionManager(_mockRequestData.Object, testRunCriteria, sourceToSourceDetailMap, new Mock().Object); Assert.IsNotNull(executionManager); Assert.IsNotInstanceOfType(executionManager, typeof(InProcessProxyExecutionManager)); @@ -485,7 +485,7 @@ public void GetExecutionManagerShouldNotReturnInProcessProxyexecutionManagerIfru ["2.dll"] = new SourceDetail { Source = "2.dll", Architecture = Architecture.X86, Framework = Framework.DefaultFramework }, }; - var executionManager = _testEngine.GetExecutionManager(_mockRequestData.Object, testRunCriteria, sourceToSourceDetailMap); + var executionManager = _testEngine.GetExecutionManager(_mockRequestData.Object, testRunCriteria, sourceToSourceDetailMap, new Mock().Object); Assert.IsNotNull(executionManager); Assert.IsNotInstanceOfType(executionManager, typeof(InProcessProxyExecutionManager)); @@ -512,7 +512,7 @@ public void GetExecutionManagerShouldReturnInProcessProxyexecutionManager() ["2.dll"] = new SourceDetail { Source = "2.dll", Architecture = Architecture.X86, Framework = Framework.DefaultFramework }, }; - var executionManager = _testEngine.GetExecutionManager(_mockRequestData.Object, testRunCriteria, sourceToSourceDetailMap); + var executionManager = _testEngine.GetExecutionManager(_mockRequestData.Object, testRunCriteria, sourceToSourceDetailMap, new Mock().Object); Assert.IsNotNull(executionManager); Assert.IsInstanceOfType(executionManager, typeof(InProcessProxyExecutionManager)); @@ -544,7 +544,7 @@ public void GetExtensionManagerShouldCollectMetrics() ["2.dll"] = new SourceDetail { Source = "2.dll", Architecture = Architecture.X86, Framework = Framework.DefaultFramework }, }; - var executionManager = _testEngine.GetExecutionManager(_mockRequestData.Object, testRunCriteria, sourceToSourceDetailMap); + var executionManager = _testEngine.GetExecutionManager(_mockRequestData.Object, testRunCriteria, sourceToSourceDetailMap, new Mock().Object); _mockMetricsCollection.Verify(mc => mc.Add(TelemetryDataConstants.ParallelEnabledDuringExecution, It.IsAny()), Times.Once); } @@ -585,7 +585,8 @@ public void GetTestSessionManagerShouldReturnAValidInstance() Assert.IsNotNull(_testEngine.GetTestSessionManager( _mockRequestData.Object, testSessionCriteria, - sourceToSourceDetailMap)); + sourceToSourceDetailMap, + new Mock().Object)); } [TestMethod] @@ -606,13 +607,15 @@ public void GetTestSessionManagerShouldReturnNewInstance() var testSessionManager1 = _testEngine.GetTestSessionManager( _mockRequestData.Object, testSessionCriteria, - sourceToSourceDetailMap); + sourceToSourceDetailMap, + new Mock().Object); Assert.AreNotSame( _testEngine.GetTestSessionManager( _mockRequestData.Object, testSessionCriteria, - sourceToSourceDetailMap), + sourceToSourceDetailMap, + new Mock().Object), testSessionManager1); } @@ -640,7 +643,8 @@ public void GetTestSessionManagerShouldReturnDefaultTestSessionManagerIfParallel var testSessionManager = _testEngine.GetTestSessionManager( _mockRequestData.Object, testSessionCriteria, - sourceToSourceDetailMap); + sourceToSourceDetailMap, + new Mock().Object); Assert.IsNotNull(testSessionManager); Assert.IsInstanceOfType(testSessionManager, typeof(ProxyTestSessionManager)); @@ -671,7 +675,8 @@ public void GetTestSessionManagerShouldReturnDefaultTestSessionManagerEvenIfPara var testSessionManager = _testEngine.GetTestSessionManager( _mockRequestData.Object, testSessionCriteria, - sourceToSourceDetailMap); + sourceToSourceDetailMap, + new Mock().Object); Assert.IsNotNull(testSessionManager); Assert.IsInstanceOfType(testSessionManager, typeof(ProxyTestSessionManager)); @@ -701,7 +706,8 @@ public void GetTestSessionManagerShouldReturnDefaultTestSessionManagerIfParallel var testSessionManager = _testEngine.GetTestSessionManager( _mockRequestData.Object, testSessionCriteria, - sourceToSourceDetailMap); + sourceToSourceDetailMap, + new Mock().Object); Assert.IsNotNull(testSessionManager); Assert.IsInstanceOfType(testSessionManager, typeof(ProxyTestSessionManager)); @@ -731,7 +737,8 @@ public void GetTestSessionManagerShouldReturnDefaultTestSessionManagerIfHostIsNo var testSessionManager = _testEngine.GetTestSessionManager( _mockRequestData.Object, testSessionCriteria, - sourceToSourceDetailMap); + sourceToSourceDetailMap, + new Mock().Object); Assert.IsNotNull(testSessionManager); Assert.IsInstanceOfType(testSessionManager, typeof(ProxyTestSessionManager)); @@ -762,7 +769,8 @@ public void GetTestSessionManagerShouldReturnDefaultTestSessionManagerIfDataColl var testSessionManager = _testEngine.GetTestSessionManager( _mockRequestData.Object, testSessionCriteria, - sourceToSourceDetailMap); + sourceToSourceDetailMap, + new Mock().Object); Assert.IsNotNull(testSessionManager); Assert.IsInstanceOfType(testSessionManager, typeof(ProxyTestSessionManager)); @@ -792,7 +800,8 @@ public void GetTestSessionManagerShouldReturnNullWhenTargetFrameworkIsNetFramewo Assert.IsNull(_testEngine.GetTestSessionManager( _mockRequestData.Object, testSessionCriteria, - sourceToSourceDetailMap)); + sourceToSourceDetailMap, + new Mock().Object)); } [TestMethod] @@ -814,7 +823,8 @@ public void GetTestSessionManagerShouldReturnNotNullIfCurrentProcessIsDotnet() var testSessionManager = _testEngine.GetTestSessionManager( _mockRequestData.Object, testSessionCriteria, - sourceToSourceDetailMap); + sourceToSourceDetailMap, +new Mock().Object); Assert.IsNotNull(testSessionManager); } @@ -845,7 +855,8 @@ public void GetTestSessionManagerShouldReturnNotNullIfDisableAppDomainIsSet() var testSessionManager = _testEngine.GetTestSessionManager( _mockRequestData.Object, testSessionCriteria, - sourceToSourceDetailMap); + sourceToSourceDetailMap, + new Mock().Object); Assert.IsNotNull(testSessionManager); } @@ -877,7 +888,8 @@ public void GetTestSessionManagerShouldReturnNotNullIfDesignModeIsTrue() var testSessionManager = _testEngine.GetTestSessionManager( _mockRequestData.Object, testSessionCriteria, - sourceToSourceDetailMap); + sourceToSourceDetailMap, + new Mock().Object); Assert.IsNotNull(testSessionManager); } @@ -909,7 +921,8 @@ public void GetTestSessionManagerShouldReturnNotNullIfTargetFrameworkIsNetcoreAp var testSessionManager = _testEngine.GetTestSessionManager( _mockRequestData.Object, testSessionCriteria, - sourceToSourceDetailMap); + sourceToSourceDetailMap, + new Mock().Object); Assert.IsNotNull(testSessionManager); } @@ -941,7 +954,8 @@ public void GetTestSessionManagerShouldReturnNotNullIfTargetFrameworkIsNetStanda var testSessionManager = _testEngine.GetTestSessionManager( _mockRequestData.Object, testSessionCriteria, - sourceToSourceDetailMap); + sourceToSourceDetailMap, + new Mock().Object); Assert.IsNotNull(testSessionManager); } @@ -973,7 +987,8 @@ public void GetTestSessionManagerShouldReturnNotNullIfTargetPlatformIsX64() var testSessionManager = _testEngine.GetTestSessionManager( _mockRequestData.Object, testSessionCriteria, - sourceToSourceDetailMap); + sourceToSourceDetailMap, + new Mock().Object); Assert.IsNotNull(testSessionManager); } @@ -1008,7 +1023,8 @@ public void GetTestSessionManagerShouldReturnNotNullIfRunSettingsHasTestSettings var testSessionManager = _testEngine.GetTestSessionManager( _mockRequestData.Object, testSessionCriteria, - sourceToSourceDetailMap); + sourceToSourceDetailMap, + new Mock().Object); Assert.IsNotNull(testSessionManager); } diff --git a/test/TranslationLayer.UnitTests/VsTestConsoleRequestSenderTests.cs b/test/TranslationLayer.UnitTests/VsTestConsoleRequestSenderTests.cs index 4d50bf1225..f27943ec57 100644 --- a/test/TranslationLayer.UnitTests/VsTestConsoleRequestSenderTests.cs +++ b/test/TranslationLayer.UnitTests/VsTestConsoleRequestSenderTests.cs @@ -434,7 +434,7 @@ public void DiscoverTestsShouldCompleteWithSingleFullyDiscoveredSource() var mockHandler = new Mock(); - List sources = new() { "1.dll" }; + List sources = new() { "1.dll" }; var testCase = new TestCase("hello", new Uri("world://how"), source: sources[0]); var testsFound = new Message() @@ -443,7 +443,8 @@ public void DiscoverTestsShouldCompleteWithSingleFullyDiscoveredSource() Payload = JToken.FromObject(new List() { testCase }) }; - var payload = new DiscoveryCompletePayload() { TotalTests = 1, LastDiscoveredTests = null, IsAborted = false, FullyDiscoveredSources = sources }; + var discoveredSources = sources.Select(source => new DiscoveredSource { Source = source }).ToList(); + var payload = new DiscoveryCompletePayload() { TotalTests = 1, LastDiscoveredTests = null, IsAborted = false, FullyDiscoveredSources = discoveredSources }; var discoveryComplete = new Message() { MessageType = MessageType.DiscoveryComplete, @@ -483,7 +484,8 @@ public void DiscoverTestsShouldCompleteWithCorrectAbortedValuesIfAbortingWasRequ Payload = JToken.FromObject(new List() { testCase }) }; - var payload = new DiscoveryCompletePayload() { TotalTests = -1, LastDiscoveredTests = null, IsAborted = true, FullyDiscoveredSources = sources }; + var discoveredSources = sources.Select(source => new DiscoveredSource { Source = source }).ToList(); + var payload = new DiscoveryCompletePayload() { TotalTests = -1, LastDiscoveredTests = null, IsAborted = true, FullyDiscoveredSources = discoveredSources }; var discoveryComplete = new Message() { MessageType = MessageType.DiscoveryComplete, diff --git a/test/vstest.console.UnitTests/Processors/ListFullyQualifiedTestsArgumentProcessorTests.cs b/test/vstest.console.UnitTests/Processors/ListFullyQualifiedTestsArgumentProcessorTests.cs index 8f7d808751..47e8cb65a0 100644 --- a/test/vstest.console.UnitTests/Processors/ListFullyQualifiedTestsArgumentProcessorTests.cs +++ b/test/vstest.console.UnitTests/Processors/ListFullyQualifiedTestsArgumentProcessorTests.cs @@ -156,7 +156,7 @@ public void ExecutorExecuteShouldThrowTestPlatformException() var mockDiscoveryRequest = new Mock(); mockDiscoveryRequest.Setup(dr => dr.DiscoverAsync()).Throws(new TestPlatformException("DummyTestPlatformException")); - mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Returns(mockDiscoveryRequest.Object); + mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Returns(mockDiscoveryRequest.Object); ResetAndAddSourceToCommandLineOptions(true); @@ -174,7 +174,7 @@ public void ExecutorExecuteShouldThrowSettingsException() var mockDiscoveryRequest = new Mock(); mockDiscoveryRequest.Setup(dr => dr.DiscoverAsync()).Throws(new SettingsException("DummySettingsException")); - mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Returns(mockDiscoveryRequest.Object); + mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Returns(mockDiscoveryRequest.Object); ResetAndAddSourceToCommandLineOptions(true); var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, _mockTestPlatformEventSource.Object, _inferHelper, _mockMetricsPublisherTask, _mockProcessHelper.Object, _mockAttachmentsProcessingManager.Object, _mockEnvironment.Object); @@ -191,7 +191,7 @@ public void ExecutorExecuteShouldThrowInvalidOperationException() var mockDiscoveryRequest = new Mock(); mockDiscoveryRequest.Setup(dr => dr.DiscoverAsync()).Throws(new InvalidOperationException("DummyInvalidOperationException")); - mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Returns(mockDiscoveryRequest.Object); + mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Returns(mockDiscoveryRequest.Object); ResetAndAddSourceToCommandLineOptions(true); @@ -210,7 +210,7 @@ public void ExecutorExecuteShouldThrowOtherExceptions() var mockDiscoveryRequest = new Mock(); mockDiscoveryRequest.Setup(dr => dr.DiscoverAsync()).Throws(new Exception("DummyException")); - mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Returns(mockDiscoveryRequest.Object); + mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Returns(mockDiscoveryRequest.Object); ResetAndAddSourceToCommandLineOptions(true); @@ -300,7 +300,7 @@ private void RunListFullyQualifiedTestArgumentProcessorWithTraits(Mock dr.DiscoverAsync()).Raises(dr => dr.OnDiscoveredTests += null, new DiscoveredTestsEventArgs(list)); - mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Returns(mockDiscoveryRequest.Object); + mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Returns(mockDiscoveryRequest.Object); ResetAndAddSourceToCommandLineOptions(legitPath); var cmdOptions = CommandLineOptions.Instance; @@ -320,7 +320,7 @@ private void RunListFullyQualifiedTestArgumentProcessorExecuteWithMockSetup(Mock new TestCase("Test2", new Uri("http://FooTestUri2"), "Source2") }; mockDiscoveryRequest.Setup(dr => dr.DiscoverAsync()).Raises(dr => dr.OnDiscoveredTests += null, new DiscoveredTestsEventArgs(list)); - mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Returns(mockDiscoveryRequest.Object); + mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Returns(mockDiscoveryRequest.Object); ResetAndAddSourceToCommandLineOptions(legitPath); diff --git a/test/vstest.console.UnitTests/Processors/ListTestsArgumentProcessorTests.cs b/test/vstest.console.UnitTests/Processors/ListTestsArgumentProcessorTests.cs index f20f085a44..d09dc9055e 100644 --- a/test/vstest.console.UnitTests/Processors/ListTestsArgumentProcessorTests.cs +++ b/test/vstest.console.UnitTests/Processors/ListTestsArgumentProcessorTests.cs @@ -159,7 +159,7 @@ public void ExecutorExecuteShouldThrowTestPlatformException() var mockDiscoveryRequest = new Mock(); mockDiscoveryRequest.Setup(dr => dr.DiscoverAsync()).Throws(new TestPlatformException("DummyTestPlatformException")); - mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Returns(mockDiscoveryRequest.Object); + mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Returns(mockDiscoveryRequest.Object); ResetAndAddSourceToCommandLineOptions(); @@ -176,7 +176,7 @@ public void ExecutorExecuteShouldThrowSettingsException() var mockDiscoveryRequest = new Mock(); mockDiscoveryRequest.Setup(dr => dr.DiscoverAsync()).Throws(new SettingsException("DummySettingsException")); - mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Returns(mockDiscoveryRequest.Object); + mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Returns(mockDiscoveryRequest.Object); ResetAndAddSourceToCommandLineOptions(); @@ -193,7 +193,7 @@ public void ExecutorExecuteShouldThrowInvalidOperationException() var mockDiscoveryRequest = new Mock(); mockDiscoveryRequest.Setup(dr => dr.DiscoverAsync()).Throws(new InvalidOperationException("DummyInvalidOperationException")); - mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Returns(mockDiscoveryRequest.Object); + mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Returns(mockDiscoveryRequest.Object); ResetAndAddSourceToCommandLineOptions(); @@ -210,7 +210,7 @@ public void ExecutorExecuteShouldThrowOtherExceptions() var mockDiscoveryRequest = new Mock(); mockDiscoveryRequest.Setup(dr => dr.DiscoverAsync()).Throws(new Exception("DummyException")); - mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Returns(mockDiscoveryRequest.Object); + mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Returns(mockDiscoveryRequest.Object); ResetAndAddSourceToCommandLineOptions(); @@ -268,7 +268,7 @@ private void RunListTestArgumentProcessorExecuteWithMockSetup(Mock dr.DiscoverAsync()).Raises(dr => dr.OnDiscoveredTests += null, new DiscoveredTestsEventArgs(list)); - mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Returns(mockDiscoveryRequest.Object); + mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Returns(mockDiscoveryRequest.Object); ResetAndAddSourceToCommandLineOptions(); diff --git a/test/vstest.console.UnitTests/Processors/RunSpecificTestsArgumentProcessorTests.cs b/test/vstest.console.UnitTests/Processors/RunSpecificTestsArgumentProcessorTests.cs index 27b2fecc04..bc6417ff72 100644 --- a/test/vstest.console.UnitTests/Processors/RunSpecificTestsArgumentProcessorTests.cs +++ b/test/vstest.console.UnitTests/Processors/RunSpecificTestsArgumentProcessorTests.cs @@ -196,8 +196,8 @@ public void ExecutorExecuteForValidSourceWithTestCaseFilterShouldRunTests() }; mockDiscoveryRequest.Setup(dr => dr.DiscoverAsync()).Raises(dr => dr.OnDiscoveredTests += null, new DiscoveredTestsEventArgs(list)); - mockTestPlatform.Setup(tp => tp.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Returns(mockTestRunRequest.Object); - mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Returns(mockDiscoveryRequest.Object); + mockTestPlatform.Setup(tp => tp.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Returns(mockTestRunRequest.Object); + mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Returns(mockDiscoveryRequest.Object); var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, _mockTestPlatformEventSource.Object, _inferHelper, _mockMetricsPublisherTask, _mockProcessHelper.Object, _mockAttachmentsProcessingManager.Object, _mockEnvironment.Object); var executor = GetExecutor(testRequestManager); @@ -207,7 +207,7 @@ public void ExecutorExecuteForValidSourceWithTestCaseFilterShouldRunTests() ArgumentProcessorResult argumentProcessorResult = executor.Execute(); _mockOutput.Verify(o => o.WriteLine(It.IsAny(), OutputLevel.Warning), Times.Never); - mockTestPlatform.Verify(o => o.CreateDiscoveryRequest(It.IsAny(), It.Is(c => c.TestCaseFilter == "Filter"), It.IsAny(), It.IsAny>()), Times.Once()); + mockTestPlatform.Verify(o => o.CreateDiscoveryRequest(It.IsAny(), It.Is(c => c.TestCaseFilter == "Filter"), It.IsAny(), It.IsAny>(), It.IsAny()), Times.Once()); Assert.AreEqual(ArgumentProcessorResult.Success, argumentProcessorResult); } @@ -220,8 +220,8 @@ public void ExecutorExecuteShouldThrowTestPlatformExceptionThrownDuringDiscovery var mockDiscoveryRequest = new Mock(); mockDiscoveryRequest.Setup(dr => dr.DiscoverAsync()).Throws(new TestPlatformException("DummyTestPlatformException")); - mockTestPlatform.Setup(tp => tp.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Returns(mockTestRunRequest.Object); - mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Returns(mockDiscoveryRequest.Object); + mockTestPlatform.Setup(tp => tp.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Returns(mockTestRunRequest.Object); + mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Returns(mockDiscoveryRequest.Object); ResetAndAddSourceToCommandLineOptions(); var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, _mockTestPlatformEventSource.Object, _inferHelper, _mockMetricsPublisherTask, _mockProcessHelper.Object, _mockAttachmentsProcessingManager.Object, _mockEnvironment.Object); @@ -238,8 +238,8 @@ public void ExecutorExecuteShouldThrowInvalidOperationExceptionThrownDuringDisco var mockDiscoveryRequest = new Mock(); mockDiscoveryRequest.Setup(dr => dr.DiscoverAsync()).Throws(new InvalidOperationException("DummyInvalidOperationException")); - mockTestPlatform.Setup(tp => tp.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Returns(mockTestRunRequest.Object); - mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Returns(mockDiscoveryRequest.Object); + mockTestPlatform.Setup(tp => tp.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Returns(mockTestRunRequest.Object); + mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Returns(mockDiscoveryRequest.Object); ResetAndAddSourceToCommandLineOptions(); var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, _mockTestPlatformEventSource.Object, _inferHelper, _mockMetricsPublisherTask, _mockProcessHelper.Object, _mockAttachmentsProcessingManager.Object, _mockEnvironment.Object); @@ -256,8 +256,8 @@ public void ExecutorExecuteShouldThrowSettingsExceptionThrownDuringDiscovery() var mockDiscoveryRequest = new Mock(); mockDiscoveryRequest.Setup(dr => dr.DiscoverAsync()).Throws(new SettingsException("DummySettingsException")); - mockTestPlatform.Setup(tp => tp.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Returns(mockTestRunRequest.Object); - mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Returns(mockDiscoveryRequest.Object); + mockTestPlatform.Setup(tp => tp.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Returns(mockTestRunRequest.Object); + mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Returns(mockDiscoveryRequest.Object); ResetAndAddSourceToCommandLineOptions(); var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, _mockTestPlatformEventSource.Object, _inferHelper, _mockMetricsPublisherTask, _mockProcessHelper.Object, _mockAttachmentsProcessingManager.Object, _mockEnvironment.Object); @@ -281,8 +281,8 @@ public void ExecutorExecuteShouldThrowTestPlatformExceptionThrownDuringExecution mockDiscoveryRequest.Setup(dr => dr.DiscoverAsync()).Raises(dr => dr.OnDiscoveredTests += null, new DiscoveredTestsEventArgs(list)); mockTestRunRequest.Setup(dr => dr.ExecuteAsync()).Throws(new TestPlatformException("DummyTestPlatformException")); - mockTestPlatform.Setup(tp => tp.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Returns(mockTestRunRequest.Object); - mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Returns(mockDiscoveryRequest.Object); + mockTestPlatform.Setup(tp => tp.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Returns(mockTestRunRequest.Object); + mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Returns(mockDiscoveryRequest.Object); ResetAndAddSourceToCommandLineOptions(); var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, _mockTestPlatformEventSource.Object, _inferHelper, _mockMetricsPublisherTask, _mockProcessHelper.Object, _mockAttachmentsProcessingManager.Object, _mockEnvironment.Object); @@ -308,8 +308,8 @@ public void ExecutorExecuteShouldThrowSettingsExceptionThrownDuringExecution() mockDiscoveryRequest.Setup(dr => dr.DiscoverAsync()).Raises(dr => dr.OnDiscoveredTests += null, new DiscoveredTestsEventArgs(list)); mockTestRunRequest.Setup(dr => dr.ExecuteAsync()).Throws(new SettingsException("DummySettingsException")); - mockTestPlatform.Setup(tp => tp.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Returns(mockTestRunRequest.Object); - mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Returns(mockDiscoveryRequest.Object); + mockTestPlatform.Setup(tp => tp.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Returns(mockTestRunRequest.Object); + mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Returns(mockDiscoveryRequest.Object); ResetAndAddSourceToCommandLineOptions(); var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, _mockTestPlatformEventSource.Object, _inferHelper, _mockMetricsPublisherTask, _mockProcessHelper.Object, _mockAttachmentsProcessingManager.Object, _mockEnvironment.Object); @@ -335,8 +335,8 @@ public void ExecutorExecuteShouldThrowInvalidOperationExceptionThrownDuringExecu mockDiscoveryRequest.Setup(dr => dr.DiscoverAsync()).Raises(dr => dr.OnDiscoveredTests += null, new DiscoveredTestsEventArgs(list)); mockTestRunRequest.Setup(dr => dr.ExecuteAsync()).Throws(new InvalidOperationException("DummySettingsException")); - mockTestPlatform.Setup(tp => tp.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Returns(mockTestRunRequest.Object); - mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Returns(mockDiscoveryRequest.Object); + mockTestPlatform.Setup(tp => tp.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Returns(mockTestRunRequest.Object); + mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Returns(mockDiscoveryRequest.Object); ResetAndAddSourceToCommandLineOptions(); @@ -360,7 +360,7 @@ public void ExecutorExecuteShouldForValidSourcesAndNoTestsDiscoveredShouldLogWar CommandLineOptions.Instance.TestAdapterPath = new[] { @"C:\Foo" }; mockDiscoveryRequest.Setup(dr => dr.DiscoverAsync()).Raises(dr => dr.OnDiscoveredTests += null, new DiscoveredTestsEventArgs(new List())); - mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Returns(mockDiscoveryRequest.Object); + mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Returns(mockDiscoveryRequest.Object); var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, _mockTestPlatformEventSource.Object, _inferHelper, _mockMetricsPublisherTask, _mockProcessHelper.Object, _mockAttachmentsProcessingManager.Object, _mockEnvironment.Object); var executor = GetExecutor(testRequestManager); @@ -381,7 +381,7 @@ public void ExecutorExecuteShouldForValidSourcesAndNoTestsDiscoveredShouldLogApp ResetAndAddSourceToCommandLineOptions(); mockDiscoveryRequest.Setup(dr => dr.DiscoverAsync()).Raises(dr => dr.OnDiscoveredTests += null, new DiscoveredTestsEventArgs(new List())); - mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Returns(mockDiscoveryRequest.Object); + mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Returns(mockDiscoveryRequest.Object); var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, _mockTestPlatformEventSource.Object, _inferHelper, _mockMetricsPublisherTask, _mockProcessHelper.Object, _mockAttachmentsProcessingManager.Object, _mockEnvironment.Object); var executor = GetExecutor(testRequestManager); @@ -408,8 +408,8 @@ public void ExecutorExecuteShouldForValidSourcesAndValidSelectedTestsRunsTestsAn }; mockDiscoveryRequest.Setup(dr => dr.DiscoverAsync()).Raises(dr => dr.OnDiscoveredTests += null, new DiscoveredTestsEventArgs(list)); - mockTestPlatform.Setup(tp => tp.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Returns(mockTestRunRequest.Object); - mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Returns(mockDiscoveryRequest.Object); + mockTestPlatform.Setup(tp => tp.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Returns(mockTestRunRequest.Object); + mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Returns(mockDiscoveryRequest.Object); var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, _mockTestPlatformEventSource.Object, _inferHelper, _mockMetricsPublisherTask, _mockProcessHelper.Object, _mockAttachmentsProcessingManager.Object, _mockEnvironment.Object); var executor = GetExecutor(testRequestManager); @@ -436,8 +436,8 @@ public void ExecutorShouldRunTestsWhenTestsAreCommaSeparated() }; mockDiscoveryRequest.Setup(dr => dr.DiscoverAsync()).Raises(dr => dr.OnDiscoveredTests += null, new DiscoveredTestsEventArgs(list)); - mockTestPlatform.Setup(tp => tp.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Returns(mockTestRunRequest.Object); - mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Returns(mockDiscoveryRequest.Object); + mockTestPlatform.Setup(tp => tp.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Returns(mockTestRunRequest.Object); + mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Returns(mockDiscoveryRequest.Object); var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, _mockTestPlatformEventSource.Object, _inferHelper, _mockMetricsPublisherTask, _mockProcessHelper.Object, _mockAttachmentsProcessingManager.Object, _mockEnvironment.Object); var executor = GetExecutor(testRequestManager); @@ -465,8 +465,8 @@ public void ExecutorShouldRunTestsWhenTestsAreFiltered() }; mockDiscoveryRequest.Setup(dr => dr.DiscoverAsync()).Raises(dr => dr.OnDiscoveredTests += null, new DiscoveredTestsEventArgs(list)); - mockTestPlatform.Setup(tp => tp.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Returns(mockTestRunRequest.Object); - mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Returns(mockDiscoveryRequest.Object); + mockTestPlatform.Setup(tp => tp.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Returns(mockTestRunRequest.Object); + mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Returns(mockDiscoveryRequest.Object); var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, _mockTestPlatformEventSource.Object, _inferHelper, _mockMetricsPublisherTask, _mockProcessHelper.Object, _mockAttachmentsProcessingManager.Object, _mockEnvironment.Object); var executor = GetExecutor(testRequestManager); @@ -493,8 +493,8 @@ public void ExecutorShouldWarnWhenTestsAreNotAvailable() }; mockDiscoveryRequest.Setup(dr => dr.DiscoverAsync()).Raises(dr => dr.OnDiscoveredTests += null, new DiscoveredTestsEventArgs(list)); - mockTestPlatform.Setup(tp => tp.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Returns(mockTestRunRequest.Object); - mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Returns(mockDiscoveryRequest.Object); + mockTestPlatform.Setup(tp => tp.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Returns(mockTestRunRequest.Object); + mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Returns(mockDiscoveryRequest.Object); var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, _mockTestPlatformEventSource.Object, _inferHelper, _mockMetricsPublisherTask, _mockProcessHelper.Object, _mockAttachmentsProcessingManager.Object, _mockEnvironment.Object); var executor = GetExecutor(testRequestManager); @@ -522,8 +522,8 @@ public void ExecutorShouldRunTestsWhenTestsAreCommaSeparatedWithEscape() }; mockDiscoveryRequest.Setup(dr => dr.DiscoverAsync()).Raises(dr => dr.OnDiscoveredTests += null, new DiscoveredTestsEventArgs(list)); - mockTestPlatform.Setup(tp => tp.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Returns(mockTestRunRequest.Object); - mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Returns(mockDiscoveryRequest.Object); + mockTestPlatform.Setup(tp => tp.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Returns(mockTestRunRequest.Object); + mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Returns(mockDiscoveryRequest.Object); var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, _mockTestPlatformEventSource.Object, _inferHelper, _mockMetricsPublisherTask, _mockProcessHelper.Object, _mockAttachmentsProcessingManager.Object, _mockEnvironment.Object); var executor = GetExecutor(testRequestManager); @@ -553,8 +553,8 @@ public void ExecutorShouldDisplayWarningIfNoTestsAreExecuted() mockTestRunRequest.Setup(tr => tr.ExecuteAsync()).Returns(1).Raises(tr => tr.OnRunCompletion += null, new TestRunCompleteEventArgs(mockTestRunStats.Object, false, false, null, null, null, new TimeSpan())); - mockTestPlatform.Setup(tp => tp.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Returns(mockTestRunRequest.Object); - mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Returns(mockDiscoveryRequest.Object); + mockTestPlatform.Setup(tp => tp.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Returns(mockTestRunRequest.Object); + mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Returns(mockDiscoveryRequest.Object); ResetAndAddSourceToCommandLineOptions(); var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, _mockTestPlatformEventSource.Object, _inferHelper, _mockMetricsPublisherTask, _mockProcessHelper.Object, _mockAttachmentsProcessingManager.Object, _mockEnvironment.Object); @@ -584,8 +584,8 @@ public void ExecutorShouldNotDisplayWarningIfTestsAreExecuted() mockTestRunRequest.Setup(tr => tr.ExecuteAsync()).Returns(1).Raises(tr => tr.OnRunCompletion += null, new TestRunCompleteEventArgs(testRunStats, false, false, null, null, null, new TimeSpan())); - mockTestPlatform.Setup(tp => tp.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Returns(mockTestRunRequest.Object); - mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Returns(mockDiscoveryRequest.Object); + mockTestPlatform.Setup(tp => tp.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Returns(mockTestRunRequest.Object); + mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Returns(mockDiscoveryRequest.Object); ResetAndAddSourceToCommandLineOptions(); var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, _mockTestPlatformEventSource.Object, _inferHelper, _mockMetricsPublisherTask, _mockProcessHelper.Object, _mockAttachmentsProcessingManager.Object, _mockEnvironment.Object); diff --git a/test/vstest.console.UnitTests/Processors/RunTestsArgumentProcessorTests.cs b/test/vstest.console.UnitTests/Processors/RunTestsArgumentProcessorTests.cs index 709fb1336c..d260437ccc 100644 --- a/test/vstest.console.UnitTests/Processors/RunTestsArgumentProcessorTests.cs +++ b/test/vstest.console.UnitTests/Processors/RunTestsArgumentProcessorTests.cs @@ -156,7 +156,7 @@ public void ExecutorExecuteShouldThrowTestPlatformException() var mockTestRunRequest = new Mock(); mockTestRunRequest.Setup(tr => tr.ExecuteAsync()).Throws(new TestPlatformException("DummyTestPlatformException")); - mockTestPlatform.Setup(tp => tp.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Returns(mockTestRunRequest.Object); + mockTestPlatform.Setup(tp => tp.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Returns(mockTestRunRequest.Object); ResetAndAddSourceToCommandLineOptions(); var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, _mockTestPlatformEventSource.Object, _inferHelper, _mockMetricsPublisherTask, _mockProcessHelper.Object, _mockAttachmentsProcessingManager.Object, _environment.Object); @@ -172,7 +172,7 @@ public void ExecutorExecuteShouldThrowSettingsException() var mockTestRunRequest = new Mock(); mockTestRunRequest.Setup(tr => tr.ExecuteAsync()).Throws(new SettingsException("DummySettingsException")); - mockTestPlatform.Setup(tp => tp.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Returns(mockTestRunRequest.Object); + mockTestPlatform.Setup(tp => tp.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Returns(mockTestRunRequest.Object); ResetAndAddSourceToCommandLineOptions(); var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, _mockTestPlatformEventSource.Object, _inferHelper, _mockMetricsPublisherTask, _mockProcessHelper.Object, _mockAttachmentsProcessingManager.Object, _environment.Object); @@ -188,7 +188,7 @@ public void ExecutorExecuteShouldThrowInvalidOperationException() var mockTestRunRequest = new Mock(); mockTestRunRequest.Setup(tr => tr.ExecuteAsync()).Throws(new InvalidOperationException("DummyInvalidOperationException")); - mockTestPlatform.Setup(tp => tp.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Returns(mockTestRunRequest.Object); + mockTestPlatform.Setup(tp => tp.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Returns(mockTestRunRequest.Object); ResetAndAddSourceToCommandLineOptions(); var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, _mockTestPlatformEventSource.Object, _inferHelper, _mockMetricsPublisherTask, _mockProcessHelper.Object, _mockAttachmentsProcessingManager.Object, _environment.Object); @@ -204,7 +204,7 @@ public void ExecutorExecuteShouldThrowOtherExceptions() var mockTestRunRequest = new Mock(); mockTestRunRequest.Setup(tr => tr.ExecuteAsync()).Throws(new Exception("DummyException")); - mockTestPlatform.Setup(tp => tp.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Returns(mockTestRunRequest.Object); + mockTestPlatform.Setup(tp => tp.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Returns(mockTestRunRequest.Object); ResetAndAddSourceToCommandLineOptions(); var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, _mockTestPlatformEventSource.Object, _inferHelper, _mockMetricsPublisherTask, _mockProcessHelper.Object, _mockAttachmentsProcessingManager.Object, _environment.Object); @@ -260,7 +260,7 @@ private ArgumentProcessorResult RunRunArgumentProcessorExecuteWithMockSetup(ITes var args = new TestRunCompleteEventArgs(mockTestRunStats.Object, false, false, null, null, null, new TimeSpan()); - mockTestPlatform.Setup(tp => tp.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Returns(testRunRequest); + mockTestPlatform.Setup(tp => tp.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Returns(testRunRequest); ResetAndAddSourceToCommandLineOptions(); diff --git a/test/vstest.console.UnitTests/TestPlatformHelpers/TestRequestManagerTests.cs b/test/vstest.console.UnitTests/TestPlatformHelpers/TestRequestManagerTests.cs index 34ef3ea010..e5b1123ecc 100644 --- a/test/vstest.console.UnitTests/TestPlatformHelpers/TestRequestManagerTests.cs +++ b/test/vstest.console.UnitTests/TestPlatformHelpers/TestRequestManagerTests.cs @@ -90,9 +90,9 @@ public TestRequestManagerTests() _mockProcessHelper.Object, _mockAttachmentsProcessingManager.Object, _mockEnvironment.Object); - _mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())) + _mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())) .Returns(_mockDiscoveryRequest.Object); - _mockTestPlatform.Setup(tp => tp.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())) + _mockTestPlatform.Setup(tp => tp.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())) .Returns(_mockRunRequest.Object); _mockAssemblyMetadataProvider.Setup(a => a.GetArchitecture(It.IsAny())) .Returns(Architecture.X86); @@ -167,7 +167,7 @@ public void DiscoverTestsShouldReadTheBatchSizeFromSettingsAndSetItForDiscoveryC DiscoveryCriteria? actualDiscoveryCriteria = null; var mockDiscoveryRequest = new Mock(); - _mockTestPlatform.Setup(mt => mt.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Callback( + _mockTestPlatform.Setup(mt => mt.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Callback( (IRequestData requestData, DiscoveryCriteria discoveryCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => actualDiscoveryCriteria = discoveryCriteria).Returns(mockDiscoveryRequest.Object); _testRequestManager.DiscoverTests(payload, new Mock().Object, _protocolConfig); @@ -186,7 +186,7 @@ public void DiscoverTestsShouldCallTestPlatformAndSucceed() var createDiscoveryRequestCalled = 0; DiscoveryCriteria? actualDiscoveryCriteria = null; var mockDiscoveryRequest = new Mock(); - _mockTestPlatform.Setup(mt => mt.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Callback( + _mockTestPlatform.Setup(mt => mt.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Callback( (IRequestData requestData, DiscoveryCriteria discoveryCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => { createDiscoveryRequestCalled++; @@ -241,7 +241,7 @@ public void DiscoverTestsShouldPassSameProtocolConfigInRequestData() IRequestData? actualRequestData = null; var mockDiscoveryRequest = new Mock(); - _mockTestPlatform.Setup(mt => mt.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Callback( + _mockTestPlatform.Setup(mt => mt.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Callback( (IRequestData requestData, DiscoveryCriteria discoveryCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => actualRequestData = requestData).Returns(mockDiscoveryRequest.Object); var mockDiscoveryRegistrar = new Mock(); @@ -293,7 +293,7 @@ public void DiscoverTestsShouldCollectMetrics() IRequestData? actualRequestData = null; var mockDiscoveryRequest = new Mock(); - _mockTestPlatform.Setup(mt => mt.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Callback( + _mockTestPlatform.Setup(mt => mt.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Callback( (IRequestData requestData, DiscoveryCriteria discoveryCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => actualRequestData = requestData).Returns(mockDiscoveryRequest.Object); _testRequestManager = new TestRequestManager( @@ -343,7 +343,7 @@ public void DiscoverTestsShouldCollectTargetDeviceLocalMachineIfTargetDeviceStri IRequestData? actualRequestData = null; var mockDiscoveryRequest = new Mock(); - _mockTestPlatform.Setup(mt => mt.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Callback( + _mockTestPlatform.Setup(mt => mt.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Callback( (IRequestData requestData, DiscoveryCriteria discoveryCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => actualRequestData = requestData).Returns(mockDiscoveryRequest.Object); _testRequestManager = new TestRequestManager( @@ -387,7 +387,7 @@ public void DiscoverTestsShouldCollectTargetDeviceIfTargetDeviceIsDevice() IRequestData? actualRequestData = null; var mockDiscoveryRequest = new Mock(); - _mockTestPlatform.Setup(mt => mt.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Callback( + _mockTestPlatform.Setup(mt => mt.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Callback( (IRequestData requestData, DiscoveryCriteria discoveryCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => actualRequestData = requestData).Returns(mockDiscoveryRequest.Object); _testRequestManager = new TestRequestManager( @@ -431,7 +431,7 @@ public void DiscoverTestsShouldCollectTargetDeviceIfTargetDeviceIsEmulator() IRequestData? actualRequestData = null; var mockDiscoveryRequest = new Mock(); - _mockTestPlatform.Setup(mt => mt.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Callback( + _mockTestPlatform.Setup(mt => mt.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Callback( (IRequestData requestData, DiscoveryCriteria discoveryCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => actualRequestData = requestData).Returns(mockDiscoveryRequest.Object); _testRequestManager = new TestRequestManager( @@ -475,7 +475,7 @@ public void DiscoverTestsShouldCollectCommands() IRequestData? actualRequestData = null; var mockDiscoveryRequest = new Mock(); - _mockTestPlatform.Setup(mt => mt.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Callback( + _mockTestPlatform.Setup(mt => mt.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Callback( (IRequestData requestData, DiscoveryCriteria discoveryCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => actualRequestData = requestData).Returns(mockDiscoveryRequest.Object); _testRequestManager = new TestRequestManager( @@ -531,7 +531,7 @@ public void DiscoverTestsShouldCollectTestSettings() IRequestData? actualRequestData = null; var mockDiscoveryRequest = new Mock(); - _mockTestPlatform.Setup(mt => mt.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Callback( + _mockTestPlatform.Setup(mt => mt.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Callback( (IRequestData requestData, DiscoveryCriteria discoveryCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => actualRequestData = requestData).Returns(mockDiscoveryRequest.Object); _testRequestManager = new TestRequestManager( @@ -578,7 +578,7 @@ public void DiscoverTestsShouldCollectVsmdiFile() IRequestData? actualRequestData = null; var mockDiscoveryRequest = new Mock(); - _mockTestPlatform.Setup(mt => mt.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Callback( + _mockTestPlatform.Setup(mt => mt.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Callback( (IRequestData requestData, DiscoveryCriteria discoveryCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => actualRequestData = requestData).Returns(mockDiscoveryRequest.Object); _testRequestManager = new TestRequestManager( @@ -625,7 +625,7 @@ public void DiscoverTestsShouldCollectTestRunConfigFile() IRequestData? actualRequestData = null; var mockDiscoveryRequest = new Mock(); - _mockTestPlatform.Setup(mt => mt.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Callback( + _mockTestPlatform.Setup(mt => mt.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Callback( (IRequestData requestData, DiscoveryCriteria discoveryCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => actualRequestData = requestData).Returns(mockDiscoveryRequest.Object); _testRequestManager = new TestRequestManager( @@ -671,7 +671,7 @@ public void DiscoverTestsShouldUpdateFrameworkAndPlatformIfNotSpecifiedInDesignM .Returns(new FrameworkName(Constants.DotNetFramework46)); DiscoveryCriteria? actualDiscoveryCriteria = null; var mockDiscoveryRequest = new Mock(); - _mockTestPlatform.Setup(mt => mt.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Callback( + _mockTestPlatform.Setup(mt => mt.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Callback( (IRequestData requestData, DiscoveryCriteria discoveryCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => actualDiscoveryCriteria = discoveryCriteria).Returns(mockDiscoveryRequest.Object); _testRequestManager.DiscoverTests(payload, new Mock().Object, _protocolConfig); @@ -705,7 +705,7 @@ public void DiscoverTestsShouldNotUpdateFrameworkAndPlatformIfSpecifiedInDesignM .Returns(new FrameworkName(Constants.DotNetFramework451)); DiscoveryCriteria? actualDiscoveryCriteria = null; var mockDiscoveryRequest = new Mock(); - _mockTestPlatform.Setup(mt => mt.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Callback( + _mockTestPlatform.Setup(mt => mt.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Callback( (IRequestData requestData, DiscoveryCriteria discoveryCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => actualDiscoveryCriteria = discoveryCriteria).Returns(mockDiscoveryRequest.Object); _testRequestManager.DiscoverTests(payload, new Mock().Object, _protocolConfig); @@ -737,7 +737,7 @@ public void DiscoverTestsShouldUpdateFrameworkAndPlatformInCommandLineScenariosI .Returns(new FrameworkName(Constants.DotNetFramework46)); DiscoveryCriteria? actualDiscoveryCriteria = null; var mockDiscoveryRequest = new Mock(); - _mockTestPlatform.Setup(mt => mt.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Callback( + _mockTestPlatform.Setup(mt => mt.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Callback( (IRequestData requestData, DiscoveryCriteria discoveryCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => actualDiscoveryCriteria = discoveryCriteria).Returns(mockDiscoveryRequest.Object); _testRequestManager.DiscoverTests(payload, new Mock().Object, _protocolConfig); @@ -773,7 +773,7 @@ public void DiscoverTestsShouldNotInferAndUpdateFrameworkAndPlatformInCommandLin DiscoveryCriteria? actualDiscoveryCriteria = null; var mockDiscoveryRequest = new Mock(); _mockTestPlatform - .Setup(mt => mt.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())) + .Setup(mt => mt.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())) .Callback( (IRequestData requestData, DiscoveryCriteria discoveryCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => actualDiscoveryCriteria = discoveryCriteria).Returns(mockDiscoveryRequest.Object); @@ -855,7 +855,7 @@ public void RunTestsShouldReadTheBatchSizeFromSettingsAndSetItForTestRunCriteria TestRunCriteria? actualTestRunCriteria = null; var mockDiscoveryRequest = new Mock(); - _mockTestPlatform.Setup(mt => mt.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Callback( + _mockTestPlatform.Setup(mt => mt.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Callback( (IRequestData requestData, TestRunCriteria runCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => actualTestRunCriteria = runCriteria).Returns(mockDiscoveryRequest.Object); _testRequestManager.RunTests(payload, new Mock().Object, new Mock().Object, _protocolConfig); @@ -879,7 +879,7 @@ public void RunTestsShouldNotThrowForFramework35() TestRunCriteria? actualTestRunCriteria = null; var mockDiscoveryRequest = new Mock(); - _mockTestPlatform.Setup(mt => mt.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Callback( + _mockTestPlatform.Setup(mt => mt.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Callback( (IRequestData requestData, TestRunCriteria runCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => actualTestRunCriteria = runCriteria).Returns(mockDiscoveryRequest.Object); _mockAssemblyMetadataProvider.Setup(a => a.GetFrameworkName(It.IsAny())).Returns(new FrameworkName(Constants.DotNetFramework35)); @@ -904,7 +904,7 @@ public void RunTestsShouldPassSameProtocolConfigInRequestData() var mockProtocolConfig = new ProtocolConfig { Version = 6 }; IRequestData? actualRequestData = null; var mockDiscoveryRequest = new Mock(); - _mockTestPlatform.Setup(mt => mt.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Callback( + _mockTestPlatform.Setup(mt => mt.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Callback( (IRequestData requestData, TestRunCriteria runCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => actualRequestData = requestData).Returns(mockDiscoveryRequest.Object); // Act. @@ -928,7 +928,7 @@ public void RunTestsShouldCollectCommands() var mockProtocolConfig = new ProtocolConfig { Version = 6 }; IRequestData? actualRequestData = null; var mockDiscoveryRequest = new Mock(); - _mockTestPlatform.Setup(mt => mt.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Callback( + _mockTestPlatform.Setup(mt => mt.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Callback( (IRequestData requestData, TestRunCriteria runCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => actualRequestData = requestData).Returns(mockDiscoveryRequest.Object); _testRequestManager = new TestRequestManager( @@ -993,7 +993,7 @@ public void RunTestsShouldCollectTelemetryForLegacySettings() var mockProtocolConfig = new ProtocolConfig { Version = 6 }; IRequestData? actualRequestData = null; var mockDiscoveryRequest = new Mock(); - _mockTestPlatform.Setup(mt => mt.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Callback( + _mockTestPlatform.Setup(mt => mt.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Callback( (IRequestData requestData, TestRunCriteria runCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => actualRequestData = requestData).Returns(mockDiscoveryRequest.Object); _testRequestManager = new TestRequestManager( @@ -1041,7 +1041,7 @@ public void RunTestsShouldCollectTelemetryForTestSettingsEmbeddedInsideRunSettin var mockProtocolConfig = new ProtocolConfig { Version = 6 }; IRequestData? actualRequestData = null; var mockDiscoveryRequest = new Mock(); - _mockTestPlatform.Setup(mt => mt.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Callback( + _mockTestPlatform.Setup(mt => mt.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Callback( (IRequestData requestData, TestRunCriteria runCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => actualRequestData = requestData).Returns(mockDiscoveryRequest.Object); _testRequestManager = new TestRequestManager( @@ -1087,7 +1087,7 @@ public void RunTestsShouldCollectMetrics() var mockProtocolConfig = new ProtocolConfig { Version = 6 }; IRequestData? actualRequestData = null; var mockDiscoveryRequest = new Mock(); - _mockTestPlatform.Setup(mt => mt.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Callback( + _mockTestPlatform.Setup(mt => mt.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Callback( (IRequestData requestData, TestRunCriteria runCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => actualRequestData = requestData).Returns(mockDiscoveryRequest.Object); _testRequestManager = new TestRequestManager( @@ -1127,7 +1127,7 @@ public void RunTestsWithSourcesShouldCallTestPlatformAndSucceed() var createRunRequestCalled = 0; TestRunCriteria? observedCriteria = null; var mockRunRequest = new Mock(); - _mockTestPlatform.Setup(mt => mt.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Callback( + _mockTestPlatform.Setup(mt => mt.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Callback( (IRequestData requestData, TestRunCriteria runCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => { createRunRequestCalled++; @@ -1185,7 +1185,7 @@ public void RunTestsMultipleCallsShouldNotRunInParallel() }; var mockRunRequest = new Mock(); - _mockTestPlatform.Setup(mt => mt.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())) + _mockTestPlatform.Setup(mt => mt.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())) .Returns(mockRunRequest.Object); var mockRunEventsRegistrar1 = new Mock(); @@ -1324,11 +1324,11 @@ public void DiscoverTestsShouldUpdateDesignModeAndCollectSourceInformation(bool var designmode = $"{designModeValue}"; _mockTestPlatform.Verify( - tp => tp.CreateDiscoveryRequest(It.IsAny(), It.Is(dc => dc.RunSettings.Contains(designmode)), It.IsAny(), It.IsAny>())); + tp => tp.CreateDiscoveryRequest(It.IsAny(), It.Is(dc => dc.RunSettings.Contains(designmode)), It.IsAny(), It.IsAny>(), It.IsAny())); var collectSourceInformation = $"{designModeValue}"; _mockTestPlatform.Verify( - tp => tp.CreateDiscoveryRequest(It.IsAny(), It.Is(dc => dc.RunSettings.Contains(collectSourceInformation)), It.IsAny(), It.IsAny>())); + tp => tp.CreateDiscoveryRequest(It.IsAny(), It.Is(dc => dc.RunSettings.Contains(collectSourceInformation)), It.IsAny(), It.IsAny>(), It.IsAny())); } [TestMethod] @@ -1342,7 +1342,7 @@ public void DiscoverTestsShouldNotUpdateDesignModeIfUserHasSetDesignModeInRunSet var designmode = "False"; _mockTestPlatform.Verify( - tp => tp.CreateDiscoveryRequest(It.IsAny(), It.Is(dc => dc.RunSettings.Contains(designmode)), It.IsAny(), It.IsAny>())); + tp => tp.CreateDiscoveryRequest(It.IsAny(), It.Is(dc => dc.RunSettings.Contains(designmode)), It.IsAny(), It.IsAny>(), It.IsAny())); } [DataTestMethod] @@ -1362,7 +1362,7 @@ public void RunTestsShouldUpdateDesignModeIfRunnerIsInDesignMode(bool designMode _testRequestManager.RunTests(payload, new Mock().Object, new Mock().Object, _protocolConfig); var designmode = $"{designModeValue}"; - _mockTestPlatform.Verify(tp => tp.CreateTestRunRequest(It.IsAny(), It.Is(rc => rc.TestRunSettings.Contains(designmode)), It.IsAny(), It.IsAny>())); + _mockTestPlatform.Verify(tp => tp.CreateTestRunRequest(It.IsAny(), It.Is(rc => rc.TestRunSettings.Contains(designmode)), It.IsAny(), It.IsAny>(), It.IsAny())); } [DataTestMethod] @@ -1377,7 +1377,7 @@ public void DiscoverTestsShouldNotUpdateCollectSourceInformationIfUserHasSetItIn var collectSourceInformation = $"{val}"; _mockTestPlatform.Verify( - tp => tp.CreateDiscoveryRequest(It.IsAny(), It.Is(dc => dc.RunSettings.Contains(collectSourceInformation)), It.IsAny(), It.IsAny>())); + tp => tp.CreateDiscoveryRequest(It.IsAny(), It.Is(dc => dc.RunSettings.Contains(collectSourceInformation)), It.IsAny(), It.IsAny>(), It.IsAny())); } [TestMethod] @@ -1401,7 +1401,7 @@ public void RunTestsShouldShouldUpdateFrameworkAndPlatformIfNotSpecifiedInDesign .Returns(new FrameworkName(Constants.DotNetFramework46)); TestRunCriteria? actualTestRunCriteria = null; var mockTestRunRequest = new Mock(); - _mockTestPlatform.Setup(mt => mt.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Callback( + _mockTestPlatform.Setup(mt => mt.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Callback( (IRequestData requestData, TestRunCriteria runCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => actualTestRunCriteria = runCriteria).Returns(mockTestRunRequest.Object); _testRequestManager.RunTests(payload, new Mock().Object, new Mock().Object, _protocolConfig); @@ -1438,7 +1438,7 @@ public void RunTestsShouldNotUpdateFrameworkAndPlatformIfSpecifiedInDesignMode() .Returns(new FrameworkName(Constants.DotNetFramework451)); TestRunCriteria? actualTestRunCriteria = null; var mockTestRunRequest = new Mock(); - _mockTestPlatform.Setup(mt => mt.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Callback( + _mockTestPlatform.Setup(mt => mt.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Callback( (IRequestData requestData, TestRunCriteria runCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => actualTestRunCriteria = runCriteria).Returns(mockTestRunRequest.Object); _testRequestManager.RunTests(payload, new Mock().Object, new Mock().Object, _protocolConfig); @@ -1479,7 +1479,7 @@ public void RunTestsShouldNotUpdatePlatformIfSpecifiedInDesignMode(string target .Returns(new FrameworkName(Constants.DotNetFramework451)); TestRunCriteria? actualTestRunCriteria = null; var mockTestRunRequest = new Mock(); - _mockTestPlatform.Setup(mt => mt.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Callback( + _mockTestPlatform.Setup(mt => mt.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Callback( (IRequestData requestData, TestRunCriteria runCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => actualTestRunCriteria = runCriteria).Returns(mockTestRunRequest.Object); _testRequestManager.RunTests(payload, new Mock().Object, new Mock().Object, _protocolConfig); @@ -1513,7 +1513,7 @@ public void RunTestsShouldUpdateFrameworkAndPlatformInCommandLineScenarios() .Returns(new FrameworkName(Constants.DotNetFramework46)); TestRunCriteria? actualTestRunCriteria = null; var mockTestRunRequest = new Mock(); - _mockTestPlatform.Setup(mt => mt.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Callback( + _mockTestPlatform.Setup(mt => mt.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Callback( (IRequestData requestData, TestRunCriteria runCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => actualTestRunCriteria = runCriteria).Returns(mockTestRunRequest.Object); _testRequestManager.RunTests(payload, new Mock().Object, new Mock().Object, _protocolConfig); @@ -1551,7 +1551,7 @@ public void RunTestsShouldNotpdateFrameworkAndPlatformInRunsettingsIfSpecifiedBy .Returns(new FrameworkName(Constants.DotNetFramework46)); TestRunCriteria? actualTestRunCriteria = null; var mockTestRunRequest = new Mock(); - _mockTestPlatform.Setup(mt => mt.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Callback( + _mockTestPlatform.Setup(mt => mt.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Callback( (IRequestData requestData, TestRunCriteria runCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => actualTestRunCriteria = runCriteria).Returns(mockTestRunRequest.Object); _testRequestManager.RunTests(payload, new Mock().Object, new Mock().Object, _protocolConfig); @@ -1593,7 +1593,7 @@ public void RunTestsWithTestCasesShouldUpdateFrameworkAndPlatformIfNotSpecifiedI .Returns(new FrameworkName(Constants.DotNetFramework46)); TestRunCriteria? actualTestRunCriteria = null; var mockTestRunRequest = new Mock(); - _mockTestPlatform.Setup(mt => mt.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Callback( + _mockTestPlatform.Setup(mt => mt.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Callback( (IRequestData requestData, TestRunCriteria runCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => actualTestRunCriteria = runCriteria).Returns(mockTestRunRequest.Object); _testRequestManager.RunTests(payload, new Mock().Object, new Mock().Object, _protocolConfig); @@ -1728,7 +1728,7 @@ public void RunTestsShouldAddConsoleLoggerInRunSettingsInNonDesignMode() _commandLineOptions.IsDesignMode = false; TestRunCriteria? actualTestRunCriteria = null; var mockTestRunRequest = new Mock(); - _mockTestPlatform.Setup(mt => mt.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Callback( + _mockTestPlatform.Setup(mt => mt.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Callback( (IRequestData requestData, TestRunCriteria runCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => actualTestRunCriteria = runCriteria).Returns(mockTestRunRequest.Object); _testRequestManager.RunTests(payload, new Mock().Object, new Mock().Object, _protocolConfig); @@ -1767,7 +1767,7 @@ public void RunTestsShouldAddConsoleLoggerInRunSettingsIfDesignModeSetFalseInRun _commandLineOptions.IsDesignMode = true; TestRunCriteria? actualTestRunCriteria = null; var mockTestRunRequest = new Mock(); - _mockTestPlatform.Setup(mt => mt.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Callback( + _mockTestPlatform.Setup(mt => mt.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Callback( (IRequestData requestData, TestRunCriteria runCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => actualTestRunCriteria = runCriteria).Returns(mockTestRunRequest.Object); _testRequestManager.RunTests(payload, new Mock().Object, new Mock().Object, _protocolConfig); @@ -1807,7 +1807,7 @@ public void DiscoverTestsShouldAddConsoleLoggerInRunSettingsIfDesignModeSetFalse DiscoveryCriteria? actualDiscoveryCriteria = null; var mockDiscoveryRequest = new Mock(); _mockTestPlatform - .Setup(mt => mt.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())) + .Setup(mt => mt.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())) .Callback( (IRequestData requestData, DiscoveryCriteria discoveryCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => actualDiscoveryCriteria = discoveryCriteria).Returns(mockDiscoveryRequest.Object); @@ -1841,7 +1841,7 @@ public void RunTestsShouldNotAddConsoleLoggerInRunSettingsInDesignMode() _commandLineOptions.IsDesignMode = false; TestRunCriteria? actualTestRunCriteria = null; var mockTestRunRequest = new Mock(); - _mockTestPlatform.Setup(mt => mt.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Callback( + _mockTestPlatform.Setup(mt => mt.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Callback( (IRequestData requestData, TestRunCriteria runCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => actualTestRunCriteria = runCriteria).Returns(mockTestRunRequest.Object); _testRequestManager.RunTests(payload, new Mock().Object, new Mock().Object, _protocolConfig); @@ -1865,7 +1865,7 @@ public void DiscoverTestsShouldAddConsoleLoggerInRunSettingsInNonDesignMode() DiscoveryCriteria? actualDiscoveryCriteria = null; var mockDiscoveryRequest = new Mock(); _mockTestPlatform - .Setup(mt => mt.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())) + .Setup(mt => mt.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())) .Callback( (IRequestData requestData, DiscoveryCriteria discoveryCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => actualDiscoveryCriteria = discoveryCriteria).Returns(mockDiscoveryRequest.Object); @@ -1897,7 +1897,7 @@ public void DiscoverTestsShouldNotAddConsoleLoggerInRunSettingsInDesignMode() DiscoveryCriteria? actualDiscoveryCriteria = null; var mockDiscoveryRequest = new Mock(); _mockTestPlatform - .Setup(mt => mt.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())) + .Setup(mt => mt.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())) .Callback( (IRequestData requestData, DiscoveryCriteria discoveryCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => actualDiscoveryCriteria = discoveryCriteria).Returns(mockDiscoveryRequest.Object); @@ -1939,7 +1939,7 @@ public void RunTestsShouldOverrideOnlyAssemblyNameIfConsoleLoggerAlreadyPresentI _commandLineOptions.IsDesignMode = false; TestRunCriteria? actualTestRunCriteria = null; var mockTestRunRequest = new Mock(); - _mockTestPlatform.Setup(mt => mt.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Callback( + _mockTestPlatform.Setup(mt => mt.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Callback( (IRequestData requestData, TestRunCriteria runCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => actualTestRunCriteria = runCriteria).Returns(mockTestRunRequest.Object); _testRequestManager.RunTests(payload, new Mock().Object, new Mock().Object, _protocolConfig); @@ -1988,7 +1988,7 @@ public void DiscoverTestsShouldOverrideOnlyAssemblyNameIfConsoleLoggerAlreadyPre DiscoveryCriteria? actualDiscoveryCriteria = null; var mockDiscoveryRequest = new Mock(); _mockTestPlatform - .Setup(mt => mt.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())) + .Setup(mt => mt.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())) .Callback( (IRequestData requestData, DiscoveryCriteria discoveryCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => actualDiscoveryCriteria = discoveryCriteria).Returns(mockDiscoveryRequest.Object); @@ -2040,7 +2040,7 @@ public void RunTestsShouldOverrideOnlyAssemblyNameIfConsoleLoggerAlreadyPresentI _commandLineOptions.IsDesignMode = false; TestRunCriteria? actualTestRunCriteria = null; var mockTestRunRequest = new Mock(); - _mockTestPlatform.Setup(mt => mt.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Callback( + _mockTestPlatform.Setup(mt => mt.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Callback( (IRequestData requestData, TestRunCriteria runCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => actualTestRunCriteria = runCriteria).Returns(mockTestRunRequest.Object); _testRequestManager.RunTests(payload, new Mock().Object, new Mock().Object, _protocolConfig); @@ -2089,7 +2089,7 @@ public void DiscoverTestsShouldOverrideOnlyAssemblyNameIfConsoleLoggerAlreadyPre DiscoveryCriteria? actualDiscoveryCriteria = null; var mockDiscoveryRequest = new Mock(); _mockTestPlatform - .Setup(mt => mt.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())) + .Setup(mt => mt.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())) .Callback( (IRequestData requestData, DiscoveryCriteria discoveryCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => actualDiscoveryCriteria = discoveryCriteria).Returns(mockDiscoveryRequest.Object); @@ -2225,7 +2225,7 @@ public void StartTestSessionShouldPassCorrectTelemetryOptedInOptionToTestPlatfor It.IsAny(), It.IsAny(), It.IsAny(), - It.IsAny>())) + It.IsAny>(), It.IsAny())) .Returns(true) .Callback( (IRequestData rd, StartTestSessionCriteria _, ITestSessionEventsHandler _, Dictionary _) => Assert.IsTrue(rd.IsTelemetryOptedIn)); @@ -2272,7 +2272,7 @@ public void StartTestSessionShouldUpdateSettings() It.IsAny(), It.IsAny(), It.IsAny(), - It.IsAny>())) + It.IsAny>(), It.IsAny())) .Returns(true) .Callback( (IRequestData _, StartTestSessionCriteria criteria, ITestSessionEventsHandler _, Dictionary _) => @@ -2343,7 +2343,7 @@ public void StartTestSessionShouldBeSuccessful() It.IsAny(), It.IsAny(), It.IsAny(), - It.IsAny>())) + It.IsAny>(), It.IsAny())) .Returns(true); _testRequestManager.StartTestSession( @@ -2535,7 +2535,7 @@ private void RunTestsIfThrowsExceptionShouldThrowOut(Exception exception) var createRunRequestCalled = 0; TestRunCriteria? observedCriteria = null; var mockRunRequest = new Mock(); - _mockTestPlatform.Setup(mt => mt.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Callback( + _mockTestPlatform.Setup(mt => mt.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Callback( (IRequestData requestData, TestRunCriteria runCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => { createRunRequestCalled++; @@ -2560,7 +2560,7 @@ private void DiscoverTestsIfThrowsExceptionShouldThrowOut(Exception exception) DiscoveryCriteria? observedCriteria = null; var mockDiscoveryRequest = new Mock(); - _mockTestPlatform.Setup(mt => mt.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>())).Callback( + _mockTestPlatform.Setup(mt => mt.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Callback( (IRequestData requestData, DiscoveryCriteria discoveryCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => observedCriteria = discoveryCriteria).Returns(mockDiscoveryRequest.Object); mockDiscoveryRequest.Setup(mr => mr.DiscoverAsync()).Throws(exception); From cd5a5f89cd439607206596d7b33f4ff2612c856c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jare=C5=A1?= Date: Tue, 14 Jun 2022 16:43:40 +0200 Subject: [PATCH 04/12] Add DiscoveryResult --- .../Engine/ClientProtocol/DiscoveryStatus.cs | 5 ++++ .../Parallel/DiscoveryDataAggregator.cs | 2 +- .../Parallel/ParallelProxyDiscoveryManager.cs | 23 +++++++++++-------- .../Parallel/ParallelProxyExecutionManager.cs | 3 ++- 4 files changed, 22 insertions(+), 11 deletions(-) diff --git a/src/Microsoft.TestPlatform.Common/Interfaces/Engine/ClientProtocol/DiscoveryStatus.cs b/src/Microsoft.TestPlatform.Common/Interfaces/Engine/ClientProtocol/DiscoveryStatus.cs index 337b4139ff..e5e435ce8a 100644 --- a/src/Microsoft.TestPlatform.Common/Interfaces/Engine/ClientProtocol/DiscoveryStatus.cs +++ b/src/Microsoft.TestPlatform.Common/Interfaces/Engine/ClientProtocol/DiscoveryStatus.cs @@ -22,4 +22,9 @@ public enum DiscoveryStatus /// Indicates that source was fully discovered. /// FullyDiscovered, + + /// + /// Indicates that source was skipped in discovery. + /// + SkippedDiscovery } diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/DiscoveryDataAggregator.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/DiscoveryDataAggregator.cs index b30d95546d..e087f83017 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/DiscoveryDataAggregator.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/DiscoveryDataAggregator.cs @@ -212,7 +212,7 @@ public void MarkSourcesWithStatus(IEnumerable? sources, DiscoveryStatus (_, previousStatus) => { if (previousStatus == DiscoveryStatus.FullyDiscovered && status != DiscoveryStatus.FullyDiscovered - || previousStatus == DiscoveryStatus.PartiallyDiscovered && status == DiscoveryStatus.NotDiscovered) + || previousStatus == DiscoveryStatus.PartiallyDiscovered && (status == DiscoveryStatus.NotDiscovered || status == DiscoveryStatus.SkippedDiscovery)) { EqtTrace.Warning($"DiscoveryDataAggregator.MarkSourcesWithStatus: Downgrading source {source} status from '{previousStatus}' to '{status}'."); } diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/ParallelProxyDiscoveryManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/ParallelProxyDiscoveryManager.cs index 7f764744e1..1d46f668a4 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/ParallelProxyDiscoveryManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/ParallelProxyDiscoveryManager.cs @@ -84,14 +84,8 @@ public void DiscoverTests(DiscoveryCriteria discoveryCriteria, ITestDiscoveryEve var workloads = SplitToWorkloads(discoveryCriteria, _sourceToTestHostProviderMap); _availableTestSources = workloads.SelectMany(w => w.Work.Sources).Count(); var runnableWorkloads = workloads.Where(workload => workload.HasProvider).ToList(); - var nonRunnableWorkloads = workloads.Where(workload => !workload.HasProvider).ToList(); - if (nonRunnableWorkloads.Count > 0) - { - // We found some sources that don't associate to any runtime provider and so they cannot run. - // Mark the run as aborted. - _dataAggregator.MarkAsAborted(); - } _availableWorkloads = runnableWorkloads.Count(); + var nonRunnableWorkloads = workloads.Where(workload => !workload.HasProvider).ToList(); EqtTrace.Verbose("ParallelProxyDiscoveryManager.DiscoverTests: Start discovery. Total sources: " + _availableTestSources); @@ -103,6 +97,16 @@ public void DiscoverTests(DiscoveryCriteria discoveryCriteria, ITestDiscoveryEve // marked as NotDiscovered. _dataAggregator.MarkSourcesWithStatus(discoveryCriteria.Sources, DiscoveryStatus.NotDiscovered); + if (nonRunnableWorkloads.Count > 0) + { + // We found some sources that don't associate to any runtime provider and so they cannot run. + // Mark the sources as skipped. + + _dataAggregator.MarkSourcesWithStatus(nonRunnableWorkloads.SelectMany(w => w.Work.Sources), DiscoveryStatus.SkippedDiscovery); + // TODO: in strict mode keep them as non-discovered, and mark the run as aborted. + // _dataAggregator.MarkAsAborted(); + } + _parallelOperationManager.StartWork(runnableWorkloads, eventHandler, GetParallelEventHandler, DiscoverTestsOnConcurrentManager); } @@ -147,11 +151,12 @@ public bool HandlePartialDiscoveryComplete(IProxyDiscoveryManager proxyDiscovery var notDiscoveredCount = _dataAggregator.GetSourcesWithStatus(DiscoveryStatus.NotDiscovered).Count; var partiallyDiscoveredCount = _dataAggregator.GetSourcesWithStatus(DiscoveryStatus.PartiallyDiscovered).Count; var fullyDiscoveredCount = _dataAggregator.GetSourcesWithStatus(DiscoveryStatus.FullyDiscovered).Count; + var skippedCount = _dataAggregator.GetSourcesWithStatus(DiscoveryStatus.SkippedDiscovery).Count; var expectedCount = _availableTestSources; // When this fails, look at the _dataAggregator and look at the sources that it holds. It is possible that adapter incorrectly reports // the source on the testcase object. Each distinct source that will appear on TestCase will be considered a file. - TPDebug.Assert(notDiscoveredCount + partiallyDiscoveredCount + fullyDiscoveredCount == expectedCount, - $"Total count of sources ({expectedCount}) should match the count of sources with status not discovered ({notDiscoveredCount}), partially discovered ({partiallyDiscoveredCount}) and fully discovered ({fullyDiscoveredCount})."); + TPDebug.Assert(notDiscoveredCount + partiallyDiscoveredCount + fullyDiscoveredCount + skippedCount == expectedCount, + $"Total count of sources ({expectedCount}) should match the count of sources with status not discovered ({notDiscoveredCount}), partially discovered ({partiallyDiscoveredCount}), fully discovered ({fullyDiscoveredCount}) and skipped ({skippedCount})."); #endif var allDiscoverersCompleted = false; diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/ParallelProxyExecutionManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/ParallelProxyExecutionManager.cs index 351d456119..33b907059e 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/ParallelProxyExecutionManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/ParallelProxyExecutionManager.cs @@ -108,7 +108,8 @@ public int StartTestRun(TestRunCriteria testRunCriteria, IInternalTestRunEventsH _currentRunDataAggregator = new ParallelRunDataAggregator(testRunCriteria.TestRunSettings); if (nonRunnableWorkloads.Count > 0) { - _currentRunDataAggregator.MarkAsAborted(); + // TODO: in strict mode fail if we find a source that we cannot run. + // _currentRunDataAggregator.MarkAsAborted(); } _parallelOperationManager.StartWork(runnableWorkloads, eventHandler, GetParallelEventHandler, StartTestRunOnConcurrentManager); From 745191c9a0d44561d9f7465489018bede2348abc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jare=C5=A1?= Date: Tue, 14 Jun 2022 17:07:17 +0200 Subject: [PATCH 05/12] Test --- .../TestRequestManagerTests.cs | 89 ++++++++++--------- 1 file changed, 45 insertions(+), 44 deletions(-) diff --git a/test/vstest.console.UnitTests/TestPlatformHelpers/TestRequestManagerTests.cs b/test/vstest.console.UnitTests/TestPlatformHelpers/TestRequestManagerTests.cs index e5b1123ecc..750392c7f1 100644 --- a/test/vstest.console.UnitTests/TestPlatformHelpers/TestRequestManagerTests.cs +++ b/test/vstest.console.UnitTests/TestPlatformHelpers/TestRequestManagerTests.cs @@ -168,7 +168,7 @@ public void DiscoverTestsShouldReadTheBatchSizeFromSettingsAndSetItForDiscoveryC DiscoveryCriteria? actualDiscoveryCriteria = null; var mockDiscoveryRequest = new Mock(); _mockTestPlatform.Setup(mt => mt.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Callback( - (IRequestData requestData, DiscoveryCriteria discoveryCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => actualDiscoveryCriteria = discoveryCriteria).Returns(mockDiscoveryRequest.Object); + (IRequestData requestData, DiscoveryCriteria discoveryCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap, IWarningLogger _) => actualDiscoveryCriteria = discoveryCriteria).Returns(mockDiscoveryRequest.Object); _testRequestManager.DiscoverTests(payload, new Mock().Object, _protocolConfig); Assert.AreEqual(15, actualDiscoveryCriteria!.FrequencyOfDiscoveredTestsEvent); @@ -187,7 +187,7 @@ public void DiscoverTestsShouldCallTestPlatformAndSucceed() DiscoveryCriteria? actualDiscoveryCriteria = null; var mockDiscoveryRequest = new Mock(); _mockTestPlatform.Setup(mt => mt.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Callback( - (IRequestData requestData, DiscoveryCriteria discoveryCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => + (IRequestData requestData, DiscoveryCriteria discoveryCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap, IWarningLogger _) => { createDiscoveryRequestCalled++; actualDiscoveryCriteria = discoveryCriteria; @@ -242,7 +242,7 @@ public void DiscoverTestsShouldPassSameProtocolConfigInRequestData() IRequestData? actualRequestData = null; var mockDiscoveryRequest = new Mock(); _mockTestPlatform.Setup(mt => mt.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Callback( - (IRequestData requestData, DiscoveryCriteria discoveryCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => actualRequestData = requestData).Returns(mockDiscoveryRequest.Object); + (IRequestData requestData, DiscoveryCriteria discoveryCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap, IWarningLogger _) => actualRequestData = requestData).Returns(mockDiscoveryRequest.Object); var mockDiscoveryRegistrar = new Mock(); @@ -294,7 +294,7 @@ public void DiscoverTestsShouldCollectMetrics() IRequestData? actualRequestData = null; var mockDiscoveryRequest = new Mock(); _mockTestPlatform.Setup(mt => mt.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Callback( - (IRequestData requestData, DiscoveryCriteria discoveryCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => actualRequestData = requestData).Returns(mockDiscoveryRequest.Object); + (IRequestData requestData, DiscoveryCriteria discoveryCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap, IWarningLogger _) => actualRequestData = requestData).Returns(mockDiscoveryRequest.Object); _testRequestManager = new TestRequestManager( CommandLineOptions.Instance, @@ -344,7 +344,7 @@ public void DiscoverTestsShouldCollectTargetDeviceLocalMachineIfTargetDeviceStri IRequestData? actualRequestData = null; var mockDiscoveryRequest = new Mock(); _mockTestPlatform.Setup(mt => mt.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Callback( - (IRequestData requestData, DiscoveryCriteria discoveryCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => actualRequestData = requestData).Returns(mockDiscoveryRequest.Object); + (IRequestData requestData, DiscoveryCriteria discoveryCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap, IWarningLogger _) => actualRequestData = requestData).Returns(mockDiscoveryRequest.Object); _testRequestManager = new TestRequestManager( CommandLineOptions.Instance, @@ -388,7 +388,7 @@ public void DiscoverTestsShouldCollectTargetDeviceIfTargetDeviceIsDevice() IRequestData? actualRequestData = null; var mockDiscoveryRequest = new Mock(); _mockTestPlatform.Setup(mt => mt.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Callback( - (IRequestData requestData, DiscoveryCriteria discoveryCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => actualRequestData = requestData).Returns(mockDiscoveryRequest.Object); + (IRequestData requestData, DiscoveryCriteria discoveryCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap, IWarningLogger _) => actualRequestData = requestData).Returns(mockDiscoveryRequest.Object); _testRequestManager = new TestRequestManager( CommandLineOptions.Instance, @@ -432,7 +432,7 @@ public void DiscoverTestsShouldCollectTargetDeviceIfTargetDeviceIsEmulator() IRequestData? actualRequestData = null; var mockDiscoveryRequest = new Mock(); _mockTestPlatform.Setup(mt => mt.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Callback( - (IRequestData requestData, DiscoveryCriteria discoveryCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => actualRequestData = requestData).Returns(mockDiscoveryRequest.Object); + (IRequestData requestData, DiscoveryCriteria discoveryCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap, IWarningLogger _) => actualRequestData = requestData).Returns(mockDiscoveryRequest.Object); _testRequestManager = new TestRequestManager( CommandLineOptions.Instance, @@ -476,7 +476,7 @@ public void DiscoverTestsShouldCollectCommands() IRequestData? actualRequestData = null; var mockDiscoveryRequest = new Mock(); _mockTestPlatform.Setup(mt => mt.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Callback( - (IRequestData requestData, DiscoveryCriteria discoveryCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => actualRequestData = requestData).Returns(mockDiscoveryRequest.Object); + (IRequestData requestData, DiscoveryCriteria discoveryCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap, IWarningLogger _) => actualRequestData = requestData).Returns(mockDiscoveryRequest.Object); _testRequestManager = new TestRequestManager( CommandLineOptions.Instance, @@ -532,7 +532,7 @@ public void DiscoverTestsShouldCollectTestSettings() IRequestData? actualRequestData = null; var mockDiscoveryRequest = new Mock(); _mockTestPlatform.Setup(mt => mt.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Callback( - (IRequestData requestData, DiscoveryCriteria discoveryCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => actualRequestData = requestData).Returns(mockDiscoveryRequest.Object); + (IRequestData requestData, DiscoveryCriteria discoveryCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap, IWarningLogger _) => actualRequestData = requestData).Returns(mockDiscoveryRequest.Object); _testRequestManager = new TestRequestManager( CommandLineOptions.Instance, @@ -579,7 +579,7 @@ public void DiscoverTestsShouldCollectVsmdiFile() IRequestData? actualRequestData = null; var mockDiscoveryRequest = new Mock(); _mockTestPlatform.Setup(mt => mt.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Callback( - (IRequestData requestData, DiscoveryCriteria discoveryCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => actualRequestData = requestData).Returns(mockDiscoveryRequest.Object); + (IRequestData requestData, DiscoveryCriteria discoveryCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap, IWarningLogger _) => actualRequestData = requestData).Returns(mockDiscoveryRequest.Object); _testRequestManager = new TestRequestManager( CommandLineOptions.Instance, @@ -626,7 +626,7 @@ public void DiscoverTestsShouldCollectTestRunConfigFile() IRequestData? actualRequestData = null; var mockDiscoveryRequest = new Mock(); _mockTestPlatform.Setup(mt => mt.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Callback( - (IRequestData requestData, DiscoveryCriteria discoveryCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => actualRequestData = requestData).Returns(mockDiscoveryRequest.Object); + (IRequestData requestData, DiscoveryCriteria discoveryCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap, IWarningLogger _) => actualRequestData = requestData).Returns(mockDiscoveryRequest.Object); _testRequestManager = new TestRequestManager( CommandLineOptions.Instance, @@ -672,7 +672,7 @@ public void DiscoverTestsShouldUpdateFrameworkAndPlatformIfNotSpecifiedInDesignM DiscoveryCriteria? actualDiscoveryCriteria = null; var mockDiscoveryRequest = new Mock(); _mockTestPlatform.Setup(mt => mt.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Callback( - (IRequestData requestData, DiscoveryCriteria discoveryCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => actualDiscoveryCriteria = discoveryCriteria).Returns(mockDiscoveryRequest.Object); + (IRequestData requestData, DiscoveryCriteria discoveryCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap, IWarningLogger _) => actualDiscoveryCriteria = discoveryCriteria).Returns(mockDiscoveryRequest.Object); _testRequestManager.DiscoverTests(payload, new Mock().Object, _protocolConfig); @@ -706,7 +706,7 @@ public void DiscoverTestsShouldNotUpdateFrameworkAndPlatformIfSpecifiedInDesignM DiscoveryCriteria? actualDiscoveryCriteria = null; var mockDiscoveryRequest = new Mock(); _mockTestPlatform.Setup(mt => mt.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Callback( - (IRequestData requestData, DiscoveryCriteria discoveryCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => actualDiscoveryCriteria = discoveryCriteria).Returns(mockDiscoveryRequest.Object); + (IRequestData requestData, DiscoveryCriteria discoveryCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap, IWarningLogger _) => actualDiscoveryCriteria = discoveryCriteria).Returns(mockDiscoveryRequest.Object); _testRequestManager.DiscoverTests(payload, new Mock().Object, _protocolConfig); @@ -738,7 +738,7 @@ public void DiscoverTestsShouldUpdateFrameworkAndPlatformInCommandLineScenariosI DiscoveryCriteria? actualDiscoveryCriteria = null; var mockDiscoveryRequest = new Mock(); _mockTestPlatform.Setup(mt => mt.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Callback( - (IRequestData requestData, DiscoveryCriteria discoveryCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => actualDiscoveryCriteria = discoveryCriteria).Returns(mockDiscoveryRequest.Object); + (IRequestData requestData, DiscoveryCriteria discoveryCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap, IWarningLogger _) => actualDiscoveryCriteria = discoveryCriteria).Returns(mockDiscoveryRequest.Object); _testRequestManager.DiscoverTests(payload, new Mock().Object, _protocolConfig); _mockAssemblyMetadataProvider.Verify(a => a.GetArchitecture(It.IsAny())); @@ -775,7 +775,7 @@ public void DiscoverTestsShouldNotInferAndUpdateFrameworkAndPlatformInCommandLin _mockTestPlatform .Setup(mt => mt.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())) .Callback( - (IRequestData requestData, DiscoveryCriteria discoveryCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => actualDiscoveryCriteria = discoveryCriteria).Returns(mockDiscoveryRequest.Object); + (IRequestData requestData, DiscoveryCriteria discoveryCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap, IWarningLogger _) => actualDiscoveryCriteria = discoveryCriteria).Returns(mockDiscoveryRequest.Object); _testRequestManager.DiscoverTests(payload, new Mock().Object, _protocolConfig); @@ -856,7 +856,7 @@ public void RunTestsShouldReadTheBatchSizeFromSettingsAndSetItForTestRunCriteria TestRunCriteria? actualTestRunCriteria = null; var mockDiscoveryRequest = new Mock(); _mockTestPlatform.Setup(mt => mt.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Callback( - (IRequestData requestData, TestRunCriteria runCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => actualTestRunCriteria = runCriteria).Returns(mockDiscoveryRequest.Object); + (IRequestData requestData, TestRunCriteria runCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap, IWarningLogger _) => actualTestRunCriteria = runCriteria).Returns(mockDiscoveryRequest.Object); _testRequestManager.RunTests(payload, new Mock().Object, new Mock().Object, _protocolConfig); Assert.AreEqual(15, actualTestRunCriteria!.FrequencyOfRunStatsChangeEvent); @@ -880,7 +880,7 @@ public void RunTestsShouldNotThrowForFramework35() TestRunCriteria? actualTestRunCriteria = null; var mockDiscoveryRequest = new Mock(); _mockTestPlatform.Setup(mt => mt.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Callback( - (IRequestData requestData, TestRunCriteria runCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => actualTestRunCriteria = runCriteria).Returns(mockDiscoveryRequest.Object); + (IRequestData requestData, TestRunCriteria runCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap, IWarningLogger _) => actualTestRunCriteria = runCriteria).Returns(mockDiscoveryRequest.Object); _mockAssemblyMetadataProvider.Setup(a => a.GetFrameworkName(It.IsAny())).Returns(new FrameworkName(Constants.DotNetFramework35)); var mockRunEventsRegistrar = new Mock(); @@ -905,7 +905,7 @@ public void RunTestsShouldPassSameProtocolConfigInRequestData() IRequestData? actualRequestData = null; var mockDiscoveryRequest = new Mock(); _mockTestPlatform.Setup(mt => mt.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Callback( - (IRequestData requestData, TestRunCriteria runCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => actualRequestData = requestData).Returns(mockDiscoveryRequest.Object); + (IRequestData requestData, TestRunCriteria runCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap, IWarningLogger _) => actualRequestData = requestData).Returns(mockDiscoveryRequest.Object); // Act. _testRequestManager.RunTests(payload, new Mock().Object, new Mock().Object, mockProtocolConfig); @@ -929,7 +929,7 @@ public void RunTestsShouldCollectCommands() IRequestData? actualRequestData = null; var mockDiscoveryRequest = new Mock(); _mockTestPlatform.Setup(mt => mt.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Callback( - (IRequestData requestData, TestRunCriteria runCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => actualRequestData = requestData).Returns(mockDiscoveryRequest.Object); + (IRequestData requestData, TestRunCriteria runCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap, IWarningLogger _) => actualRequestData = requestData).Returns(mockDiscoveryRequest.Object); _testRequestManager = new TestRequestManager( CommandLineOptions.Instance, @@ -994,7 +994,7 @@ public void RunTestsShouldCollectTelemetryForLegacySettings() IRequestData? actualRequestData = null; var mockDiscoveryRequest = new Mock(); _mockTestPlatform.Setup(mt => mt.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Callback( - (IRequestData requestData, TestRunCriteria runCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => actualRequestData = requestData).Returns(mockDiscoveryRequest.Object); + (IRequestData requestData, TestRunCriteria runCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap, IWarningLogger _) => actualRequestData = requestData).Returns(mockDiscoveryRequest.Object); _testRequestManager = new TestRequestManager( CommandLineOptions.Instance, @@ -1042,7 +1042,7 @@ public void RunTestsShouldCollectTelemetryForTestSettingsEmbeddedInsideRunSettin IRequestData? actualRequestData = null; var mockDiscoveryRequest = new Mock(); _mockTestPlatform.Setup(mt => mt.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Callback( - (IRequestData requestData, TestRunCriteria runCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => actualRequestData = requestData).Returns(mockDiscoveryRequest.Object); + (IRequestData requestData, TestRunCriteria runCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap, IWarningLogger _) => actualRequestData = requestData).Returns(mockDiscoveryRequest.Object); _testRequestManager = new TestRequestManager( CommandLineOptions.Instance, @@ -1088,7 +1088,7 @@ public void RunTestsShouldCollectMetrics() IRequestData? actualRequestData = null; var mockDiscoveryRequest = new Mock(); _mockTestPlatform.Setup(mt => mt.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Callback( - (IRequestData requestData, TestRunCriteria runCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => actualRequestData = requestData).Returns(mockDiscoveryRequest.Object); + (IRequestData requestData, TestRunCriteria runCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap, IWarningLogger _) => actualRequestData = requestData).Returns(mockDiscoveryRequest.Object); _testRequestManager = new TestRequestManager( CommandLineOptions.Instance, @@ -1128,7 +1128,7 @@ public void RunTestsWithSourcesShouldCallTestPlatformAndSucceed() TestRunCriteria? observedCriteria = null; var mockRunRequest = new Mock(); _mockTestPlatform.Setup(mt => mt.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Callback( - (IRequestData requestData, TestRunCriteria runCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => + (IRequestData requestData, TestRunCriteria runCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap, IWarningLogger _) => { createRunRequestCalled++; observedCriteria = runCriteria; @@ -1402,7 +1402,7 @@ public void RunTestsShouldShouldUpdateFrameworkAndPlatformIfNotSpecifiedInDesign TestRunCriteria? actualTestRunCriteria = null; var mockTestRunRequest = new Mock(); _mockTestPlatform.Setup(mt => mt.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Callback( - (IRequestData requestData, TestRunCriteria runCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => actualTestRunCriteria = runCriteria).Returns(mockTestRunRequest.Object); + (IRequestData requestData, TestRunCriteria runCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap, IWarningLogger _) => actualTestRunCriteria = runCriteria).Returns(mockTestRunRequest.Object); _testRequestManager.RunTests(payload, new Mock().Object, new Mock().Object, _protocolConfig); @@ -1439,7 +1439,7 @@ public void RunTestsShouldNotUpdateFrameworkAndPlatformIfSpecifiedInDesignMode() TestRunCriteria? actualTestRunCriteria = null; var mockTestRunRequest = new Mock(); _mockTestPlatform.Setup(mt => mt.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Callback( - (IRequestData requestData, TestRunCriteria runCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => actualTestRunCriteria = runCriteria).Returns(mockTestRunRequest.Object); + (IRequestData requestData, TestRunCriteria runCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap, IWarningLogger _) => actualTestRunCriteria = runCriteria).Returns(mockTestRunRequest.Object); _testRequestManager.RunTests(payload, new Mock().Object, new Mock().Object, _protocolConfig); @@ -1480,7 +1480,7 @@ public void RunTestsShouldNotUpdatePlatformIfSpecifiedInDesignMode(string target TestRunCriteria? actualTestRunCriteria = null; var mockTestRunRequest = new Mock(); _mockTestPlatform.Setup(mt => mt.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Callback( - (IRequestData requestData, TestRunCriteria runCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => actualTestRunCriteria = runCriteria).Returns(mockTestRunRequest.Object); + (IRequestData requestData, TestRunCriteria runCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap, IWarningLogger _) => actualTestRunCriteria = runCriteria).Returns(mockTestRunRequest.Object); _testRequestManager.RunTests(payload, new Mock().Object, new Mock().Object, _protocolConfig); @@ -1514,7 +1514,7 @@ public void RunTestsShouldUpdateFrameworkAndPlatformInCommandLineScenarios() TestRunCriteria? actualTestRunCriteria = null; var mockTestRunRequest = new Mock(); _mockTestPlatform.Setup(mt => mt.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Callback( - (IRequestData requestData, TestRunCriteria runCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => actualTestRunCriteria = runCriteria).Returns(mockTestRunRequest.Object); + (IRequestData requestData, TestRunCriteria runCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap, IWarningLogger _) => actualTestRunCriteria = runCriteria).Returns(mockTestRunRequest.Object); _testRequestManager.RunTests(payload, new Mock().Object, new Mock().Object, _protocolConfig); @@ -1552,7 +1552,7 @@ public void RunTestsShouldNotpdateFrameworkAndPlatformInRunsettingsIfSpecifiedBy TestRunCriteria? actualTestRunCriteria = null; var mockTestRunRequest = new Mock(); _mockTestPlatform.Setup(mt => mt.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Callback( - (IRequestData requestData, TestRunCriteria runCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => actualTestRunCriteria = runCriteria).Returns(mockTestRunRequest.Object); + (IRequestData requestData, TestRunCriteria runCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap, IWarningLogger _) => actualTestRunCriteria = runCriteria).Returns(mockTestRunRequest.Object); _testRequestManager.RunTests(payload, new Mock().Object, new Mock().Object, _protocolConfig); @@ -1594,7 +1594,7 @@ public void RunTestsWithTestCasesShouldUpdateFrameworkAndPlatformIfNotSpecifiedI TestRunCriteria? actualTestRunCriteria = null; var mockTestRunRequest = new Mock(); _mockTestPlatform.Setup(mt => mt.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Callback( - (IRequestData requestData, TestRunCriteria runCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => actualTestRunCriteria = runCriteria).Returns(mockTestRunRequest.Object); + (IRequestData requestData, TestRunCriteria runCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap, IWarningLogger _) => actualTestRunCriteria = runCriteria).Returns(mockTestRunRequest.Object); _testRequestManager.RunTests(payload, new Mock().Object, new Mock().Object, _protocolConfig); @@ -1729,7 +1729,7 @@ public void RunTestsShouldAddConsoleLoggerInRunSettingsInNonDesignMode() TestRunCriteria? actualTestRunCriteria = null; var mockTestRunRequest = new Mock(); _mockTestPlatform.Setup(mt => mt.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Callback( - (IRequestData requestData, TestRunCriteria runCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => actualTestRunCriteria = runCriteria).Returns(mockTestRunRequest.Object); + (IRequestData requestData, TestRunCriteria runCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap, IWarningLogger _) => actualTestRunCriteria = runCriteria).Returns(mockTestRunRequest.Object); _testRequestManager.RunTests(payload, new Mock().Object, new Mock().Object, _protocolConfig); @@ -1768,7 +1768,7 @@ public void RunTestsShouldAddConsoleLoggerInRunSettingsIfDesignModeSetFalseInRun TestRunCriteria? actualTestRunCriteria = null; var mockTestRunRequest = new Mock(); _mockTestPlatform.Setup(mt => mt.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Callback( - (IRequestData requestData, TestRunCriteria runCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => actualTestRunCriteria = runCriteria).Returns(mockTestRunRequest.Object); + (IRequestData requestData, TestRunCriteria runCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap, IWarningLogger _) => actualTestRunCriteria = runCriteria).Returns(mockTestRunRequest.Object); _testRequestManager.RunTests(payload, new Mock().Object, new Mock().Object, _protocolConfig); var loggerSettingsList = XmlRunSettingsUtilities.GetLoggerRunSettings(actualTestRunCriteria!.TestRunSettings).LoggerSettingsList; @@ -1809,7 +1809,7 @@ public void DiscoverTestsShouldAddConsoleLoggerInRunSettingsIfDesignModeSetFalse _mockTestPlatform .Setup(mt => mt.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())) .Callback( - (IRequestData requestData, DiscoveryCriteria discoveryCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => actualDiscoveryCriteria = discoveryCriteria).Returns(mockDiscoveryRequest.Object); + (IRequestData requestData, DiscoveryCriteria discoveryCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap, IWarningLogger _) => actualDiscoveryCriteria = discoveryCriteria).Returns(mockDiscoveryRequest.Object); _testRequestManager.DiscoverTests(payload, new Mock().Object, _protocolConfig); @@ -1842,7 +1842,7 @@ public void RunTestsShouldNotAddConsoleLoggerInRunSettingsInDesignMode() TestRunCriteria? actualTestRunCriteria = null; var mockTestRunRequest = new Mock(); _mockTestPlatform.Setup(mt => mt.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Callback( - (IRequestData requestData, TestRunCriteria runCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => actualTestRunCriteria = runCriteria).Returns(mockTestRunRequest.Object); + (IRequestData requestData, TestRunCriteria runCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap, IWarningLogger _) => actualTestRunCriteria = runCriteria).Returns(mockTestRunRequest.Object); _testRequestManager.RunTests(payload, new Mock().Object, new Mock().Object, _protocolConfig); Assert.IsFalse(actualTestRunCriteria!.TestRunSettings.Contains("LoggerRunSettings")); @@ -1867,7 +1867,7 @@ public void DiscoverTestsShouldAddConsoleLoggerInRunSettingsInNonDesignMode() _mockTestPlatform .Setup(mt => mt.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())) .Callback( - (IRequestData requestData, DiscoveryCriteria discoveryCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => actualDiscoveryCriteria = discoveryCriteria).Returns(mockDiscoveryRequest.Object); + (IRequestData requestData, DiscoveryCriteria discoveryCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap, IWarningLogger _) => actualDiscoveryCriteria = discoveryCriteria).Returns(mockDiscoveryRequest.Object); _testRequestManager.DiscoverTests(payload, new Mock().Object, _protocolConfig); @@ -1899,7 +1899,7 @@ public void DiscoverTestsShouldNotAddConsoleLoggerInRunSettingsInDesignMode() _mockTestPlatform .Setup(mt => mt.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())) .Callback( - (IRequestData requestData, DiscoveryCriteria discoveryCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => actualDiscoveryCriteria = discoveryCriteria).Returns(mockDiscoveryRequest.Object); + (IRequestData requestData, DiscoveryCriteria discoveryCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap, IWarningLogger _) => actualDiscoveryCriteria = discoveryCriteria).Returns(mockDiscoveryRequest.Object); _testRequestManager.DiscoverTests(payload, new Mock().Object, _protocolConfig); @@ -1940,7 +1940,7 @@ public void RunTestsShouldOverrideOnlyAssemblyNameIfConsoleLoggerAlreadyPresentI TestRunCriteria? actualTestRunCriteria = null; var mockTestRunRequest = new Mock(); _mockTestPlatform.Setup(mt => mt.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Callback( - (IRequestData requestData, TestRunCriteria runCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => actualTestRunCriteria = runCriteria).Returns(mockTestRunRequest.Object); + (IRequestData requestData, TestRunCriteria runCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap, IWarningLogger _) => actualTestRunCriteria = runCriteria).Returns(mockTestRunRequest.Object); _testRequestManager.RunTests(payload, new Mock().Object, new Mock().Object, _protocolConfig); var loggerSettingsList = XmlRunSettingsUtilities.GetLoggerRunSettings(actualTestRunCriteria!.TestRunSettings).LoggerSettingsList; @@ -1990,7 +1990,7 @@ public void DiscoverTestsShouldOverrideOnlyAssemblyNameIfConsoleLoggerAlreadyPre _mockTestPlatform .Setup(mt => mt.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())) .Callback( - (IRequestData requestData, DiscoveryCriteria discoveryCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => actualDiscoveryCriteria = discoveryCriteria).Returns(mockDiscoveryRequest.Object); + (IRequestData requestData, DiscoveryCriteria discoveryCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap, IWarningLogger _) => actualDiscoveryCriteria = discoveryCriteria).Returns(mockDiscoveryRequest.Object); _testRequestManager.DiscoverTests(payload, new Mock().Object, _protocolConfig); @@ -2041,7 +2041,7 @@ public void RunTestsShouldOverrideOnlyAssemblyNameIfConsoleLoggerAlreadyPresentI TestRunCriteria? actualTestRunCriteria = null; var mockTestRunRequest = new Mock(); _mockTestPlatform.Setup(mt => mt.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Callback( - (IRequestData requestData, TestRunCriteria runCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => actualTestRunCriteria = runCriteria).Returns(mockTestRunRequest.Object); + (IRequestData requestData, TestRunCriteria runCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap, IWarningLogger _) => actualTestRunCriteria = runCriteria).Returns(mockTestRunRequest.Object); _testRequestManager.RunTests(payload, new Mock().Object, new Mock().Object, _protocolConfig); var loggerSettingsList = XmlRunSettingsUtilities.GetLoggerRunSettings(actualTestRunCriteria!.TestRunSettings).LoggerSettingsList; @@ -2091,7 +2091,7 @@ public void DiscoverTestsShouldOverrideOnlyAssemblyNameIfConsoleLoggerAlreadyPre _mockTestPlatform .Setup(mt => mt.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())) .Callback( - (IRequestData requestData, DiscoveryCriteria discoveryCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => actualDiscoveryCriteria = discoveryCriteria).Returns(mockDiscoveryRequest.Object); + (IRequestData requestData, DiscoveryCriteria discoveryCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap, IWarningLogger _) => actualDiscoveryCriteria = discoveryCriteria).Returns(mockDiscoveryRequest.Object); _testRequestManager.DiscoverTests(payload, new Mock().Object, _protocolConfig); @@ -2228,7 +2228,7 @@ public void StartTestSessionShouldPassCorrectTelemetryOptedInOptionToTestPlatfor It.IsAny>(), It.IsAny())) .Returns(true) .Callback( - (IRequestData rd, StartTestSessionCriteria _, ITestSessionEventsHandler _, Dictionary _) => Assert.IsTrue(rd.IsTelemetryOptedIn)); + (IRequestData rd, StartTestSessionCriteria _, ITestSessionEventsHandler _, Dictionary _, IWarningLogger _) => Assert.IsTrue(rd.IsTelemetryOptedIn)); Environment.SetEnvironmentVariable("VSTEST_TELEMETRY_OPTEDIN", "1"); @@ -2272,10 +2272,11 @@ public void StartTestSessionShouldUpdateSettings() It.IsAny(), It.IsAny(), It.IsAny(), - It.IsAny>(), It.IsAny())) + It.IsAny>(), + It.IsAny())) .Returns(true) .Callback( - (IRequestData _, StartTestSessionCriteria criteria, ITestSessionEventsHandler _, Dictionary _) => + (IRequestData _, StartTestSessionCriteria criteria, ITestSessionEventsHandler _, Dictionary _, IWarningLogger _) => { Assert.IsTrue(criteria.RunSettings.Contains(Constants.DotNetFramework46)); Assert.IsTrue(criteria.RunSettings.Contains(nameof(Architecture.ARM))); @@ -2536,7 +2537,7 @@ private void RunTestsIfThrowsExceptionShouldThrowOut(Exception exception) TestRunCriteria? observedCriteria = null; var mockRunRequest = new Mock(); _mockTestPlatform.Setup(mt => mt.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Callback( - (IRequestData requestData, TestRunCriteria runCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => + (IRequestData requestData, TestRunCriteria runCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap, IWarningLogger _) => { createRunRequestCalled++; observedCriteria = runCriteria; @@ -2561,7 +2562,7 @@ private void DiscoverTestsIfThrowsExceptionShouldThrowOut(Exception exception) DiscoveryCriteria? observedCriteria = null; var mockDiscoveryRequest = new Mock(); _mockTestPlatform.Setup(mt => mt.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Callback( - (IRequestData requestData, DiscoveryCriteria discoveryCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap) => observedCriteria = discoveryCriteria).Returns(mockDiscoveryRequest.Object); + (IRequestData requestData, DiscoveryCriteria discoveryCriteria, TestPlatformOptions options, Dictionary sourceToSourceDetailMap, IWarningLogger _) => observedCriteria = discoveryCriteria).Returns(mockDiscoveryRequest.Object); mockDiscoveryRequest.Setup(mr => mr.DiscoverAsync()).Throws(exception); From 8a9c26d48486b08cdfcf287e232e02da7ef38b29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jare=C5=A1?= Date: Tue, 14 Jun 2022 17:51:21 +0200 Subject: [PATCH 06/12] Fix build --- .../TestPlatform.Playground/Environment.cs | 2 +- playground/TestPlatform.Playground/Program.cs | 9 +++---- .../PublicAPI/PublicAPI.Shipped.txt | 7 +++--- .../PublicAPI/PublicAPI.Shipped.txt | 6 ++--- .../PublicAPI/PublicAPI.Shipped.txt | 6 ++--- .../Client/Events/DiscoveredSource.cs | 24 +++++++++++++++++++ .../Events/DiscoveryCompleteEventArgs.cs | 13 ---------- .../Client/Interfaces/ITestPlatform.cs | 12 ---------- .../Client/Interfaces/IWarningLogger.cs | 19 +++++++++++++++ .../PublicAPI/PublicAPI.Shipped.txt | 22 ++++++++++++----- .../EventRegistrarToWarningLoggerAdapter.cs | 15 +++--------- .../Internal/NullWarningLogger.cs | 14 +++++++++++ .../VsTestConsoleRequestSenderTests.cs | 2 +- 13 files changed, 93 insertions(+), 58 deletions(-) create mode 100644 src/Microsoft.TestPlatform.ObjectModel/Client/Events/DiscoveredSource.cs create mode 100644 src/Microsoft.TestPlatform.ObjectModel/Client/Interfaces/IWarningLogger.cs rename src/{Microsoft.TestPlatform.Client => vstest.console/Internal}/EventRegistrarToWarningLoggerAdapter.cs (57%) create mode 100644 src/vstest.console/Internal/NullWarningLogger.cs diff --git a/playground/TestPlatform.Playground/Environment.cs b/playground/TestPlatform.Playground/Environment.cs index 14cf4a88a4..b6be333c2c 100644 --- a/playground/TestPlatform.Playground/Environment.cs +++ b/playground/TestPlatform.Playground/Environment.cs @@ -11,7 +11,7 @@ internal class EnvironmentVariables { ["VSTEST_CONNECTION_TIMEOUT"] = "999", ["VSTEST_DEBUG_NOBP"] = "1", - ["VSTEST_RUNNER_DEBUG_ATTACHVS"] = "0", + ["VSTEST_RUNNER_DEBUG_ATTACHVS"] = "1", ["VSTEST_HOST_DEBUG_ATTACHVS"] = "0", ["VSTEST_DATACOLLECTOR_DEBUG_ATTACHVS"] = "0", }; diff --git a/playground/TestPlatform.Playground/Program.cs b/playground/TestPlatform.Playground/Program.cs index 1ef9285ea4..b25a84a297 100644 --- a/playground/TestPlatform.Playground/Program.cs +++ b/playground/TestPlatform.Playground/Program.cs @@ -43,13 +43,14 @@ static void Main(string[] args) true 0 +False "; var sources = new[] { - Path.Combine(playground, "MSTest1", "bin", "Debug", "net472", "MSTest1.dll"), - Path.Combine(playground, "MSTest1", "bin", "Debug", "net5.0", "MSTest1.dll"), + @"S:\t\mstest-x64\bin\Debug\net472\Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.dll", + @"S:\t\mstest-x64\bin\Debug\net472\mstest-x64.dll", }; // console mode @@ -60,7 +61,7 @@ static void Main(string[] args) var processStartInfo = new ProcessStartInfo { FileName = console, - Arguments = $"{string.Join(" ", sources)} --settings:{settingsFile} --listtests", + Arguments = $"{string.Join(" ", sources)} --settings:{settingsFile}", UseShellExecute = false, }; EnvironmentVariables.Variables.ToList().ForEach(processStartInfo.Environment.Add); @@ -105,7 +106,7 @@ static void Main(string[] args) //// Run with test cases and without custom testhost launcher //r.RunTests(discoveryHandler.TestCases, sourceSettings, options, sessionHandler.TestSessionInfo, new TestRunHandler()); //// Run with sources and custom testhost launcher - //r.RunTestsWithCustomTestHost(sources, sourceSettings, options, sessionHandler.TestSessionInfo, new TestRunHandler(), new DebuggerTestHostLauncher()); + r.RunTestsWithCustomTestHost(sources, sourceSettings, options, sessionHandler.TestSessionInfo, new TestRunHandler(), new DebuggerTestHostLauncher()); //// Run with sources //r.RunTests(sources, sourceSettings, options, sessionHandler.TestSessionInfo, new TestRunHandler()); var rd = sw.ElapsedMilliseconds; diff --git a/src/Microsoft.TestPlatform.Common/PublicAPI/PublicAPI.Shipped.txt b/src/Microsoft.TestPlatform.Common/PublicAPI/PublicAPI.Shipped.txt index ebcacf71b2..5f6cba85da 100644 --- a/src/Microsoft.TestPlatform.Common/PublicAPI/PublicAPI.Shipped.txt +++ b/src/Microsoft.TestPlatform.Common/PublicAPI/PublicAPI.Shipped.txt @@ -251,9 +251,6 @@ Microsoft.VisualStudio.TestPlatform.ObjectModel.Engine.DiscoveryStatus.Partially Microsoft.VisualStudio.TestPlatform.ObjectModel.Engine.DiscoveryStatus.FullyDiscovered = 2 -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Engine.DiscoveryStatus Microsoft.VisualStudio.TestPlatform.ObjectModel.Engine.IParallelOperationManager Microsoft.VisualStudio.TestPlatform.ObjectModel.Engine.IParallelOperationManager.UpdateParallelLevel(int parallelLevel) -> void -Microsoft.VisualStudio.TestPlatform.ObjectModel.Engine.ITestEngine.GetDiscoveryManager(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IRequestData requestData, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria discoveryCriteria, System.Collections.Generic.IDictionary sourceToSourceDetailMap) -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Engine.IProxyDiscoveryManager -Microsoft.VisualStudio.TestPlatform.ObjectModel.Engine.ITestEngine.GetExecutionManager(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IRequestData requestData, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestRunCriteria testRunCriteria, System.Collections.Generic.IDictionary sourceToSourceDetailMap) -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Engine.IProxyExecutionManager -Microsoft.VisualStudio.TestPlatform.ObjectModel.Engine.ITestEngine.GetTestSessionManager(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IRequestData requestData, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.StartTestSessionCriteria testSessionCriteria, System.Collections.Generic.IDictionary sourceToSourceDetailMap) -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Engine.IProxyTestSessionManager Microsoft.VisualStudio.TestPlatform.ObjectModel.Engine.IProxyExecutionManager.Abort(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IInternalTestRunEventsHandler eventHandler) -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.Engine.IProxyExecutionManager.Cancel(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IInternalTestRunEventsHandler eventHandler) -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.Engine.IProxyExecutionManager.StartTestRun(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestRunCriteria testRunCriteria, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IInternalTestRunEventsHandler eventHandler) -> int @@ -261,3 +258,7 @@ Microsoft.VisualStudio.TestPlatform.ObjectModel.Engine.TesthostProtocol.IExecuti Microsoft.VisualStudio.TestPlatform.ObjectModel.Engine.TesthostProtocol.IExecutionManager.Cancel(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IInternalTestRunEventsHandler testRunEventsHandler) -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.Engine.TesthostProtocol.IExecutionManager.StartTestRun(System.Collections.Generic.Dictionary> adapterSourceMap, string package, string runSettings, Microsoft.VisualStudio.TestPlatform.ObjectModel.Engine.ClientProtocol.TestExecutionContext testExecutionContext, Microsoft.VisualStudio.TestPlatform.ObjectModel.Engine.ITestCaseEventsHandler testCaseEvents, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IInternalTestRunEventsHandler eventHandler) -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.Engine.TesthostProtocol.IExecutionManager.StartTestRun(System.Collections.Generic.IEnumerable tests, string package, string runSettings, Microsoft.VisualStudio.TestPlatform.ObjectModel.Engine.ClientProtocol.TestExecutionContext testExecutionContext, Microsoft.VisualStudio.TestPlatform.ObjectModel.Engine.ITestCaseEventsHandler testCaseEvents, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IInternalTestRunEventsHandler eventHandler) -> void +Microsoft.VisualStudio.TestPlatform.ObjectModel.Engine.DiscoveryStatus.SkippedDiscovery = 3 -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Engine.DiscoveryStatus +Microsoft.VisualStudio.TestPlatform.ObjectModel.Engine.ITestEngine.GetDiscoveryManager(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IRequestData requestData, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria discoveryCriteria, System.Collections.Generic.IDictionary sourceToSourceDetailMap, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IWarningLogger warningLogger) -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Engine.IProxyDiscoveryManager +Microsoft.VisualStudio.TestPlatform.ObjectModel.Engine.ITestEngine.GetExecutionManager(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IRequestData requestData, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestRunCriteria testRunCriteria, System.Collections.Generic.IDictionary sourceToSourceDetailMap, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IWarningLogger warningLogger) -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Engine.IProxyExecutionManager +Microsoft.VisualStudio.TestPlatform.ObjectModel.Engine.ITestEngine.GetTestSessionManager(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IRequestData requestData, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.StartTestSessionCriteria testSessionCriteria, System.Collections.Generic.IDictionary sourceToSourceDetailMap, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IWarningLogger warningLogger) -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Engine.IProxyTestSessionManager diff --git a/src/Microsoft.TestPlatform.CommunicationUtilities/PublicAPI/PublicAPI.Shipped.txt b/src/Microsoft.TestPlatform.CommunicationUtilities/PublicAPI/PublicAPI.Shipped.txt index d6981453d1..1aa45bb7e0 100644 --- a/src/Microsoft.TestPlatform.CommunicationUtilities/PublicAPI/PublicAPI.Shipped.txt +++ b/src/Microsoft.TestPlatform.CommunicationUtilities/PublicAPI/PublicAPI.Shipped.txt @@ -372,11 +372,8 @@ static Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.Resources.Reso static Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.Resources.Resources.VersionCheckFailed.get -> string static Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.Resources.Resources.VersionCheckTimedout.get -> string Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.Interfaces.ITestRequestSender.SendDiscoveryAbort() -> void -Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.ObjectModel.DiscoveryCompletePayload.FullyDiscoveredSources.get -> System.Collections.Generic.IList Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.ObjectModel.DiscoveryCompletePayload.FullyDiscoveredSources.set -> void -Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.ObjectModel.DiscoveryCompletePayload.NotDiscoveredSources.get -> System.Collections.Generic.IList Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.ObjectModel.DiscoveryCompletePayload.NotDiscoveredSources.set -> void -Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.ObjectModel.DiscoveryCompletePayload.PartiallyDiscoveredSources.get -> System.Collections.Generic.IList Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.ObjectModel.DiscoveryCompletePayload.PartiallyDiscoveredSources.set -> void Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.TestRequestSender.SendDiscoveryAbort() -> void Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.ObjectModel.DiscoveryCompletePayload.DiscoveredExtensions.get -> System.Collections.Generic.Dictionary> @@ -389,3 +386,6 @@ Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.Interfaces.ITestReque Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.Interfaces.ITestRequestSender.StartTestRun(Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.ObjectModel.TestRunCriteriaWithTests runCriteria, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IInternalTestRunEventsHandler eventHandler) -> void Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.TestRequestSender.StartTestRun(Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.ObjectModel.TestRunCriteriaWithSources runCriteria, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IInternalTestRunEventsHandler eventHandler) -> void Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.TestRequestSender.StartTestRun(Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.ObjectModel.TestRunCriteriaWithTests runCriteria, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IInternalTestRunEventsHandler eventHandler) -> void +Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.ObjectModel.DiscoveryCompletePayload.FullyDiscoveredSources.get -> System.Collections.Generic.IList +Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.ObjectModel.DiscoveryCompletePayload.NotDiscoveredSources.get -> System.Collections.Generic.IList +Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.ObjectModel.DiscoveryCompletePayload.PartiallyDiscoveredSources.get -> System.Collections.Generic.IList diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/PublicAPI/PublicAPI.Shipped.txt b/src/Microsoft.TestPlatform.CrossPlatEngine/PublicAPI/PublicAPI.Shipped.txt index 5a2dcd7df6..93ca9f3443 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/PublicAPI/PublicAPI.Shipped.txt +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/PublicAPI/PublicAPI.Shipped.txt @@ -124,9 +124,6 @@ Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.TestRuntimeProviderIn Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.TestRuntimeProviderInfo.SourceDetails.get -> System.Collections.Generic.List Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.TestRuntimeProviderInfo.TestRuntimeProviderInfo(System.Type type, bool shared, string runSettings, System.Collections.Generic.List sourceDetails) -> void Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.TestRuntimeProviderInfo.Type.get -> System.Type -Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.TestEngine.GetDiscoveryManager(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IRequestData requestData, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria discoveryCriteria, System.Collections.Generic.IDictionary sourceToSourceDetailMap) -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Engine.IProxyDiscoveryManager -Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.TestEngine.GetExecutionManager(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IRequestData requestData, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestRunCriteria testRunCriteria, System.Collections.Generic.IDictionary sourceToSourceDetailMap) -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Engine.IProxyExecutionManager -Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.TestEngine.GetTestSessionManager(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IRequestData requestData, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.StartTestSessionCriteria testSessionCriteria, System.Collections.Generic.IDictionary sourceToSourceDetailMap) -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Engine.IProxyTestSessionManager Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.ProxyTestSessionManager.ProxyTestSessionManager(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.StartTestSessionCriteria criteria, int maxTesthostCount, System.Func proxyCreator, System.Collections.Generic.List runtimeProviders) -> void Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.TestRequestHandler.AttachDebuggerToProcess(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.Interfaces.AttachDebuggerInfo attachDebuggerInfo) -> bool Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.ProxyOperationManager.ProxyOperationManager(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IRequestData requestData, Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.Interfaces.ITestRequestSender requestSender, Microsoft.VisualStudio.TestPlatform.ObjectModel.Host.ITestRuntimeProvider testHostManager, Microsoft.VisualStudio.TestPlatform.ObjectModel.Framework testhostManagerFramework) -> void @@ -137,3 +134,6 @@ Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Execution.ExecutionManager.A Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Execution.ExecutionManager.Cancel(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IInternalTestRunEventsHandler testRunEventsHandler) -> void Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Execution.ExecutionManager.StartTestRun(System.Collections.Generic.Dictionary> adapterSourceMap, string package, string runSettings, Microsoft.VisualStudio.TestPlatform.ObjectModel.Engine.ClientProtocol.TestExecutionContext testExecutionContext, Microsoft.VisualStudio.TestPlatform.ObjectModel.Engine.ITestCaseEventsHandler testCaseEventsHandler, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IInternalTestRunEventsHandler runEventsHandler) -> void Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Execution.ExecutionManager.StartTestRun(System.Collections.Generic.IEnumerable tests, string package, string runSettings, Microsoft.VisualStudio.TestPlatform.ObjectModel.Engine.ClientProtocol.TestExecutionContext testExecutionContext, Microsoft.VisualStudio.TestPlatform.ObjectModel.Engine.ITestCaseEventsHandler testCaseEventsHandler, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IInternalTestRunEventsHandler runEventsHandler) -> void +Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.TestEngine.GetDiscoveryManager(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IRequestData requestData, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria discoveryCriteria, System.Collections.Generic.IDictionary sourceToSourceDetailMap, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IWarningLogger warningLogger) -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Engine.IProxyDiscoveryManager +Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.TestEngine.GetExecutionManager(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IRequestData requestData, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestRunCriteria testRunCriteria, System.Collections.Generic.IDictionary sourceToSourceDetailMap, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IWarningLogger warningLogger) -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Engine.IProxyExecutionManager +Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.TestEngine.GetTestSessionManager(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IRequestData requestData, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.StartTestSessionCriteria testSessionCriteria, System.Collections.Generic.IDictionary sourceToSourceDetailMap, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IWarningLogger warningLogger) -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Engine.IProxyTestSessionManager diff --git a/src/Microsoft.TestPlatform.ObjectModel/Client/Events/DiscoveredSource.cs b/src/Microsoft.TestPlatform.ObjectModel/Client/Events/DiscoveredSource.cs new file mode 100644 index 0000000000..86bbc67581 --- /dev/null +++ b/src/Microsoft.TestPlatform.ObjectModel/Client/Events/DiscoveredSource.cs @@ -0,0 +1,24 @@ +// 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.Collections.Generic; +using System.Linq; +using System.Runtime.Serialization; + +#nullable disable + +namespace Microsoft.VisualStudio.TestPlatform.ObjectModel.Client; + +/// +/// Describes a source file that was discovered, or that was requested to be discovered. +/// +public class DiscoveredSource +{ + [DataMember] + public string Source { get; set; } + + public static List ToDiscoveredSources(List sources) + { + return sources.Select(source => new DiscoveredSource { Source = source }).ToList(); + } +} diff --git a/src/Microsoft.TestPlatform.ObjectModel/Client/Events/DiscoveryCompleteEventArgs.cs b/src/Microsoft.TestPlatform.ObjectModel/Client/Events/DiscoveryCompleteEventArgs.cs index 9d7d667afc..0879c0217b 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Client/Events/DiscoveryCompleteEventArgs.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/Client/Events/DiscoveryCompleteEventArgs.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; -using System.Linq; using System.Runtime.Serialization; #nullable disable @@ -77,15 +76,3 @@ public DiscoveryCompleteEventArgs(long totalTests, bool isAborted) [DataMember] public Dictionary> DiscoveredExtensions { get; set; } = new(); } - - -public class DiscoveredSource -{ - [DataMember] - public string Source { get; set; } - - public static List ToDiscoveredSources(List sources) - { - return sources.Select(source => new DiscoveredSource { Source = source }).ToList(); - } -} diff --git a/src/Microsoft.TestPlatform.ObjectModel/Client/Interfaces/ITestPlatform.cs b/src/Microsoft.TestPlatform.ObjectModel/Client/Interfaces/ITestPlatform.cs index 479be9f086..26d1074f71 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Client/Interfaces/ITestPlatform.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/Client/Interfaces/ITestPlatform.cs @@ -83,15 +83,3 @@ bool StartTestSession( Dictionary sourceToSourceDetailMap, IWarningLogger warningLogger); } - -/// -/// DO NOT use this to extend TestPlatform, it is public only because some other internal interfaces and classes are public, and will be made internal later. -/// -public interface IWarningLogger -{ - /// - /// Log warning message that will be shown to user. - /// - /// message string - void LogWarning(string message); -} diff --git a/src/Microsoft.TestPlatform.ObjectModel/Client/Interfaces/IWarningLogger.cs b/src/Microsoft.TestPlatform.ObjectModel/Client/Interfaces/IWarningLogger.cs new file mode 100644 index 0000000000..3d502dd3cc --- /dev/null +++ b/src/Microsoft.TestPlatform.ObjectModel/Client/Interfaces/IWarningLogger.cs @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + +#nullable disable + +namespace Microsoft.VisualStudio.TestPlatform.ObjectModel.Client; + +/// +/// DO NOT use this to extend TestPlatform, it is public only because ITestPlatform is also public, and will be made internal later. +/// +public interface IWarningLogger +{ + /// + /// Log warning message that will be shown to user. + /// + /// message string + void LogWarning(string message); +} diff --git a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/PublicAPI.Shipped.txt b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/PublicAPI.Shipped.txt index 92f9d455b4..dd7d33f903 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/PublicAPI.Shipped.txt +++ b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/PublicAPI.Shipped.txt @@ -228,8 +228,6 @@ Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestMessageEventHandler. Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestMessageEventHandler.HandleRawMessage(string rawMessage) -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform.ClearExtensions() -> void -Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform.CreateDiscoveryRequest(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IRequestData requestData, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria discoveryCriteria, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestPlatformOptions options, System.Collections.Generic.Dictionary sourceToSourceDetailMap) -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IDiscoveryRequest -Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform.CreateTestRunRequest(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IRequestData requestData, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestRunCriteria testRunCriteria, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestPlatformOptions options, System.Collections.Generic.Dictionary sourceToSourceDetailMap) -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestRunRequest Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform.UpdateExtensions(System.Collections.Generic.IEnumerable pathToAdditionalExtensions, bool skipExtensionFilters) -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatformCapabilities Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatformCapabilities.TestPlatformType.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestPlatformType @@ -882,18 +880,14 @@ override Microsoft.VisualStudio.TestPlatform.ObjectModel.InvokedDataCollector.Eq override Microsoft.VisualStudio.TestPlatform.ObjectModel.InvokedDataCollector.GetHashCode() -> int override Microsoft.VisualStudio.TestPlatform.ObjectModel.InvokedDataCollector.ToString() -> string const Microsoft.VisualStudio.TestPlatform.ObjectModel.Constants.MinimumProtocolVersionWithCancelDiscoveryEventHandlerSupport = 6 -> int -Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCompleteEventArgs.FullyDiscoveredSources.get -> System.Collections.Generic.IList Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCompleteEventArgs.FullyDiscoveredSources.set -> void -Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCompleteEventArgs.NotDiscoveredSources.get -> System.Collections.Generic.IList Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCompleteEventArgs.NotDiscoveredSources.set -> void -Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCompleteEventArgs.PartiallyDiscoveredSources.get -> System.Collections.Generic.IList Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCompleteEventArgs.PartiallyDiscoveredSources.set -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.DiscoveryCriteria(System.Collections.Generic.IEnumerable sources, long frequencyOfDiscoveredTestsEvent, System.TimeSpan discoveredTestEventTimeout, string runSettings, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo testSessionInfo) -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.TestSessionInfo.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.TestSessionInfo.set -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryRequestPayload.TestSessionInfo.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryRequestPayload.TestSessionInfo.set -> void -Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform.StartTestSession(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IRequestData requestData, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.StartTestSessionCriteria criteria, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestSessionEventsHandler eventsHandler, System.Collections.Generic.Dictionary sourceToSourceDetailMap) -> bool Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestSessionEventsHandler.HandleStartTestSessionComplete(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.StartTestSessionCompleteEventArgs eventArgs) -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestSessionEventsHandler.HandleStopTestSessionComplete(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.StopTestSessionCompleteEventArgs eventArgs) -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.Payloads.StartTestSessionAckPayload.EventArgs.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.StartTestSessionCompleteEventArgs @@ -954,3 +948,19 @@ Microsoft.VisualStudio.TestPlatform.ObjectModel.EditorAttachDebuggerPayload.Targ Microsoft.VisualStudio.TestPlatform.ObjectModel.EditorAttachDebuggerPayload.TargetFramework.set -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.TestProcessAttachDebuggerPayload.TargetFramework.get -> string Microsoft.VisualStudio.TestPlatform.ObjectModel.TestProcessAttachDebuggerPayload.TargetFramework.set -> void +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveredSource +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveredSource.DiscoveredSource() -> void +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveredSource.Source.get -> string +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveredSource.Source.set -> void +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCompleteEventArgs.FullyDiscoveredSources.get -> System.Collections.Generic.IList +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCompleteEventArgs.NotDiscoveredSources.get -> System.Collections.Generic.IList +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCompleteEventArgs.PartiallyDiscoveredSources.get -> System.Collections.Generic.IList +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCompleteEventArgs.SkippedDiscoveredSources.get -> System.Collections.Generic.IList +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCompleteEventArgs.SkippedDiscoveredSources.set -> void +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform.CreateDiscoveryRequest(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IRequestData requestData, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria discoveryCriteria, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestPlatformOptions options, System.Collections.Generic.Dictionary sourceToSourceDetailMap, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IWarningLogger warningLogger) -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IDiscoveryRequest +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform.CreateTestRunRequest(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IRequestData requestData, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestRunCriteria testRunCriteria, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestPlatformOptions options, System.Collections.Generic.Dictionary sourceToSourceDetailMap, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IWarningLogger warningLogger) -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestRunRequest +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform.StartTestSession(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IRequestData requestData, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.StartTestSessionCriteria criteria, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestSessionEventsHandler eventsHandler, System.Collections.Generic.Dictionary sourceToSourceDetailMap, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IWarningLogger warningLogger) -> bool +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IWarningLogger +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IWarningLogger.LogWarning(string message) -> void +Microsoft.VisualStudio.TestPlatform.ObjectModel.SourceDetail.FallbackArchitecture.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Architecture +static Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveredSource.ToDiscoveredSources(System.Collections.Generic.List sources) -> System.Collections.Generic.List diff --git a/src/Microsoft.TestPlatform.Client/EventRegistrarToWarningLoggerAdapter.cs b/src/vstest.console/Internal/EventRegistrarToWarningLoggerAdapter.cs similarity index 57% rename from src/Microsoft.TestPlatform.Client/EventRegistrarToWarningLoggerAdapter.cs rename to src/vstest.console/Internal/EventRegistrarToWarningLoggerAdapter.cs index ceeffeae27..9f5e31b2e2 100644 --- a/src/Microsoft.TestPlatform.Client/EventRegistrarToWarningLoggerAdapter.cs +++ b/src/vstest.console/Internal/EventRegistrarToWarningLoggerAdapter.cs @@ -4,28 +4,19 @@ using Microsoft.VisualStudio.TestPlatform.Common.Interfaces; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client; -namespace Microsoft.VisualStudio.TestPlatform.Client; +namespace Microsoft.VisualStudio.TestPlatform.CommandLine.Internal; -public class EventRegistrarToWarningLoggerAdapter : IWarningLogger +internal class EventRegistrarToWarningLoggerAdapter : IWarningLogger { private readonly IBaseTestEventsRegistrar _testEventsRegistrar; - public EventRegistrarToWarningLoggerAdapter(IBaseTestEventsRegistrar? testEventsRegistrar) + public EventRegistrarToWarningLoggerAdapter(IBaseTestEventsRegistrar testEventsRegistrar) { _testEventsRegistrar = testEventsRegistrar; } public void LogWarning(string message) { - //TODO: Implement registrar in StartTestSession instead of passing null. _testEventsRegistrar.LogWarning(message); } } - -public class NullWarningLogger : IWarningLogger -{ - public void LogWarning(string message) - { - //TODO: Implement registrar in StartTestSession instead of passing null, and stop using this class. - } -} diff --git a/src/vstest.console/Internal/NullWarningLogger.cs b/src/vstest.console/Internal/NullWarningLogger.cs new file mode 100644 index 0000000000..916eab1579 --- /dev/null +++ b/src/vstest.console/Internal/NullWarningLogger.cs @@ -0,0 +1,14 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client; + +namespace Microsoft.VisualStudio.TestPlatform.CommandLine.Internal; + +internal class NullWarningLogger : IWarningLogger +{ + public void LogWarning(string message) + { + //TODO: Implement registrar in StartTestSession instead of passing null, and stop using this class. + } +} diff --git a/test/TranslationLayer.UnitTests/VsTestConsoleRequestSenderTests.cs b/test/TranslationLayer.UnitTests/VsTestConsoleRequestSenderTests.cs index f27943ec57..223e566b47 100644 --- a/test/TranslationLayer.UnitTests/VsTestConsoleRequestSenderTests.cs +++ b/test/TranslationLayer.UnitTests/VsTestConsoleRequestSenderTests.cs @@ -434,7 +434,7 @@ public void DiscoverTestsShouldCompleteWithSingleFullyDiscoveredSource() var mockHandler = new Mock(); - List sources = new() { "1.dll" }; + List sources = new() { "1.dll" }; var testCase = new TestCase("hello", new Uri("world://how"), source: sources[0]); var testsFound = new Message() From 584c8005638d1d2a0815303d867b0a63f7186f7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jare=C5=A1?= Date: Wed, 15 Jun 2022 11:24:37 +0200 Subject: [PATCH 07/12] Review fixes --- .../Parallel/ParallelDiscoveryEventsHandler.cs | 9 ++++----- .../Discovery/DiscoveryManager.cs | 13 +++++++------ .../Utilities/DiscoveredSourceHelper.cs | 17 +++++++++++++++++ .../Client/Events/DiscoveredSource.cs | 11 +---------- .../Client/Events/DiscoveryCompleteEventArgs.cs | 8 ++++---- .../Client/Interfaces/IWarningLogger.cs | 3 --- .../PublicAPI/PublicAPI.Shipped.txt | 2 -- .../SourceDetail.cs | 1 - 8 files changed, 33 insertions(+), 31 deletions(-) create mode 100644 src/Microsoft.TestPlatform.CrossPlatEngine/Utilities/DiscoveredSourceHelper.cs diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/ParallelDiscoveryEventsHandler.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/ParallelDiscoveryEventsHandler.cs index 0ff75ec9e7..882fee1edb 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/ParallelDiscoveryEventsHandler.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/ParallelDiscoveryEventsHandler.cs @@ -1,14 +1,13 @@ // 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; using System.Collections.Generic; -using System.Linq; using Microsoft.VisualStudio.TestPlatform.Common.Telemetry; using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities; using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.Interfaces; using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.ObjectModel; +using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Utilities; using Microsoft.VisualStudio.TestPlatform.ObjectModel; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Engine; @@ -88,9 +87,9 @@ public void HandleDiscoveryComplete(DiscoveryCompleteEventArgs discoveryComplete // Manager said we are ready to publish the test discovery completed and we haven't yet // published it. - var fullyDiscovered = DiscoveredSource.ToDiscoveredSources(_discoveryDataAggregator.GetSourcesWithStatus(DiscoveryStatus.FullyDiscovered)); - var partiallyDiscovered = DiscoveredSource.ToDiscoveredSources(_discoveryDataAggregator.GetSourcesWithStatus(DiscoveryStatus.PartiallyDiscovered)); - var notDiscovered = DiscoveredSource.ToDiscoveredSources(_discoveryDataAggregator.GetSourcesWithStatus(DiscoveryStatus.NotDiscovered)); + var fullyDiscovered = DiscoveredSourceHelper.ToDiscoveredSources(_discoveryDataAggregator.GetSourcesWithStatus(DiscoveryStatus.FullyDiscovered)); + var partiallyDiscovered = DiscoveredSourceHelper.ToDiscoveredSources(_discoveryDataAggregator.GetSourcesWithStatus(DiscoveryStatus.PartiallyDiscovered)); + var notDiscovered = DiscoveredSourceHelper.ToDiscoveredSources(_discoveryDataAggregator.GetSourcesWithStatus(DiscoveryStatus.NotDiscovered)); // As we immediately return results to IDE in case of aborting we need to set // isAborted = true and totalTests = -1 diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Discovery/DiscoveryManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Discovery/DiscoveryManager.cs index 030c18866f..742d8c46de 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Discovery/DiscoveryManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Discovery/DiscoveryManager.cs @@ -16,6 +16,7 @@ using Microsoft.VisualStudio.TestPlatform.CoreUtilities.Tracing; using Microsoft.VisualStudio.TestPlatform.CoreUtilities.Tracing.Interfaces; using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.Parallel; +using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Utilities; using Microsoft.VisualStudio.TestPlatform.ObjectModel; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Engine; @@ -172,9 +173,9 @@ public void DiscoverTests(DiscoveryCriteria discoveryCriteria, ITestDiscoveryEve var discoveryCompleteEventsArgs = new DiscoveryCompleteEventArgs(isAborted ? -1 : totalDiscoveredTestCount, isAborted) { - FullyDiscoveredSources = DiscoveredSource.ToDiscoveredSources(_discoveryDataAggregator.GetSourcesWithStatus(DiscoveryStatus.FullyDiscovered)), - PartiallyDiscoveredSources = DiscoveredSource.ToDiscoveredSources(_discoveryDataAggregator.GetSourcesWithStatus(DiscoveryStatus.PartiallyDiscovered)), - NotDiscoveredSources = DiscoveredSource.ToDiscoveredSources(_discoveryDataAggregator.GetSourcesWithStatus(DiscoveryStatus.NotDiscovered)), + FullyDiscoveredSources = DiscoveredSourceHelper.ToDiscoveredSources(_discoveryDataAggregator.GetSourcesWithStatus(DiscoveryStatus.FullyDiscovered)), + PartiallyDiscoveredSources = DiscoveredSourceHelper.ToDiscoveredSources(_discoveryDataAggregator.GetSourcesWithStatus(DiscoveryStatus.PartiallyDiscovered)), + NotDiscoveredSources = DiscoveredSourceHelper.ToDiscoveredSources(_discoveryDataAggregator.GetSourcesWithStatus(DiscoveryStatus.NotDiscovered)), DiscoveredExtensions = TestPluginCache.Instance.TestExtensions?.GetCachedExtensions(), Metrics = _requestData.MetricsCollection.Metrics, }; @@ -211,9 +212,9 @@ public void Abort(ITestDiscoveryEventsHandler2 eventHandler) var discoveryCompleteEventArgs = new DiscoveryCompleteEventArgs(-1, true) { - FullyDiscoveredSources = DiscoveredSource.ToDiscoveredSources(_discoveryDataAggregator.GetSourcesWithStatus(DiscoveryStatus.FullyDiscovered)), - PartiallyDiscoveredSources = DiscoveredSource.ToDiscoveredSources(_discoveryDataAggregator.GetSourcesWithStatus(DiscoveryStatus.PartiallyDiscovered)), - NotDiscoveredSources = DiscoveredSource.ToDiscoveredSources(_discoveryDataAggregator.GetSourcesWithStatus(DiscoveryStatus.NotDiscovered)), + FullyDiscoveredSources = DiscoveredSourceHelper.ToDiscoveredSources(_discoveryDataAggregator.GetSourcesWithStatus(DiscoveryStatus.FullyDiscovered)), + PartiallyDiscoveredSources = DiscoveredSourceHelper.ToDiscoveredSources(_discoveryDataAggregator.GetSourcesWithStatus(DiscoveryStatus.PartiallyDiscovered)), + NotDiscoveredSources = DiscoveredSourceHelper.ToDiscoveredSources(_discoveryDataAggregator.GetSourcesWithStatus(DiscoveryStatus.NotDiscovered)), }; eventHandler.HandleDiscoveryComplete(discoveryCompleteEventArgs, null); } diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Utilities/DiscoveredSourceHelper.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Utilities/DiscoveredSourceHelper.cs new file mode 100644 index 0000000000..a9e245f45a --- /dev/null +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Utilities/DiscoveredSourceHelper.cs @@ -0,0 +1,17 @@ +// 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.Collections.Generic; +using System.Linq; + +using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client; + +namespace Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Utilities; + +internal class DiscoveredSourceHelper +{ + public static List ToDiscoveredSources(List sources) + { + return sources.Select(source => new DiscoveredSource { Source = source }).ToList(); + } +} diff --git a/src/Microsoft.TestPlatform.ObjectModel/Client/Events/DiscoveredSource.cs b/src/Microsoft.TestPlatform.ObjectModel/Client/Events/DiscoveredSource.cs index 86bbc67581..c346c5f891 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Client/Events/DiscoveredSource.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/Client/Events/DiscoveredSource.cs @@ -1,12 +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.Collections.Generic; -using System.Linq; using System.Runtime.Serialization; -#nullable disable - namespace Microsoft.VisualStudio.TestPlatform.ObjectModel.Client; /// @@ -15,10 +11,5 @@ namespace Microsoft.VisualStudio.TestPlatform.ObjectModel.Client; public class DiscoveredSource { [DataMember] - public string Source { get; set; } - - public static List ToDiscoveredSources(List sources) - { - return sources.Select(source => new DiscoveredSource { Source = source }).ToList(); - } + public string? Source { get; set; } } diff --git a/src/Microsoft.TestPlatform.ObjectModel/Client/Events/DiscoveryCompleteEventArgs.cs b/src/Microsoft.TestPlatform.ObjectModel/Client/Events/DiscoveryCompleteEventArgs.cs index 0879c0217b..e96c20c00a 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Client/Events/DiscoveryCompleteEventArgs.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/Client/Events/DiscoveryCompleteEventArgs.cs @@ -47,25 +47,25 @@ public DiscoveryCompleteEventArgs(long totalTests, bool isAborted) public IDictionary Metrics { get; set; } /// - /// Gets the list of sources which were fully discovered. + /// Gets or sets the list of sources which were fully discovered. /// [DataMember] public IList FullyDiscoveredSources { get; set; } = new List(); /// - /// Gets the list of sources which were partially discovered (started discover tests, but then discovery aborted). + /// Gets or sets the list of sources which were partially discovered (started discover tests, but then discovery aborted). /// [DataMember] public IList PartiallyDiscoveredSources { get; set; } = new List(); /// - /// Gets a list of sources that were skipped during discovery. + /// Gets or sets the list of sources that were skipped during discovery. /// [DataMember] public IList SkippedDiscoveredSources { get; set; } = new List(); /// - /// Gets the list of sources which were not discovered at all. + /// Gets or sets the list of sources which were not discovered at all. /// [DataMember] public IList NotDiscoveredSources { get; set; } = new List(); diff --git a/src/Microsoft.TestPlatform.ObjectModel/Client/Interfaces/IWarningLogger.cs b/src/Microsoft.TestPlatform.ObjectModel/Client/Interfaces/IWarningLogger.cs index 3d502dd3cc..ded7ceaf39 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Client/Interfaces/IWarningLogger.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/Client/Interfaces/IWarningLogger.cs @@ -1,9 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. - -#nullable disable - namespace Microsoft.VisualStudio.TestPlatform.ObjectModel.Client; /// diff --git a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/PublicAPI.Shipped.txt b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/PublicAPI.Shipped.txt index dd7d33f903..9a707e2b8b 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/PublicAPI.Shipped.txt +++ b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/PublicAPI.Shipped.txt @@ -962,5 +962,3 @@ Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform.CreateTestR Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform.StartTestSession(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IRequestData requestData, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.StartTestSessionCriteria criteria, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestSessionEventsHandler eventsHandler, System.Collections.Generic.Dictionary sourceToSourceDetailMap, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IWarningLogger warningLogger) -> bool Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IWarningLogger Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IWarningLogger.LogWarning(string message) -> void -Microsoft.VisualStudio.TestPlatform.ObjectModel.SourceDetail.FallbackArchitecture.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Architecture -static Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveredSource.ToDiscoveredSources(System.Collections.Generic.List sources) -> System.Collections.Generic.List diff --git a/src/Microsoft.TestPlatform.ObjectModel/SourceDetail.cs b/src/Microsoft.TestPlatform.ObjectModel/SourceDetail.cs index e8090faba4..4270aa9518 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/SourceDetail.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/SourceDetail.cs @@ -9,6 +9,5 @@ public class SourceDetail { public string Source { get; internal set; } public Architecture Architecture { get; internal set; } - public Architecture FallbackArchitecture { get; internal set; } public Framework Framework { get; internal set; } } From 875344995f0ba06d34b9094b243d22d4af5a203d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jare=C5=A1?= Date: Wed, 15 Jun 2022 12:43:38 +0200 Subject: [PATCH 08/12] Fix sharing --- playground/TestPlatform.Playground/Program.cs | 56 +++++++++---------- .../TestEngine.cs | 7 ++- 2 files changed, 32 insertions(+), 31 deletions(-) diff --git a/playground/TestPlatform.Playground/Program.cs b/playground/TestPlatform.Playground/Program.cs index b25a84a297..3a14cdd6e9 100644 --- a/playground/TestPlatform.Playground/Program.cs +++ b/playground/TestPlatform.Playground/Program.cs @@ -42,40 +42,40 @@ static void Main(string[] args) true - 0 + 1 False "; var sources = new[] { - @"S:\t\mstest-x64\bin\Debug\net472\Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.dll", - @"S:\t\mstest-x64\bin\Debug\net472\mstest-x64.dll", + @"S:\p\vstest\test\TestAssets\SimpleTestProject\bin\Debug\net451\SimpleTestProject.dll", + @"S:\p\vstest\test\TestAssets\SimpleTestProject2\bin\Debug\net451\SimpleTestProject2.dll" }; - // console mode - var settingsFile = Path.GetTempFileName(); - try - { - File.WriteAllText(settingsFile, sourceSettings); - var processStartInfo = new ProcessStartInfo - { - FileName = console, - Arguments = $"{string.Join(" ", sources)} --settings:{settingsFile}", - UseShellExecute = false, - }; - EnvironmentVariables.Variables.ToList().ForEach(processStartInfo.Environment.Add); - var process = Process.Start(processStartInfo); - process.WaitForExit(); - if (process.ExitCode != 0) - { - throw new Exception($"Process failed with {process.ExitCode}"); - } - } - finally - { - try { File.Delete(settingsFile); } catch { } - } + //// console mode + //var settingsFile = Path.GetTempFileName(); + //try + //{ + // File.WriteAllText(settingsFile, sourceSettings); + // var processStartInfo = new ProcessStartInfo + // { + // FileName = console, + // Arguments = $"{string.Join(" ", sources)} --settings:{settingsFile}", + // UseShellExecute = false, + // }; + // EnvironmentVariables.Variables.ToList().ForEach(processStartInfo.Environment.Add); + // var process = Process.Start(processStartInfo); + // process.WaitForExit(); + // if (process.ExitCode != 0) + // { + // throw new Exception($"Process failed with {process.ExitCode}"); + // } + //} + //finally + //{ + // try { File.Delete(settingsFile); } catch { } + //} // design mode var consoleOptions = new ConsoleParameters @@ -97,12 +97,12 @@ static void Main(string[] args) var discoveryHandler = new PlaygroundTestDiscoveryHandler(); var sw = Stopwatch.StartNew(); // Discovery - r.DiscoverTests(sources, sourceSettings, options, sessionHandler.TestSessionInfo, discoveryHandler); + r.DiscoverTests(sources, sourceSettings, options, sessionHandler.TestSessionInfo, discoveryHandler); var discoveryDuration = sw.ElapsedMilliseconds; Console.WriteLine($"Discovery done in {discoveryDuration} ms"); sw.Restart(); // Run with test cases and custom testhost launcher - r.RunTestsWithCustomTestHost(discoveryHandler.TestCases, sourceSettings, options, sessionHandler.TestSessionInfo, new TestRunHandler(), new DebuggerTestHostLauncher()); + //r.RunTestsWithCustomTestHost(discoveryHandler.TestCases, sourceSettings, options, sessionHandler.TestSessionInfo, new TestRunHandler(), new DebuggerTestHostLauncher()); //// Run with test cases and without custom testhost launcher //r.RunTests(discoveryHandler.TestCases, sourceSettings, options, sessionHandler.TestSessionInfo, new TestRunHandler()); //// Run with sources and custom testhost launcher diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/TestEngine.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/TestEngine.cs index cfe69b2217..8113e9a138 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/TestEngine.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/TestEngine.cs @@ -446,12 +446,13 @@ private List GetTestRuntimeProvidersForUniqueConfigurat if (testRuntimeProvider != null) { - testRuntimeProviders.Add(new TestRuntimeProviderInfo(testRuntimeProvider.GetType(), testRuntimeProvider.Shared, - runsettingsXml, sourceDetails: runConfiguration.ToList())); - // Initialize here, because Shared is picked up from the instance, and it can be set during initalization. testRuntimeProvider.Initialize(TestSessionMessageLogger.Instance, runsettingsXml); + // DO NOT move this above Initialize, the intialization can set Shared, to true, and we would not capture that. + testRuntimeProviders.Add(new TestRuntimeProviderInfo(testRuntimeProvider.GetType(), testRuntimeProvider.Shared, + runsettingsXml, sourceDetails: runConfiguration.ToList())); + // Outputting the instance, because the code for in-process run uses it, and we don't want to resolve it one more time. mostRecentlyCreatedInstance = testRuntimeProvider; } From 4a8be996eef5a35a353cc083f677395ac2b30aa9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jare=C5=A1?= Date: Wed, 15 Jun 2022 12:49:41 +0200 Subject: [PATCH 09/12] Fix --- .../TestPlatform.Playground/Environment.cs | 2 +- playground/TestPlatform.Playground/Program.cs | 61 +++++++++---------- .../Utilities/DiscoveredSourceHelper.cs | 4 +- .../EventHandler/DiscoveryEventHandler.cs | 17 +++--- 4 files changed, 41 insertions(+), 43 deletions(-) diff --git a/playground/TestPlatform.Playground/Environment.cs b/playground/TestPlatform.Playground/Environment.cs index b6be333c2c..14cf4a88a4 100644 --- a/playground/TestPlatform.Playground/Environment.cs +++ b/playground/TestPlatform.Playground/Environment.cs @@ -11,7 +11,7 @@ internal class EnvironmentVariables { ["VSTEST_CONNECTION_TIMEOUT"] = "999", ["VSTEST_DEBUG_NOBP"] = "1", - ["VSTEST_RUNNER_DEBUG_ATTACHVS"] = "1", + ["VSTEST_RUNNER_DEBUG_ATTACHVS"] = "0", ["VSTEST_HOST_DEBUG_ATTACHVS"] = "0", ["VSTEST_DATACOLLECTOR_DEBUG_ATTACHVS"] = "0", }; diff --git a/playground/TestPlatform.Playground/Program.cs b/playground/TestPlatform.Playground/Program.cs index 3a14cdd6e9..db6c7dec4f 100644 --- a/playground/TestPlatform.Playground/Program.cs +++ b/playground/TestPlatform.Playground/Program.cs @@ -42,40 +42,39 @@ static void Main(string[] args) true - 1 -False + 0 "; var sources = new[] { - @"S:\p\vstest\test\TestAssets\SimpleTestProject\bin\Debug\net451\SimpleTestProject.dll", - @"S:\p\vstest\test\TestAssets\SimpleTestProject2\bin\Debug\net451\SimpleTestProject2.dll" + Path.Combine(playground, "MSTest1", "bin", "Debug", "net472", "MSTest1.dll"), + Path.Combine(playground, "MSTest1", "bin", "Debug", "net5.0", "MSTest1.dll"), }; - //// console mode - //var settingsFile = Path.GetTempFileName(); - //try - //{ - // File.WriteAllText(settingsFile, sourceSettings); - // var processStartInfo = new ProcessStartInfo - // { - // FileName = console, - // Arguments = $"{string.Join(" ", sources)} --settings:{settingsFile}", - // UseShellExecute = false, - // }; - // EnvironmentVariables.Variables.ToList().ForEach(processStartInfo.Environment.Add); - // var process = Process.Start(processStartInfo); - // process.WaitForExit(); - // if (process.ExitCode != 0) - // { - // throw new Exception($"Process failed with {process.ExitCode}"); - // } - //} - //finally - //{ - // try { File.Delete(settingsFile); } catch { } - //} + // console mode + var settingsFile = Path.GetTempFileName(); + try + { + File.WriteAllText(settingsFile, sourceSettings); + var processStartInfo = new ProcessStartInfo + { + FileName = console, + Arguments = $"{string.Join(" ", sources)} --settings:{settingsFile} --listtests", + UseShellExecute = false, + }; + EnvironmentVariables.Variables.ToList().ForEach(processStartInfo.Environment.Add); + var process = Process.Start(processStartInfo); + process.WaitForExit(); + if (process.ExitCode != 0) + { + throw new Exception($"Process failed with {process.ExitCode}"); + } + } + finally + { + try { File.Delete(settingsFile); } catch { } + } // design mode var consoleOptions = new ConsoleParameters @@ -97,16 +96,16 @@ static void Main(string[] args) var discoveryHandler = new PlaygroundTestDiscoveryHandler(); var sw = Stopwatch.StartNew(); // Discovery - r.DiscoverTests(sources, sourceSettings, options, sessionHandler.TestSessionInfo, discoveryHandler); + r.DiscoverTests(sources, sourceSettings, options, sessionHandler.TestSessionInfo, discoveryHandler); var discoveryDuration = sw.ElapsedMilliseconds; Console.WriteLine($"Discovery done in {discoveryDuration} ms"); sw.Restart(); // Run with test cases and custom testhost launcher - //r.RunTestsWithCustomTestHost(discoveryHandler.TestCases, sourceSettings, options, sessionHandler.TestSessionInfo, new TestRunHandler(), new DebuggerTestHostLauncher()); + r.RunTestsWithCustomTestHost(discoveryHandler.TestCases, sourceSettings, options, sessionHandler.TestSessionInfo, new TestRunHandler(), new DebuggerTestHostLauncher()); //// Run with test cases and without custom testhost launcher //r.RunTests(discoveryHandler.TestCases, sourceSettings, options, sessionHandler.TestSessionInfo, new TestRunHandler()); //// Run with sources and custom testhost launcher - r.RunTestsWithCustomTestHost(sources, sourceSettings, options, sessionHandler.TestSessionInfo, new TestRunHandler(), new DebuggerTestHostLauncher()); + //r.RunTestsWithCustomTestHost(sources, sourceSettings, options, sessionHandler.TestSessionInfo, new TestRunHandler(), new DebuggerTestHostLauncher()); //// Run with sources //r.RunTests(sources, sourceSettings, options, sessionHandler.TestSessionInfo, new TestRunHandler()); var rd = sw.ElapsedMilliseconds; @@ -165,7 +164,7 @@ private static string WriteTests(IEnumerable testCases) : "\t"; private static string WriteSources(IEnumerable sources) - => sources?.Select(s => s.Source).Any() == true + => sources?.Any() == true ? "\t" + string.Join("\n\t", sources.Select(s => s.Source)) : "\t"; } diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Utilities/DiscoveredSourceHelper.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Utilities/DiscoveredSourceHelper.cs index a9e245f45a..2048cf1fba 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Utilities/DiscoveredSourceHelper.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Utilities/DiscoveredSourceHelper.cs @@ -8,9 +8,9 @@ namespace Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Utilities; -internal class DiscoveredSourceHelper +internal static class DiscoveredSourceHelper { - public static List ToDiscoveredSources(List sources) + public static List ToDiscoveredSources(IEnumerable sources) { return sources.Select(source => new DiscoveredSource { Source = source }).ToList(); } diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/TranslationLayerTests/EventHandler/DiscoveryEventHandler.cs b/test/Microsoft.TestPlatform.AcceptanceTests/TranslationLayerTests/EventHandler/DiscoveryEventHandler.cs index c536bba340..e02e5a3afc 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/TranslationLayerTests/EventHandler/DiscoveryEventHandler.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/TranslationLayerTests/EventHandler/DiscoveryEventHandler.cs @@ -71,11 +71,10 @@ public class DiscoveryEventHandler2 : ITestDiscoveryEventsHandler2 /// public List DiscoveredTestCases { get; } - public IList? FullyDiscoveredSources { get; private set; } - public IList? PartiallyDiscoveredSources { get; private set; } - public IList? NotDiscoveredSources { get; private set; } - - public IList? SkippedDiscoveredSources { get; private set; } + public IList? FullyDiscoveredSources { get; private set; } + public IList? PartiallyDiscoveredSources { get; private set; } + public IList? NotDiscoveredSources { get; private set; } + public IList? SkippedDiscoveredSources { get; private set; } public List TestMessages; @@ -108,10 +107,10 @@ public void HandleDiscoveryComplete(DiscoveryCompleteEventArgs discoveryComplete } Metrics = discoveryCompleteEventArgs.Metrics; - FullyDiscoveredSources = discoveryCompleteEventArgs.FullyDiscoveredSources.Select(source => source.Source!).ToList(); - PartiallyDiscoveredSources = discoveryCompleteEventArgs.FullyDiscoveredSources.Select(source => source.Source!).ToList(); - NotDiscoveredSources = discoveryCompleteEventArgs.FullyDiscoveredSources.Select(source => source.Source!).ToList(); - SkippedDiscoveredSources = discoveryCompleteEventArgs.FullyDiscoveredSources.Select(source => source.Source!).ToList(); + FullyDiscoveredSources = discoveryCompleteEventArgs.FullyDiscoveredSources; + PartiallyDiscoveredSources = discoveryCompleteEventArgs.FullyDiscoveredSources; + NotDiscoveredSources = discoveryCompleteEventArgs.FullyDiscoveredSources; + SkippedDiscoveredSources = discoveryCompleteEventArgs.FullyDiscoveredSources; } public void HandleDiscoveredTests(IEnumerable discoveredTestCases) From 540ea7865d641d9e2f32137b8e3ef4a94836905f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jare=C5=A1?= Date: Wed, 15 Jun 2022 13:18:50 +0200 Subject: [PATCH 10/12] Fix tests --- .../Processors/TestSourceArgumentProcessorTests.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/vstest.console.UnitTests/Processors/TestSourceArgumentProcessorTests.cs b/test/vstest.console.UnitTests/Processors/TestSourceArgumentProcessorTests.cs index 71d741e46e..2a2e7f8e3a 100644 --- a/test/vstest.console.UnitTests/Processors/TestSourceArgumentProcessorTests.cs +++ b/test/vstest.console.UnitTests/Processors/TestSourceArgumentProcessorTests.cs @@ -82,7 +82,8 @@ public void ExecuterInitializeWithInvalidSourceShouldThrowCommandLineException() catch (Exception ex) { Assert.IsTrue(ex is TestSourceException); - Assert.AreEqual("The test source file \"" + Path.GetFullPath(testFilePath) + "\" provided was not found.", ex.Message); + StringAssert.StartsWith(ex.Message, "The test source file \""); + StringAssert.EndsWith(ex.Message, testFilePath + "\" provided was not found."); } } From 017d76c781f566daadda8b3b0b3847fb74976838 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jare=C5=A1?= Date: Wed, 15 Jun 2022 13:57:14 +0200 Subject: [PATCH 11/12] Remove backup file --- ...p.TestPlatform.Extensions.TrxLogger.csproj | 75 ------------------- 1 file changed, 75 deletions(-) delete mode 100644 src/Microsoft.TestPlatform.Extensions.TrxLogger/Microsoft - Backup.TestPlatform.Extensions.TrxLogger.csproj diff --git a/src/Microsoft.TestPlatform.Extensions.TrxLogger/Microsoft - Backup.TestPlatform.Extensions.TrxLogger.csproj b/src/Microsoft.TestPlatform.Extensions.TrxLogger/Microsoft - Backup.TestPlatform.Extensions.TrxLogger.csproj deleted file mode 100644 index dda735f4ae..0000000000 --- a/src/Microsoft.TestPlatform.Extensions.TrxLogger/Microsoft - Backup.TestPlatform.Extensions.TrxLogger.csproj +++ /dev/null @@ -1,75 +0,0 @@ - - - - ..\..\ - - - - Microsoft.VisualStudio.TestPlatform.Extensions.Trx.TestLogger - netstandard2.0;net451 - net6.0 - false - - - - - - - - - - - - - - - - - - - - - - - - - - - True - True - NullableHelpers.tt - - - True - True - TrxResource.resx - - - - - ResXFileCodeGenerator - TrxResource.Designer.cs - - - - Microsoft.VisualStudio.TestPlatform.Extensions.TrxLogger - - - - - - - - - - - - NullableHelpers.cs - TextTemplatingFileGenerator - - - - - - - From bd02d03ca9138c4f64f91123f4806d26e950c246 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jare=C5=A1?= Date: Wed, 15 Jun 2022 16:59:04 +0200 Subject: [PATCH 12/12] Remove discovered source --- playground/TestPlatform.Playground/Program.cs | 6 ++++-- .../Messages/DiscoveryCompletePayload.cs | 12 ++++++++---- .../PublicAPI/PublicAPI.Shipped.txt | 8 +++++--- .../TestRequestSender.cs | 1 + .../Parallel/ParallelDiscoveryEventsHandler.cs | 9 ++++++--- .../Discovery/DiscoveryManager.cs | 14 ++++++++------ .../EventHandlers/TestRequestHandler.cs | 1 + .../Utilities/DiscoveredSourceHelper.cs | 17 ----------------- .../Client/Events/DiscoveredSource.cs | 15 --------------- .../Client/Events/DiscoveryCompleteEventArgs.cs | 10 ++++++---- .../PublicAPI/PublicAPI.Shipped.txt | 12 ++++-------- .../VsTestConsoleRequestSender.cs | 2 ++ .../EventHandler/DiscoveryEventHandler.cs | 14 +++++++------- .../VsTestConsoleRequestSenderTests.cs | 6 ++---- 14 files changed, 54 insertions(+), 73 deletions(-) delete mode 100644 src/Microsoft.TestPlatform.CrossPlatEngine/Utilities/DiscoveredSourceHelper.cs delete mode 100644 src/Microsoft.TestPlatform.ObjectModel/Client/Events/DiscoveredSource.cs diff --git a/playground/TestPlatform.Playground/Program.cs b/playground/TestPlatform.Playground/Program.cs index db6c7dec4f..97a058ecbd 100644 --- a/playground/TestPlatform.Playground/Program.cs +++ b/playground/TestPlatform.Playground/Program.cs @@ -143,6 +143,8 @@ public void HandleDiscoveryComplete(DiscoveryCompleteEventArgs discoveryComplete Console.WriteLine(WriteSources(discoveryCompleteEventArgs.FullyDiscoveredSources)); Console.WriteLine("Partially discovered:"); Console.WriteLine(WriteSources(discoveryCompleteEventArgs.PartiallyDiscoveredSources)); + Console.WriteLine("Skipped discovery:"); + Console.WriteLine(WriteSources(discoveryCompleteEventArgs.SkippedDiscoveredSources)); Console.WriteLine("Not discovered:"); Console.WriteLine(WriteSources(discoveryCompleteEventArgs.NotDiscoveredSources)); if (lastChunk != null) { TestCases.AddRange(lastChunk); } @@ -163,9 +165,9 @@ private static string WriteTests(IEnumerable testCases) ? "\t" + string.Join("\n\t", testCases.Select(r => r.Source + " " + r.DisplayName)) : "\t"; - private static string WriteSources(IEnumerable sources) + private static string WriteSources(IEnumerable sources) => sources?.Any() == true - ? "\t" + string.Join("\n\t", sources.Select(s => s.Source)) + ? "\t" + string.Join("\n\t", sources) : "\t"; } diff --git a/src/Microsoft.TestPlatform.CommunicationUtilities/Messages/DiscoveryCompletePayload.cs b/src/Microsoft.TestPlatform.CommunicationUtilities/Messages/DiscoveryCompletePayload.cs index d6823b61e8..ec1217b4cc 100644 --- a/src/Microsoft.TestPlatform.CommunicationUtilities/Messages/DiscoveryCompletePayload.cs +++ b/src/Microsoft.TestPlatform.CommunicationUtilities/Messages/DiscoveryCompletePayload.cs @@ -4,7 +4,6 @@ using System.Collections.Generic; using Microsoft.VisualStudio.TestPlatform.ObjectModel; -using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client; #nullable disable @@ -38,17 +37,22 @@ public class DiscoveryCompletePayload /// /// Gets or sets list of sources which were fully discovered. /// - public IList FullyDiscoveredSources { get; set; } = new List(); + public IList FullyDiscoveredSources { get; set; } = new List(); /// /// Gets or sets list of sources which were partially discovered (started discover tests, but then discovery aborted). /// - public IList PartiallyDiscoveredSources { get; set; } = new List(); + public IList PartiallyDiscoveredSources { get; set; } = new List(); /// /// Gets or sets list of sources which were not discovered at all. /// - public IList NotDiscoveredSources { get; set; } = new List(); + public IList NotDiscoveredSources { get; set; } = new List(); + + /// + /// Gets or sets list of sources which skipped in discovery on purpose, e.g. because they are known dlls that have no tests, or there is no runtime provider to run them. + /// + public IList SkippedDiscoverySources { get; set; } = new List(); /// /// Gets or sets the collection of discovered extensions. diff --git a/src/Microsoft.TestPlatform.CommunicationUtilities/PublicAPI/PublicAPI.Shipped.txt b/src/Microsoft.TestPlatform.CommunicationUtilities/PublicAPI/PublicAPI.Shipped.txt index 1aa45bb7e0..1986a7af5d 100644 --- a/src/Microsoft.TestPlatform.CommunicationUtilities/PublicAPI/PublicAPI.Shipped.txt +++ b/src/Microsoft.TestPlatform.CommunicationUtilities/PublicAPI/PublicAPI.Shipped.txt @@ -386,6 +386,8 @@ Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.Interfaces.ITestReque Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.Interfaces.ITestRequestSender.StartTestRun(Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.ObjectModel.TestRunCriteriaWithTests runCriteria, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IInternalTestRunEventsHandler eventHandler) -> void Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.TestRequestSender.StartTestRun(Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.ObjectModel.TestRunCriteriaWithSources runCriteria, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IInternalTestRunEventsHandler eventHandler) -> void Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.TestRequestSender.StartTestRun(Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.ObjectModel.TestRunCriteriaWithTests runCriteria, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IInternalTestRunEventsHandler eventHandler) -> void -Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.ObjectModel.DiscoveryCompletePayload.FullyDiscoveredSources.get -> System.Collections.Generic.IList -Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.ObjectModel.DiscoveryCompletePayload.NotDiscoveredSources.get -> System.Collections.Generic.IList -Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.ObjectModel.DiscoveryCompletePayload.PartiallyDiscoveredSources.get -> System.Collections.Generic.IList +Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.ObjectModel.DiscoveryCompletePayload.FullyDiscoveredSources.get -> System.Collections.Generic.IList +Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.ObjectModel.DiscoveryCompletePayload.NotDiscoveredSources.get -> System.Collections.Generic.IList +Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.ObjectModel.DiscoveryCompletePayload.PartiallyDiscoveredSources.get -> System.Collections.Generic.IList +Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.ObjectModel.DiscoveryCompletePayload.SkippedDiscoverySources.get -> System.Collections.Generic.IList +Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.ObjectModel.DiscoveryCompletePayload.SkippedDiscoverySources.set -> void diff --git a/src/Microsoft.TestPlatform.CommunicationUtilities/TestRequestSender.cs b/src/Microsoft.TestPlatform.CommunicationUtilities/TestRequestSender.cs index ead4d77aaa..df4bffc283 100644 --- a/src/Microsoft.TestPlatform.CommunicationUtilities/TestRequestSender.cs +++ b/src/Microsoft.TestPlatform.CommunicationUtilities/TestRequestSender.cs @@ -586,6 +586,7 @@ private void OnDiscoveryMessageReceived(ITestDiscoveryEventsHandler2 discoveryEv PartiallyDiscoveredSources = payload.PartiallyDiscoveredSources, NotDiscoveredSources = payload.NotDiscoveredSources, DiscoveredExtensions = payload.DiscoveredExtensions, + SkippedDiscoveredSources = payload.SkippedDiscoverySources, }; discoveryCompleteEventArgs.Metrics = payload.Metrics; diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/ParallelDiscoveryEventsHandler.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/ParallelDiscoveryEventsHandler.cs index 882fee1edb..4603f83c08 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/ParallelDiscoveryEventsHandler.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/ParallelDiscoveryEventsHandler.cs @@ -87,9 +87,10 @@ public void HandleDiscoveryComplete(DiscoveryCompleteEventArgs discoveryComplete // Manager said we are ready to publish the test discovery completed and we haven't yet // published it. - var fullyDiscovered = DiscoveredSourceHelper.ToDiscoveredSources(_discoveryDataAggregator.GetSourcesWithStatus(DiscoveryStatus.FullyDiscovered)); - var partiallyDiscovered = DiscoveredSourceHelper.ToDiscoveredSources(_discoveryDataAggregator.GetSourcesWithStatus(DiscoveryStatus.PartiallyDiscovered)); - var notDiscovered = DiscoveredSourceHelper.ToDiscoveredSources(_discoveryDataAggregator.GetSourcesWithStatus(DiscoveryStatus.NotDiscovered)); + var fullyDiscovered = _discoveryDataAggregator.GetSourcesWithStatus(DiscoveryStatus.FullyDiscovered); + var partiallyDiscovered = _discoveryDataAggregator.GetSourcesWithStatus(DiscoveryStatus.PartiallyDiscovered); + var notDiscovered = _discoveryDataAggregator.GetSourcesWithStatus(DiscoveryStatus.NotDiscovered); + var skippedDiscovery = _discoveryDataAggregator.GetSourcesWithStatus(DiscoveryStatus.SkippedDiscovery); // As we immediately return results to IDE in case of aborting we need to set // isAborted = true and totalTests = -1 @@ -132,6 +133,7 @@ public void HandleDiscoveryComplete(DiscoveryCompleteEventArgs discoveryComplete FullyDiscoveredSources = fullyDiscovered, PartiallyDiscoveredSources = partiallyDiscovered, NotDiscoveredSources = notDiscovered, + SkippedDiscoverySources = skippedDiscovery, DiscoveredExtensions = _discoveryDataAggregator.DiscoveredExtensions, Metrics = aggregatedDiscoveryDataMetrics, }; @@ -147,6 +149,7 @@ public void HandleDiscoveryComplete(DiscoveryCompleteEventArgs discoveryComplete FullyDiscoveredSources = fullyDiscovered, PartiallyDiscoveredSources = partiallyDiscovered, NotDiscoveredSources = notDiscovered, + SkippedDiscoveredSources = skippedDiscovery, DiscoveredExtensions = _discoveryDataAggregator.DiscoveredExtensions, Metrics = aggregatedDiscoveryDataMetrics, }; diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Discovery/DiscoveryManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Discovery/DiscoveryManager.cs index 742d8c46de..5f9307c9f7 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Discovery/DiscoveryManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Discovery/DiscoveryManager.cs @@ -173,9 +173,10 @@ public void DiscoverTests(DiscoveryCriteria discoveryCriteria, ITestDiscoveryEve var discoveryCompleteEventsArgs = new DiscoveryCompleteEventArgs(isAborted ? -1 : totalDiscoveredTestCount, isAborted) { - FullyDiscoveredSources = DiscoveredSourceHelper.ToDiscoveredSources(_discoveryDataAggregator.GetSourcesWithStatus(DiscoveryStatus.FullyDiscovered)), - PartiallyDiscoveredSources = DiscoveredSourceHelper.ToDiscoveredSources(_discoveryDataAggregator.GetSourcesWithStatus(DiscoveryStatus.PartiallyDiscovered)), - NotDiscoveredSources = DiscoveredSourceHelper.ToDiscoveredSources(_discoveryDataAggregator.GetSourcesWithStatus(DiscoveryStatus.NotDiscovered)), + FullyDiscoveredSources = _discoveryDataAggregator.GetSourcesWithStatus(DiscoveryStatus.FullyDiscovered), + PartiallyDiscoveredSources = _discoveryDataAggregator.GetSourcesWithStatus(DiscoveryStatus.PartiallyDiscovered), + NotDiscoveredSources = _discoveryDataAggregator.GetSourcesWithStatus(DiscoveryStatus.NotDiscovered), + SkippedDiscoveredSources = _discoveryDataAggregator.GetSourcesWithStatus(DiscoveryStatus.SkippedDiscovery), DiscoveredExtensions = TestPluginCache.Instance.TestExtensions?.GetCachedExtensions(), Metrics = _requestData.MetricsCollection.Metrics, }; @@ -212,9 +213,10 @@ public void Abort(ITestDiscoveryEventsHandler2 eventHandler) var discoveryCompleteEventArgs = new DiscoveryCompleteEventArgs(-1, true) { - FullyDiscoveredSources = DiscoveredSourceHelper.ToDiscoveredSources(_discoveryDataAggregator.GetSourcesWithStatus(DiscoveryStatus.FullyDiscovered)), - PartiallyDiscoveredSources = DiscoveredSourceHelper.ToDiscoveredSources(_discoveryDataAggregator.GetSourcesWithStatus(DiscoveryStatus.PartiallyDiscovered)), - NotDiscoveredSources = DiscoveredSourceHelper.ToDiscoveredSources(_discoveryDataAggregator.GetSourcesWithStatus(DiscoveryStatus.NotDiscovered)), + FullyDiscoveredSources = _discoveryDataAggregator.GetSourcesWithStatus(DiscoveryStatus.FullyDiscovered), + PartiallyDiscoveredSources = _discoveryDataAggregator.GetSourcesWithStatus(DiscoveryStatus.PartiallyDiscovered), + NotDiscoveredSources = _discoveryDataAggregator.GetSourcesWithStatus(DiscoveryStatus.NotDiscovered), + SkippedDiscoveredSources = _discoveryDataAggregator.GetSourcesWithStatus(DiscoveryStatus.SkippedDiscovery), }; eventHandler.HandleDiscoveryComplete(discoveryCompleteEventArgs, null); } diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/EventHandlers/TestRequestHandler.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/EventHandlers/TestRequestHandler.cs index 0ae55ce3bf..89a0d0848a 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/EventHandlers/TestRequestHandler.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/EventHandlers/TestRequestHandler.cs @@ -242,6 +242,7 @@ public void DiscoveryComplete(DiscoveryCompleteEventArgs discoveryCompleteEventA FullyDiscoveredSources = discoveryCompleteEventArgs.FullyDiscoveredSources, PartiallyDiscoveredSources = discoveryCompleteEventArgs.PartiallyDiscoveredSources, NotDiscoveredSources = discoveryCompleteEventArgs.NotDiscoveredSources, + SkippedDiscoverySources = discoveryCompleteEventArgs.SkippedDiscoveredSources, DiscoveredExtensions = discoveryCompleteEventArgs.DiscoveredExtensions, }, _protocolVersion); diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Utilities/DiscoveredSourceHelper.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Utilities/DiscoveredSourceHelper.cs deleted file mode 100644 index 2048cf1fba..0000000000 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Utilities/DiscoveredSourceHelper.cs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -using System.Collections.Generic; -using System.Linq; - -using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client; - -namespace Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Utilities; - -internal static class DiscoveredSourceHelper -{ - public static List ToDiscoveredSources(IEnumerable sources) - { - return sources.Select(source => new DiscoveredSource { Source = source }).ToList(); - } -} diff --git a/src/Microsoft.TestPlatform.ObjectModel/Client/Events/DiscoveredSource.cs b/src/Microsoft.TestPlatform.ObjectModel/Client/Events/DiscoveredSource.cs deleted file mode 100644 index c346c5f891..0000000000 --- a/src/Microsoft.TestPlatform.ObjectModel/Client/Events/DiscoveredSource.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -using System.Runtime.Serialization; - -namespace Microsoft.VisualStudio.TestPlatform.ObjectModel.Client; - -/// -/// Describes a source file that was discovered, or that was requested to be discovered. -/// -public class DiscoveredSource -{ - [DataMember] - public string? Source { get; set; } -} diff --git a/src/Microsoft.TestPlatform.ObjectModel/Client/Events/DiscoveryCompleteEventArgs.cs b/src/Microsoft.TestPlatform.ObjectModel/Client/Events/DiscoveryCompleteEventArgs.cs index e96c20c00a..92609a36ef 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Client/Events/DiscoveryCompleteEventArgs.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/Client/Events/DiscoveryCompleteEventArgs.cs @@ -50,25 +50,27 @@ public DiscoveryCompleteEventArgs(long totalTests, bool isAborted) /// Gets or sets the list of sources which were fully discovered. /// [DataMember] - public IList FullyDiscoveredSources { get; set; } = new List(); + public IList FullyDiscoveredSources { get; set; } = new List(); /// /// Gets or sets the list of sources which were partially discovered (started discover tests, but then discovery aborted). /// [DataMember] - public IList PartiallyDiscoveredSources { get; set; } = new List(); + // Added in protocol version 6. + public IList PartiallyDiscoveredSources { get; set; } = new List(); /// /// Gets or sets the list of sources that were skipped during discovery. /// [DataMember] - public IList SkippedDiscoveredSources { get; set; } = new List(); + // Added in protocol version 7, for previous versions this is put into NotDiscoveredSources. + public IList SkippedDiscoveredSources { get; set; } = new List(); /// /// Gets or sets the list of sources which were not discovered at all. /// [DataMember] - public IList NotDiscoveredSources { get; set; } = new List(); + public IList NotDiscoveredSources { get; set; } = new List(); /// /// Gets or sets the collection of discovered extensions. diff --git a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/PublicAPI.Shipped.txt b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/PublicAPI.Shipped.txt index 9a707e2b8b..5a67f67e54 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/PublicAPI.Shipped.txt +++ b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/PublicAPI.Shipped.txt @@ -948,17 +948,13 @@ Microsoft.VisualStudio.TestPlatform.ObjectModel.EditorAttachDebuggerPayload.Targ Microsoft.VisualStudio.TestPlatform.ObjectModel.EditorAttachDebuggerPayload.TargetFramework.set -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.TestProcessAttachDebuggerPayload.TargetFramework.get -> string Microsoft.VisualStudio.TestPlatform.ObjectModel.TestProcessAttachDebuggerPayload.TargetFramework.set -> void -Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveredSource -Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveredSource.DiscoveredSource() -> void -Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveredSource.Source.get -> string -Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveredSource.Source.set -> void -Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCompleteEventArgs.FullyDiscoveredSources.get -> System.Collections.Generic.IList -Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCompleteEventArgs.NotDiscoveredSources.get -> System.Collections.Generic.IList -Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCompleteEventArgs.PartiallyDiscoveredSources.get -> System.Collections.Generic.IList -Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCompleteEventArgs.SkippedDiscoveredSources.get -> System.Collections.Generic.IList Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCompleteEventArgs.SkippedDiscoveredSources.set -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform.CreateDiscoveryRequest(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IRequestData requestData, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria discoveryCriteria, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestPlatformOptions options, System.Collections.Generic.Dictionary sourceToSourceDetailMap, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IWarningLogger warningLogger) -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IDiscoveryRequest Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform.CreateTestRunRequest(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IRequestData requestData, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestRunCriteria testRunCriteria, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestPlatformOptions options, System.Collections.Generic.Dictionary sourceToSourceDetailMap, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IWarningLogger warningLogger) -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestRunRequest Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform.StartTestSession(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IRequestData requestData, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.StartTestSessionCriteria criteria, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestSessionEventsHandler eventsHandler, System.Collections.Generic.Dictionary sourceToSourceDetailMap, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IWarningLogger warningLogger) -> bool Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IWarningLogger Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IWarningLogger.LogWarning(string message) -> void +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCompleteEventArgs.FullyDiscoveredSources.get -> System.Collections.Generic.IList +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCompleteEventArgs.NotDiscoveredSources.get -> System.Collections.Generic.IList +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCompleteEventArgs.PartiallyDiscoveredSources.get -> System.Collections.Generic.IList +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCompleteEventArgs.SkippedDiscoveredSources.get -> System.Collections.Generic.IList diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleRequestSender.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleRequestSender.cs index eb7d1a4a8d..61aad0044d 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleRequestSender.cs +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleRequestSender.cs @@ -979,6 +979,7 @@ private void SendMessageAndListenAndReportTestCases( FullyDiscoveredSources = discoveryCompletePayload.FullyDiscoveredSources, PartiallyDiscoveredSources = discoveryCompletePayload.PartiallyDiscoveredSources, NotDiscoveredSources = discoveryCompletePayload.NotDiscoveredSources, + SkippedDiscoveredSources = discoveryCompletePayload.SkippedDiscoverySources, DiscoveredExtensions = discoveryCompletePayload.DiscoveredExtensions, Metrics = discoveryCompletePayload.Metrics, }; @@ -1070,6 +1071,7 @@ private async Task SendMessageAndListenAndReportTestCasesAsync( FullyDiscoveredSources = discoveryCompletePayload.FullyDiscoveredSources, PartiallyDiscoveredSources = discoveryCompletePayload.PartiallyDiscoveredSources, NotDiscoveredSources = discoveryCompletePayload.NotDiscoveredSources, + SkippedDiscoveredSources = discoveryCompletePayload.SkippedDiscoverySources, DiscoveredExtensions = discoveryCompletePayload.DiscoveredExtensions, }; diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/TranslationLayerTests/EventHandler/DiscoveryEventHandler.cs b/test/Microsoft.TestPlatform.AcceptanceTests/TranslationLayerTests/EventHandler/DiscoveryEventHandler.cs index e02e5a3afc..2423e8ae25 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/TranslationLayerTests/EventHandler/DiscoveryEventHandler.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/TranslationLayerTests/EventHandler/DiscoveryEventHandler.cs @@ -71,10 +71,10 @@ public class DiscoveryEventHandler2 : ITestDiscoveryEventsHandler2 /// public List DiscoveredTestCases { get; } - public IList? FullyDiscoveredSources { get; private set; } - public IList? PartiallyDiscoveredSources { get; private set; } - public IList? NotDiscoveredSources { get; private set; } - public IList? SkippedDiscoveredSources { get; private set; } + public IList? FullyDiscoveredSources { get; private set; } + public IList? PartiallyDiscoveredSources { get; private set; } + public IList? NotDiscoveredSources { get; private set; } + public IList? SkippedDiscoveredSources { get; private set; } public List TestMessages; @@ -108,9 +108,9 @@ public void HandleDiscoveryComplete(DiscoveryCompleteEventArgs discoveryComplete Metrics = discoveryCompleteEventArgs.Metrics; FullyDiscoveredSources = discoveryCompleteEventArgs.FullyDiscoveredSources; - PartiallyDiscoveredSources = discoveryCompleteEventArgs.FullyDiscoveredSources; - NotDiscoveredSources = discoveryCompleteEventArgs.FullyDiscoveredSources; - SkippedDiscoveredSources = discoveryCompleteEventArgs.FullyDiscoveredSources; + PartiallyDiscoveredSources = discoveryCompleteEventArgs.PartiallyDiscoveredSources; + NotDiscoveredSources = discoveryCompleteEventArgs.NotDiscoveredSources; + SkippedDiscoveredSources = discoveryCompleteEventArgs.SkippedDiscoveredSources; } public void HandleDiscoveredTests(IEnumerable discoveredTestCases) diff --git a/test/TranslationLayer.UnitTests/VsTestConsoleRequestSenderTests.cs b/test/TranslationLayer.UnitTests/VsTestConsoleRequestSenderTests.cs index 223e566b47..4d50bf1225 100644 --- a/test/TranslationLayer.UnitTests/VsTestConsoleRequestSenderTests.cs +++ b/test/TranslationLayer.UnitTests/VsTestConsoleRequestSenderTests.cs @@ -443,8 +443,7 @@ public void DiscoverTestsShouldCompleteWithSingleFullyDiscoveredSource() Payload = JToken.FromObject(new List() { testCase }) }; - var discoveredSources = sources.Select(source => new DiscoveredSource { Source = source }).ToList(); - var payload = new DiscoveryCompletePayload() { TotalTests = 1, LastDiscoveredTests = null, IsAborted = false, FullyDiscoveredSources = discoveredSources }; + var payload = new DiscoveryCompletePayload() { TotalTests = 1, LastDiscoveredTests = null, IsAborted = false, FullyDiscoveredSources = sources }; var discoveryComplete = new Message() { MessageType = MessageType.DiscoveryComplete, @@ -484,8 +483,7 @@ public void DiscoverTestsShouldCompleteWithCorrectAbortedValuesIfAbortingWasRequ Payload = JToken.FromObject(new List() { testCase }) }; - var discoveredSources = sources.Select(source => new DiscoveredSource { Source = source }).ToList(); - var payload = new DiscoveryCompletePayload() { TotalTests = -1, LastDiscoveredTests = null, IsAborted = true, FullyDiscoveredSources = discoveredSources }; + var payload = new DiscoveryCompletePayload() { TotalTests = -1, LastDiscoveredTests = null, IsAborted = true, FullyDiscoveredSources = sources }; var discoveryComplete = new Message() { MessageType = MessageType.DiscoveryComplete,