diff --git a/src/Microsoft.TestPlatform.Client/MultiTestRunFinalization/MultiTestRunFinalizationEventsHandler.cs b/src/Microsoft.TestPlatform.Client/AttachmentsProcessing/TestRunAttachmentsProcessingEventsHandler.cs similarity index 55% rename from src/Microsoft.TestPlatform.Client/MultiTestRunFinalization/MultiTestRunFinalizationEventsHandler.cs rename to src/Microsoft.TestPlatform.Client/AttachmentsProcessing/TestRunAttachmentsProcessingEventsHandler.cs index f0359712de..3a5674db16 100644 --- a/src/Microsoft.TestPlatform.Client/MultiTestRunFinalization/MultiTestRunFinalizationEventsHandler.cs +++ b/src/Microsoft.TestPlatform.Client/AttachmentsProcessing/TestRunAttachmentsProcessingEventsHandler.cs @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -namespace Microsoft.VisualStudio.TestPlatform.Client.MultiTestRunFinalization +namespace Microsoft.VisualStudio.TestPlatform.Client.TestRunAttachmentsProcessing { using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.Interfaces; using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.ObjectModel; @@ -11,47 +11,48 @@ namespace Microsoft.VisualStudio.TestPlatform.Client.MultiTestRunFinalization using System.Collections.Generic; /// - /// The multi test finalization events handler. + /// The test run attachments processing events handler. /// - public class MultiTestRunFinalizationEventsHandler : IMultiTestRunFinalizationEventsHandler + /// + public class TestRunAttachmentsProcessingEventsHandler : ITestRunAttachmentsProcessingEventsHandler { private readonly ICommunicationManager communicationManager; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The communication manager. - public MultiTestRunFinalizationEventsHandler(ICommunicationManager communicationManager) + public TestRunAttachmentsProcessingEventsHandler(ICommunicationManager communicationManager) { this.communicationManager = communicationManager; } /// - public void HandleMultiTestRunFinalizationComplete(MultiTestRunFinalizationCompleteEventArgs finalizationCompleteEventArgs, IEnumerable lastChunk) + public void HandleTestRunAttachmentsProcessingComplete(TestRunAttachmentsProcessingCompleteEventArgs attachmentsProcessingCompleteEventArgs, IEnumerable lastChunk) { if (EqtTrace.IsInfoEnabled) { - EqtTrace.Info("Multi test run finalization completed."); + EqtTrace.Info("Test run attachments processing completed."); } - var payload = new MultiTestRunFinalizationCompletePayload() + var payload = new TestRunAttachmentsProcessingCompletePayload() { - FinalizationCompleteEventArgs = finalizationCompleteEventArgs, + AttachmentsProcessingCompleteEventArgs = attachmentsProcessingCompleteEventArgs, Attachments = lastChunk }; - this.communicationManager.SendMessage(MessageType.MultiTestRunFinalizationComplete, payload); + this.communicationManager.SendMessage(MessageType.TestRunAttachmentsProcessingComplete, payload); } /// - public void HandleMultiTestRunFinalizationProgress(MultiTestRunFinalizationProgressEventArgs finalizationProgressEventArgs) + public void HandleTestRunAttachmentsProcessingProgress(TestRunAttachmentsProcessingProgressEventArgs AttachmentsProcessingProgressEventArgs) { - var payload = new MultiTestRunFinalizationProgressPayload() + var payload = new TestRunAttachmentsProcessingProgressPayload() { - FinalizationProgressEventArgs = finalizationProgressEventArgs, + AttachmentsProcessingProgressEventArgs = AttachmentsProcessingProgressEventArgs, }; - this.communicationManager.SendMessage(MessageType.MultiTestRunFinalizationProgress, payload); + this.communicationManager.SendMessage(MessageType.TestRunAttachmentsProcessingProgress, payload); } /// diff --git a/src/Microsoft.TestPlatform.Client/DesignMode/DesignModeClient.cs b/src/Microsoft.TestPlatform.Client/DesignMode/DesignModeClient.cs index d49af32336..6b16b27a55 100644 --- a/src/Microsoft.TestPlatform.Client/DesignMode/DesignModeClient.cs +++ b/src/Microsoft.TestPlatform.Client/DesignMode/DesignModeClient.cs @@ -9,7 +9,7 @@ namespace Microsoft.VisualStudio.TestPlatform.Client.DesignMode using System.Net; using System.Threading; using System.Threading.Tasks; - using Microsoft.VisualStudio.TestPlatform.Client.MultiTestRunFinalization; + using Microsoft.VisualStudio.TestPlatform.Client.TestRunAttachmentsProcessing; using Microsoft.VisualStudio.TestPlatform.Client.RequestHelper; using Microsoft.VisualStudio.TestPlatform.Common.Logging; using Microsoft.VisualStudio.TestPlatform.Common.Utilities; @@ -199,11 +199,11 @@ private void ProcessRequests(ITestRequestManager testRequestManager) break; } - case MessageType.MultiTestRunFinalizationStart: + case MessageType.TestRunAttachmentsProcessingStart: { - var multiTestRunFinalizationPayload = - this.communicationManager.DeserializePayload(message); - this.StartMultiTestRunFinalization(multiTestRunFinalizationPayload, testRequestManager); + var testRunAttachmentsProcessingPayload = + this.communicationManager.DeserializePayload(message); + this.StartTestRunAttachmentsProcessing(testRunAttachmentsProcessingPayload, testRequestManager); break; } @@ -225,9 +225,9 @@ private void ProcessRequests(ITestRequestManager testRequestManager) break; } - case MessageType.MultiTestRunFinalizationCancel: + case MessageType.TestRunAttachmentsProcessingCancel: { - testRequestManager.CancelMultiTestRunFinalization(); + testRequestManager.CancelTestRunAttachmentsProcessing(); break; } @@ -472,29 +472,29 @@ private void StartDiscovery(DiscoveryRequestPayload discoveryRequestPayload, ITe }); } - private void StartMultiTestRunFinalization(MultiTestRunFinalizationPayload finalizationPayload, ITestRequestManager testRequestManager) + private void StartTestRunAttachmentsProcessing(TestRunAttachmentsProcessingPayload attachmentsProcessingPayload, ITestRequestManager testRequestManager) { Task.Run( delegate { try { - testRequestManager.FinalizeMultiTestRun(finalizationPayload, new MultiTestRunFinalizationEventsHandler(this.communicationManager), this.protocolConfig); + testRequestManager.ProcessTestRunAttachments(attachmentsProcessingPayload, new TestRunAttachmentsProcessingEventsHandler(this.communicationManager), this.protocolConfig); } catch (Exception ex) { - EqtTrace.Error("DesignModeClient: Exception in StartMultiTestRunFinalization: " + ex); + EqtTrace.Error("DesignModeClient: Exception in StartTestRunAttachmentsProcessing: " + ex); var testMessagePayload = new TestMessagePayload { MessageLevel = TestMessageLevel.Error, Message = ex.ToString() }; this.communicationManager.SendMessage(MessageType.TestMessage, testMessagePayload); - var payload = new MultiTestRunFinalizationCompletePayload() + var payload = new TestRunAttachmentsProcessingCompletePayload() { Attachments = null }; // Send run complete to translation layer - this.communicationManager.SendMessage(MessageType.MultiTestRunFinalizationComplete, payload); + this.communicationManager.SendMessage(MessageType.TestRunAttachmentsProcessingComplete, payload); } }); } diff --git a/src/Microsoft.TestPlatform.Client/RequestHelper/ITestRequestManager.cs b/src/Microsoft.TestPlatform.Client/RequestHelper/ITestRequestManager.cs index eb18c4fa0b..0a0e68e301 100644 --- a/src/Microsoft.TestPlatform.Client/RequestHelper/ITestRequestManager.cs +++ b/src/Microsoft.TestPlatform.Client/RequestHelper/ITestRequestManager.cs @@ -45,11 +45,11 @@ public interface ITestRequestManager : IDisposable void RunTests(TestRunRequestPayload testRunRequestPayLoad, ITestHostLauncher customTestHostLauncher, ITestRunEventsRegistrar testRunEventsRegistrar, ProtocolConfig protocolConfig); /// - /// Finalize multi test run + /// Processes test run attachments /// - /// Multi test run finalization payload - /// Multi test run finalization events handler - void FinalizeMultiTestRun(MultiTestRunFinalizationPayload multiTestRunFinalizationPayload, IMultiTestRunFinalizationEventsHandler multiTestRunFinalizationEventsHandler, ProtocolConfig protocolConfig); + /// Test run attachments processing payload + /// Test run attachments processing events handler + void ProcessTestRunAttachments(TestRunAttachmentsProcessingPayload testRunAttachmentsProcessingPayload, ITestRunAttachmentsProcessingEventsHandler testRunAttachmentsProcessingEventsHandler, ProtocolConfig protocolConfig); /// /// Cancel the current TestRun request @@ -67,8 +67,8 @@ public interface ITestRequestManager : IDisposable void CancelDiscovery(); /// - /// Cancels the current multi test run finalization request + /// Cancels the current test run attachments processing request /// - void CancelMultiTestRunFinalization(); + void CancelTestRunAttachmentsProcessing(); } } diff --git a/src/Microsoft.TestPlatform.Common/Interfaces/Engine/IMultiTestRunFinalizationManager.cs b/src/Microsoft.TestPlatform.Common/Interfaces/Engine/ITestRunAttachmentsProcessingManager.cs similarity index 59% rename from src/Microsoft.TestPlatform.Common/Interfaces/Engine/IMultiTestRunFinalizationManager.cs rename to src/Microsoft.TestPlatform.Common/Interfaces/Engine/ITestRunAttachmentsProcessingManager.cs index d13ea35f71..d6b88d89c8 100644 --- a/src/Microsoft.TestPlatform.Common/Interfaces/Engine/IMultiTestRunFinalizationManager.cs +++ b/src/Microsoft.TestPlatform.Common/Interfaces/Engine/ITestRunAttachmentsProcessingManager.cs @@ -10,24 +10,24 @@ namespace Microsoft.VisualStudio.TestPlatform.ObjectModel.Engine { /// - /// Orchestrates multi test run finalization operations. + /// Orchestrates test run attachments processing operations. /// - internal interface IMultiTestRunFinalizationManager + internal interface ITestRunAttachmentsProcessingManager { /// - /// Finalizes multi test run and provides results through handler + /// Processes attachments and provides results through handler /// /// Collection of attachments - /// EventHandler for handling multi test run finalization event + /// EventHandler for handling test run attachments processing event /// Cancellation token - Task FinalizeMultiTestRunAsync(IRequestData requestData, IEnumerable attachments, IMultiTestRunFinalizationEventsHandler eventHandler, CancellationToken cancellationToken); + Task ProcessTestRunAttachmentsAsync(IRequestData requestData, IEnumerable attachments, ITestRunAttachmentsProcessingEventsHandler eventHandler, CancellationToken cancellationToken); /// - /// Finalizes multi test run + /// Processes attachments /// /// Collection of attachments /// Cancellation token /// Collection of attachments. - Task> FinalizeMultiTestRunAsync(IRequestData requestData, IEnumerable attachments, CancellationToken cancellationToken); + Task> ProcessTestRunAttachmentsAsync(IRequestData requestData, IEnumerable attachments, CancellationToken cancellationToken); } } diff --git a/src/Microsoft.TestPlatform.Common/Telemetry/TelemetryDataConstants.cs b/src/Microsoft.TestPlatform.Common/Telemetry/TelemetryDataConstants.cs index 671350a63e..be35c610c2 100644 --- a/src/Microsoft.TestPlatform.Common/Telemetry/TelemetryDataConstants.cs +++ b/src/Microsoft.TestPlatform.Common/Telemetry/TelemetryDataConstants.cs @@ -90,19 +90,19 @@ public static class TelemetryDataConstants public static string NumberOfAdapterUsedToDiscoverTests = "VS.TestDiscovery.AdaptersUsedCount"; - // *********************Finalization**************************** - public static string NumberOfAttachmentsSentForFinalization = "VS.TestFinalization.InitialAttachmentsCount"; + // *********************Attachments Processing**************************** + public static string NumberOfAttachmentsSentForProcessing = "VS.AttachmentsProcessing.InitialAttachmentsCount"; - public static string NumberOfAttachmentsAfterFinalization = "VS.TestFinalization.FinalAttachmentsCount"; + public static string NumberOfAttachmentsAfterProcessing = "VS.AttachmentsProcessing.FinalAttachmentsCount"; - public static string TimeTakenInSecForFinalization = "VS.TestFinalization.TotalTimeTakenInSec"; - public static string FinalizationState = "VS.TestFinalization.FinalizationState"; + public static string TimeTakenInSecForAttachmentsProcessing = "VS.AttachmentsProcessing.TotalTimeTakenInSec"; + public static string AttachmentsProcessingState = "VS.AttachmentsProcessing.State"; // **************Events Name ********************************** public static string TestDiscoveryCompleteEvent = "vs/testplatform/testdiscoverysession"; public static string TestExecutionCompleteEvent = "vs/testplatform/testrunsession"; - public static string TestFinalizationCompleteEvent = "vs/testplatform/testfinalizationsession"; + public static string TestAttachmentsProcessingCompleteEvent = "vs/testplatform/testattachmentsprocessingsession"; } } diff --git a/src/Microsoft.TestPlatform.CommunicationUtilities/Messages/MessageType.cs b/src/Microsoft.TestPlatform.CommunicationUtilities/Messages/MessageType.cs index 802c8e5c87..76cfeec873 100644 --- a/src/Microsoft.TestPlatform.CommunicationUtilities/Messages/MessageType.cs +++ b/src/Microsoft.TestPlatform.CommunicationUtilities/Messages/MessageType.cs @@ -124,24 +124,24 @@ public static class MessageType public const string CustomTestHostLaunchCallback = "TestExecution.CustomTestHostLaunchCallback"; /// - /// Multi test run finalization + /// Test run attachments processing /// - public const string MultiTestRunFinalizationStart = "MultiTestRunFinalization.Start"; + public const string TestRunAttachmentsProcessingStart = "TestRunAttachmentsProcessing.Start"; /// - /// Multi test run finalization callback + /// Test run attachments processing callback /// - public const string MultiTestRunFinalizationComplete = "MultiTestRunFinalization.Complete"; + public const string TestRunAttachmentsProcessingComplete = "TestRunAttachmentsProcessing.Complete"; /// - /// Multi test run finalization progress + /// Test run attachments processing progress /// - public const string MultiTestRunFinalizationProgress = "MultiTestRunFinalization.Progress"; + public const string TestRunAttachmentsProcessingProgress = "TestRunAttachmentsProcessing.Progress"; /// - /// Cancel multi test run finalization + /// Cancel test run attachments processing /// - public const string MultiTestRunFinalizationCancel = "MultiTestRunFinalization.Cancel"; + public const string TestRunAttachmentsProcessingCancel = "TestRunAttachmentsProcessing.Cancel"; /// /// Extensions Initialization diff --git a/src/Microsoft.TestPlatform.CommunicationUtilities/Messages/MultiTestRunFinalizationCompletePayload.cs b/src/Microsoft.TestPlatform.CommunicationUtilities/Messages/TestRunAttachmentsProcessingCompletePayload.cs similarity index 68% rename from src/Microsoft.TestPlatform.CommunicationUtilities/Messages/MultiTestRunFinalizationCompletePayload.cs rename to src/Microsoft.TestPlatform.CommunicationUtilities/Messages/TestRunAttachmentsProcessingCompletePayload.cs index 4d9ef24169..40ac9c4c8b 100644 --- a/src/Microsoft.TestPlatform.CommunicationUtilities/Messages/MultiTestRunFinalizationCompletePayload.cs +++ b/src/Microsoft.TestPlatform.CommunicationUtilities/Messages/TestRunAttachmentsProcessingCompletePayload.cs @@ -9,14 +9,14 @@ namespace Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.ObjectModel using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client; /// - /// Multi test run finalization complete payload. + /// Test run attachments processing complete payload. /// - public class MultiTestRunFinalizationCompletePayload + public class TestRunAttachmentsProcessingCompletePayload { /// - /// Gets or sets the multi test run finalization complete args. + /// Gets or sets the test run attachments processing complete args. /// - public MultiTestRunFinalizationCompleteEventArgs FinalizationCompleteEventArgs { get; set; } + public TestRunAttachmentsProcessingCompleteEventArgs AttachmentsProcessingCompleteEventArgs { get; set; } /// /// Gets or sets the attachments. diff --git a/src/Microsoft.TestPlatform.CommunicationUtilities/Messages/MultiTestRunFinalizationProgressPayload.cs b/src/Microsoft.TestPlatform.CommunicationUtilities/Messages/TestRunAttachmentsProcessingProgressPayload.cs similarity index 57% rename from src/Microsoft.TestPlatform.CommunicationUtilities/Messages/MultiTestRunFinalizationProgressPayload.cs rename to src/Microsoft.TestPlatform.CommunicationUtilities/Messages/TestRunAttachmentsProcessingProgressPayload.cs index 6190ada03c..80082ae30d 100644 --- a/src/Microsoft.TestPlatform.CommunicationUtilities/Messages/MultiTestRunFinalizationProgressPayload.cs +++ b/src/Microsoft.TestPlatform.CommunicationUtilities/Messages/TestRunAttachmentsProcessingProgressPayload.cs @@ -6,13 +6,13 @@ namespace Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.ObjectModel using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client; /// - /// Multi test run finalization complete payload. + /// Test run attachments processing complete payload. /// - public class MultiTestRunFinalizationProgressPayload + public class TestRunAttachmentsProcessingProgressPayload { /// - /// Gets or sets the multi test run finalization complete args. + /// Gets or sets the test run attachments processing complete args. /// - public MultiTestRunFinalizationProgressEventArgs FinalizationProgressEventArgs { get; set; } + public TestRunAttachmentsProcessingProgressEventArgs AttachmentsProcessingProgressEventArgs { get; set; } } } diff --git a/src/Microsoft.TestPlatform.CoreUtilities/Tracing/Interfaces/ITestPlatformEventSource.cs b/src/Microsoft.TestPlatform.CoreUtilities/Tracing/Interfaces/ITestPlatformEventSource.cs index 262803cf48..7f88ccbf83 100644 --- a/src/Microsoft.TestPlatform.CoreUtilities/Tracing/Interfaces/ITestPlatformEventSource.cs +++ b/src/Microsoft.TestPlatform.CoreUtilities/Tracing/Interfaces/ITestPlatformEventSource.cs @@ -184,39 +184,39 @@ public interface ITestPlatformEventSource void MetricsDisposeStop(); /// - /// The multi test run finalization request start. + /// The test run attachments processing request start. /// - void MultiTestRunFinalizationRequestStart(); + void TestRunAttachmentsProcessingRequestStart(); /// - /// The multi test run finalization request stop. + /// The test run attachments processing request stop. /// - void MultiTestRunFinalizationRequestStop(); + void TestRunAttachmentsProcessingRequestStop(); /// - /// The multi test run finalization start. + /// The test run attachments processing start. /// /// /// The number of attachments. /// - void MultiTestRunFinalizationStart(long numberOfAttachments); + void TestRunAttachmentsProcessingStart(long numberOfAttachments); /// - /// The multi test run finalization stop. + /// The test run attachments processing stop. /// /// /// The number of attachments. /// - void MultiTestRunFinalizationStop(long numberOfAttachments); + void TestRunAttachmentsProcessingStop(long numberOfAttachments); /// - /// Mark the start of translation layer multi test run finalization request. + /// Mark the start of translation layer test run attachments processing request. /// - void TranslationLayerMultiTestRunFinalizationStart(); + void TranslationLayerTestRunAttachmentsProcessingStart(); /// - /// Mark the completion of translation layer multi test run finalization request. + /// Mark the completion of translation layer test run attachments processing request. /// - void TranslationLayerMultiTestRunFinalizationStop(); + void TranslationLayerTestRunAttachmentsProcessingStop(); } } diff --git a/src/Microsoft.TestPlatform.CoreUtilities/Tracing/TestPlatformEventSource.cs b/src/Microsoft.TestPlatform.CoreUtilities/Tracing/TestPlatformEventSource.cs index cf7a4f5845..74adb6a2af 100644 --- a/src/Microsoft.TestPlatform.CoreUtilities/Tracing/TestPlatformEventSource.cs +++ b/src/Microsoft.TestPlatform.CoreUtilities/Tracing/TestPlatformEventSource.cs @@ -239,45 +239,45 @@ public void MetricsDisposeStop() } /// - [Event(TestPlatformInstrumentationEvents.MultiTestRunFinalizationRequestStartEventId)] - public void MultiTestRunFinalizationRequestStart() + [Event(TestPlatformInstrumentationEvents.TestRunAttachmentsProcessingRequestStartEventId)] + public void TestRunAttachmentsProcessingRequestStart() { - this.WriteEvent(TestPlatformInstrumentationEvents.MultiTestRunFinalizationRequestStartEventId); + this.WriteEvent(TestPlatformInstrumentationEvents.TestRunAttachmentsProcessingRequestStartEventId); } /// - [Event(TestPlatformInstrumentationEvents.MultiTestRunFinalizationRequestStopEventId)] - public void MultiTestRunFinalizationRequestStop() + [Event(TestPlatformInstrumentationEvents.TestRunAttachmentsProcessingRequestStopEventId)] + public void TestRunAttachmentsProcessingRequestStop() { - this.WriteEvent(TestPlatformInstrumentationEvents.MultiTestRunFinalizationRequestStopEventId); + this.WriteEvent(TestPlatformInstrumentationEvents.TestRunAttachmentsProcessingRequestStopEventId); } /// - [Event(TestPlatformInstrumentationEvents.MultiTestRunFinalizationStartEventId)] - public void MultiTestRunFinalizationStart(long numberOfAttachments) + [Event(TestPlatformInstrumentationEvents.TestRunAttachmentsProcessingStartEventId)] + public void TestRunAttachmentsProcessingStart(long numberOfAttachments) { - this.WriteEvent(TestPlatformInstrumentationEvents.MultiTestRunFinalizationStartEventId, numberOfAttachments); + this.WriteEvent(TestPlatformInstrumentationEvents.TestRunAttachmentsProcessingStartEventId, numberOfAttachments); } /// - [Event(TestPlatformInstrumentationEvents.MultiTestRunFinalizationStopEventId)] - public void MultiTestRunFinalizationStop(long numberOfAttachments) + [Event(TestPlatformInstrumentationEvents.TestRunAttachmentsProcessingStopEventId)] + public void TestRunAttachmentsProcessingStop(long numberOfAttachments) { - this.WriteEvent(TestPlatformInstrumentationEvents.MultiTestRunFinalizationStopEventId, numberOfAttachments); + this.WriteEvent(TestPlatformInstrumentationEvents.TestRunAttachmentsProcessingStopEventId, numberOfAttachments); } /// - [Event(TestPlatformInstrumentationEvents.TranslationLayerMultiTestRunFinalizationStartEventId)] - public void TranslationLayerMultiTestRunFinalizationStart() + [Event(TestPlatformInstrumentationEvents.TranslationLayerTestRunAttachmentsProcessingStartEventId)] + public void TranslationLayerTestRunAttachmentsProcessingStart() { - this.WriteEvent(TestPlatformInstrumentationEvents.TranslationLayerMultiTestRunFinalizationStartEventId); + this.WriteEvent(TestPlatformInstrumentationEvents.TranslationLayerTestRunAttachmentsProcessingStartEventId); } /// - [Event(TestPlatformInstrumentationEvents.TranslationLayerMultiTestRunFinalizationStopEventId)] - public void TranslationLayerMultiTestRunFinalizationStop() + [Event(TestPlatformInstrumentationEvents.TranslationLayerTestRunAttachmentsProcessingStopEventId)] + public void TranslationLayerTestRunAttachmentsProcessingStop() { - this.WriteEvent(TestPlatformInstrumentationEvents.TranslationLayerMultiTestRunFinalizationStopEventId); + this.WriteEvent(TestPlatformInstrumentationEvents.TranslationLayerTestRunAttachmentsProcessingStopEventId); } } } diff --git a/src/Microsoft.TestPlatform.CoreUtilities/Tracing/TestPlatformInstrumentationEvents.cs b/src/Microsoft.TestPlatform.CoreUtilities/Tracing/TestPlatformInstrumentationEvents.cs index 2fa7f1e87a..1aa2311048 100644 --- a/src/Microsoft.TestPlatform.CoreUtilities/Tracing/TestPlatformInstrumentationEvents.cs +++ b/src/Microsoft.TestPlatform.CoreUtilities/Tracing/TestPlatformInstrumentationEvents.cs @@ -159,33 +159,33 @@ internal class TestPlatformInstrumentationEvents public const int MetricsDisposeStopEventId = 0x39; /// - /// The session finalization start event id. + /// The session attachments processing start event id. /// - public const int MultiTestRunFinalizationStartEventId = 0x40; + public const int TestRunAttachmentsProcessingStartEventId = 0x40; /// - /// The session finalization stop event id. + /// The session attachments processing stop event id. /// - public const int MultiTestRunFinalizationStopEventId = 0x41; + public const int TestRunAttachmentsProcessingStopEventId = 0x41; /// - /// The session finalization request start event id. + /// The session attachments processing request start event id. /// - public const int MultiTestRunFinalizationRequestStartEventId = 0x42; + public const int TestRunAttachmentsProcessingRequestStartEventId = 0x42; /// - /// The session finalization request stop event id. + /// The session attachments processing request stop event id. /// - public const int MultiTestRunFinalizationRequestStopEventId = 0x43; + public const int TestRunAttachmentsProcessingRequestStopEventId = 0x43; /// - /// Events fired on session finalization start of translation layer. + /// Events fired on session attachments processing start of translation layer. /// - public const int TranslationLayerMultiTestRunFinalizationStartEventId = 0x44; + public const int TranslationLayerTestRunAttachmentsProcessingStartEventId = 0x44; /// - /// Events fired on session finalization complete in translation layer. + /// Events fired on session attachments processing complete in translation layer. /// - public const int TranslationLayerMultiTestRunFinalizationStopEventId = 0x45; + public const int TranslationLayerTestRunAttachmentsProcessingStopEventId = 0x45; } } \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/MultiTestRunFinalization/MultiTestRunFinalizationManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/AttachmentsProcessing/TestRunAttachmentsProcessingManager.cs similarity index 56% rename from src/Microsoft.TestPlatform.CrossPlatEngine/MultiTestRunFinalization/MultiTestRunFinalizationManager.cs rename to src/Microsoft.TestPlatform.CrossPlatEngine/AttachmentsProcessing/TestRunAttachmentsProcessingManager.cs index d98e034d5c..6eff75838a 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/MultiTestRunFinalization/MultiTestRunFinalizationManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/AttachmentsProcessing/TestRunAttachmentsProcessingManager.cs @@ -16,48 +16,48 @@ using Microsoft.VisualStudio.TestPlatform.ObjectModel.Engine; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging; -namespace Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.MultiTestRunFinalization +namespace Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.TestRunAttachmentsProcessing { /// - /// Orchestrates multi test run finalization operations. + /// Orchestrates test run attachments processing operations. /// - public class MultiTestRunFinalizationManager : IMultiTestRunFinalizationManager + public class TestRunAttachmentsProcessingManager : ITestRunAttachmentsProcessingManager { - private static string FinalizationCompleted = "Completed"; - private static string FinalizationCanceled = "Canceled"; - private static string FinalizationFailed = "Failed"; + private static string AttachmentsProcessingCompleted = "Completed"; + private static string AttachmentsProcessingCanceled = "Canceled"; + private static string AttachmentsProcessingFailed = "Failed"; private readonly ITestPlatformEventSource testPlatformEventSource; private readonly IDataCollectorAttachmentProcessor[] dataCollectorAttachmentsProcessors; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// - public MultiTestRunFinalizationManager(ITestPlatformEventSource testPlatformEventSource, params IDataCollectorAttachmentProcessor[] dataCollectorAttachmentsProcessors) + public TestRunAttachmentsProcessingManager(ITestPlatformEventSource testPlatformEventSource, params IDataCollectorAttachmentProcessor[] dataCollectorAttachmentsProcessors) { this.testPlatformEventSource = testPlatformEventSource ?? throw new ArgumentNullException(nameof(testPlatformEventSource)); this.dataCollectorAttachmentsProcessors = dataCollectorAttachmentsProcessors ?? throw new ArgumentNullException(nameof(dataCollectorAttachmentsProcessors)); } /// - public async Task FinalizeMultiTestRunAsync(IRequestData requestData, IEnumerable attachments, IMultiTestRunFinalizationEventsHandler eventHandler, CancellationToken cancellationToken) + public async Task ProcessTestRunAttachmentsAsync(IRequestData requestData, IEnumerable attachments, ITestRunAttachmentsProcessingEventsHandler eventHandler, CancellationToken cancellationToken) { - await InternalFinalizeMultiTestRunAsync(requestData, new Collection(attachments.ToList()), eventHandler, cancellationToken).ConfigureAwait(false); + await InternalProcessTestRunAttachmentsAsync(requestData, new Collection(attachments.ToList()), eventHandler, cancellationToken).ConfigureAwait(false); } /// - public Task> FinalizeMultiTestRunAsync(IRequestData requestData, IEnumerable attachments, CancellationToken cancellationToken) + public Task> ProcessTestRunAttachmentsAsync(IRequestData requestData, IEnumerable attachments, CancellationToken cancellationToken) { - return InternalFinalizeMultiTestRunAsync(requestData, new Collection(attachments.ToList()), null, cancellationToken); + return InternalProcessTestRunAttachmentsAsync(requestData, new Collection(attachments.ToList()), null, cancellationToken); } - private async Task> InternalFinalizeMultiTestRunAsync(IRequestData requestData, Collection attachments, IMultiTestRunFinalizationEventsHandler eventHandler, CancellationToken cancellationToken) + private async Task> InternalProcessTestRunAttachmentsAsync(IRequestData requestData, Collection attachments, ITestRunAttachmentsProcessingEventsHandler eventHandler, CancellationToken cancellationToken) { Stopwatch stopwatch = Stopwatch.StartNew(); try { - testPlatformEventSource.MultiTestRunFinalizationStart(attachments?.Count ?? 0); - requestData.MetricsCollection.Add(TelemetryDataConstants.NumberOfAttachmentsSentForFinalization, attachments?.Count ?? 0); + testPlatformEventSource.TestRunAttachmentsProcessingStart(attachments?.Count ?? 0); + requestData.MetricsCollection.Add(TelemetryDataConstants.NumberOfAttachmentsSentForProcessing, attachments?.Count ?? 0); cancellationToken.ThrowIfCancellationRequested(); @@ -70,12 +70,12 @@ private async Task> InternalFinalizeMultiTestRunAsync( if (completedTask == task) { - return FinalizeOperation(requestData, new MultiTestRunFinalizationCompleteEventArgs(false, null), await task, stopwatch, eventHandler); + return FinalizeOperation(requestData, new TestRunAttachmentsProcessingCompleteEventArgs(false, null), await task, stopwatch, eventHandler); } else { - eventHandler?.HandleLogMessage(TestMessageLevel.Informational, "Finalization was cancelled."); - return FinalizeOperation(requestData, new MultiTestRunFinalizationCompleteEventArgs(true, null), attachments, stopwatch, eventHandler); + eventHandler?.HandleLogMessage(TestMessageLevel.Informational, "Attachments processing was cancelled."); + return FinalizeOperation(requestData, new TestRunAttachmentsProcessingCompleteEventArgs(true, null), attachments, stopwatch, eventHandler); } } } @@ -83,20 +83,20 @@ private async Task> InternalFinalizeMultiTestRunAsync( { if (EqtTrace.IsWarningEnabled) { - EqtTrace.Warning("MultiTestRunFinalizationManager: operation was cancelled."); + EqtTrace.Warning("TestRunAttachmentsProcessingManager: operation was cancelled."); } - return FinalizeOperation(requestData, new MultiTestRunFinalizationCompleteEventArgs(true, null), attachments, stopwatch, eventHandler); + return FinalizeOperation(requestData, new TestRunAttachmentsProcessingCompleteEventArgs(true, null), attachments, stopwatch, eventHandler); } catch (Exception e) { - EqtTrace.Error("MultiTestRunFinalizationManager: Exception in FinalizeMultiTestRunAsync: " + e); + EqtTrace.Error("TestRunAttachmentsProcessingManager: Exception in ProcessTestRunAttachmentsAsync: " + e); eventHandler?.HandleLogMessage(TestMessageLevel.Error, e.Message); - return FinalizeOperation(requestData, new MultiTestRunFinalizationCompleteEventArgs(false, e), attachments, stopwatch, eventHandler); + return FinalizeOperation(requestData, new TestRunAttachmentsProcessingCompleteEventArgs(false, e), attachments, stopwatch, eventHandler); } } - private async Task> ProcessAttachmentsAsync(Collection attachments, IMultiTestRunFinalizationEventsHandler eventsHandler, CancellationToken cancellationToken) + private async Task> ProcessAttachmentsAsync(Collection attachments, ITestRunAttachmentsProcessingEventsHandler eventsHandler, CancellationToken cancellationToken) { if (attachments == null || !attachments.Any()) return attachments; @@ -119,8 +119,8 @@ private async Task> ProcessAttachmentsAsync(Collection } IProgress progressReporter = new Progress((int progress) => - eventsHandler?.HandleMultiTestRunFinalizationProgress( - new MultiTestRunFinalizationProgressEventArgs(attachmentsHandlerIndex, attachmentProcessorUris, progress, dataCollectorAttachmentsProcessors.Length))); + eventsHandler?.HandleTestRunAttachmentsProcessingProgress( + new TestRunAttachmentsProcessingProgressEventArgs(attachmentsHandlerIndex, attachmentProcessorUris, progress, dataCollectorAttachmentsProcessors.Length))); ICollection processedAttachments = await dataCollectorAttachmentsProcessor.ProcessAttachmentSetsAsync(new Collection(attachmentsToBeProcessed), progressReporter, logger, cancellationToken).ConfigureAwait(false); @@ -135,31 +135,31 @@ private async Task> ProcessAttachmentsAsync(Collection return attachments; } - private Collection FinalizeOperation(IRequestData requestData, MultiTestRunFinalizationCompleteEventArgs completeArgs, Collection attachments, Stopwatch stopwatch, IMultiTestRunFinalizationEventsHandler eventHandler) + private Collection FinalizeOperation(IRequestData requestData, TestRunAttachmentsProcessingCompleteEventArgs completeArgs, Collection attachments, Stopwatch stopwatch, ITestRunAttachmentsProcessingEventsHandler eventHandler) { - testPlatformEventSource.MultiTestRunFinalizationStop(attachments.Count); - requestData.MetricsCollection.Add(TelemetryDataConstants.NumberOfAttachmentsAfterFinalization, attachments.Count); - requestData.MetricsCollection.Add(TelemetryDataConstants.FinalizationState, completeArgs.Error != null ? FinalizationFailed : completeArgs.IsCanceled ? FinalizationCanceled : FinalizationCompleted); + testPlatformEventSource.TestRunAttachmentsProcessingStop(attachments.Count); + requestData.MetricsCollection.Add(TelemetryDataConstants.NumberOfAttachmentsAfterProcessing, attachments.Count); + requestData.MetricsCollection.Add(TelemetryDataConstants.AttachmentsProcessingState, completeArgs.Error != null ? AttachmentsProcessingFailed : completeArgs.IsCanceled ? AttachmentsProcessingCanceled : AttachmentsProcessingCompleted); stopwatch.Stop(); - requestData.MetricsCollection.Add(TelemetryDataConstants.TimeTakenInSecForFinalization, stopwatch.Elapsed.TotalSeconds); + requestData.MetricsCollection.Add(TelemetryDataConstants.TimeTakenInSecForAttachmentsProcessing, stopwatch.Elapsed.TotalSeconds); completeArgs.Metrics = requestData.MetricsCollection.Metrics; - eventHandler?.HandleMultiTestRunFinalizationComplete(completeArgs, attachments); + eventHandler?.HandleTestRunAttachmentsProcessingComplete(completeArgs, attachments); return attachments; } - private IMessageLogger CreateMessageLogger(IMultiTestRunFinalizationEventsHandler eventsHandler) + private IMessageLogger CreateMessageLogger(ITestRunAttachmentsProcessingEventsHandler eventsHandler) { - return eventsHandler != null ? (IMessageLogger)new FinalizationMessageLogger(eventsHandler) : new NullMessageLogger(); + return eventsHandler != null ? (IMessageLogger)new AttachmentsProcessingMessageLogger(eventsHandler) : new NullMessageLogger(); } - private class FinalizationMessageLogger : IMessageLogger + private class AttachmentsProcessingMessageLogger : IMessageLogger { - private readonly IMultiTestRunFinalizationEventsHandler eventsHandler; + private readonly ITestRunAttachmentsProcessingEventsHandler eventsHandler; - public FinalizationMessageLogger(IMultiTestRunFinalizationEventsHandler eventsHandler) + public AttachmentsProcessingMessageLogger(ITestRunAttachmentsProcessingEventsHandler eventsHandler) { this.eventsHandler = eventsHandler ?? throw new ArgumentNullException(nameof(eventsHandler)); } diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/ParallelProxyExecutionManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/ParallelProxyExecutionManager.cs index 86df14a387..d5cc0cecb4 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/ParallelProxyExecutionManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/ParallelProxyExecutionManager.cs @@ -16,7 +16,7 @@ namespace Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.Parallel using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.ObjectModel; using Microsoft.VisualStudio.TestPlatform.CoreUtilities.Tracing; using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.DataCollection; - using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.MultiTestRunFinalization; + using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.TestRunAttachmentsProcessing; using Microsoft.VisualStudio.TestPlatform.ObjectModel; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Engine; @@ -262,7 +262,7 @@ private ParallelRunEventsHandler GetEventsHandler(IProxyExecutionManager concurr var concurrentManagerWithDataCollection = concurrentManager as ProxyExecutionManagerWithDataCollection; // TODO : use TestPluginCache to iterate over all IDataCollectorAttachments - var finalizationManager = new MultiTestRunFinalizationManager(TestPlatformEventSource.Instance, new CodeCoverageDataAttachmentsHandler()); + var attachmentsProcessingManager = new TestRunAttachmentsProcessingManager(TestPlatformEventSource.Instance, new CodeCoverageDataAttachmentsHandler()); return new ParallelDataCollectionEventsHandler( this.requestData, @@ -270,7 +270,7 @@ private ParallelRunEventsHandler GetEventsHandler(IProxyExecutionManager concurr this.currentRunEventsHandler, this, this.currentRunDataAggregator, - finalizationManager, + attachmentsProcessingManager, concurrentManagerWithDataCollection.CancellationToken); } diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/ParallelDataCollectionEventsHandler.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/ParallelDataCollectionEventsHandler.cs index f6c2ea0829..a50d5fe6ff 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/ParallelDataCollectionEventsHandler.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/ParallelDataCollectionEventsHandler.cs @@ -16,7 +16,7 @@ namespace Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.DataCollection internal class ParallelDataCollectionEventsHandler : ParallelRunEventsHandler { private readonly ParallelRunDataAggregator runDataAggregator; - private readonly IMultiTestRunFinalizationManager finalizationManager; + private readonly ITestRunAttachmentsProcessingManager attachmentsProcessingManager; private readonly CancellationToken cancellationToken; public ParallelDataCollectionEventsHandler(IRequestData requestData, @@ -24,11 +24,11 @@ public ParallelDataCollectionEventsHandler(IRequestData requestData, ITestRunEventsHandler actualRunEventsHandler, IParallelProxyExecutionManager parallelProxyExecutionManager, ParallelRunDataAggregator runDataAggregator, - IMultiTestRunFinalizationManager finalizationManager, + ITestRunAttachmentsProcessingManager attachmentsProcessingManager, CancellationToken cancellationToken) : this(requestData, proxyExecutionManager, actualRunEventsHandler, parallelProxyExecutionManager, runDataAggregator, JsonDataSerializer.Instance) { - this.finalizationManager = finalizationManager; + this.attachmentsProcessingManager = attachmentsProcessingManager; this.cancellationToken = cancellationToken; } @@ -56,7 +56,7 @@ public override void HandleTestRunComplete( if (parallelRunComplete) { - runDataAggregator.RunContextAttachments = finalizationManager.FinalizeMultiTestRunAsync(requestData, runDataAggregator.RunContextAttachments, cancellationToken).Result ?? runDataAggregator.RunContextAttachments; + runDataAggregator.RunContextAttachments = attachmentsProcessingManager.ProcessTestRunAttachmentsAsync(requestData, runDataAggregator.RunContextAttachments, cancellationToken).Result ?? runDataAggregator.RunContextAttachments; var completedArgs = new TestRunCompleteEventArgs(this.runDataAggregator.GetAggregatedRunStats(), this.runDataAggregator.IsCanceled, diff --git a/src/Microsoft.TestPlatform.ObjectModel/Client/Events/MultiTestRunFinalizationCompleteEventArgs.cs b/src/Microsoft.TestPlatform.ObjectModel/Client/Events/TestRunAttachmentsProcessingCompleteEventArgs.cs similarity index 65% rename from src/Microsoft.TestPlatform.ObjectModel/Client/Events/MultiTestRunFinalizationCompleteEventArgs.cs rename to src/Microsoft.TestPlatform.ObjectModel/Client/Events/TestRunAttachmentsProcessingCompleteEventArgs.cs index 0ca669e6a1..b5e446ff68 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Client/Events/MultiTestRunFinalizationCompleteEventArgs.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/Client/Events/TestRunAttachmentsProcessingCompleteEventArgs.cs @@ -8,27 +8,27 @@ namespace Microsoft.VisualStudio.TestPlatform.ObjectModel.Client using System.Runtime.Serialization; [DataContract] - public class MultiTestRunFinalizationCompleteEventArgs : EventArgs + public class TestRunAttachmentsProcessingCompleteEventArgs : EventArgs { /// /// Default constructor. /// - /// Specifies whether the finalization is canceled. - /// Specifies the error encountered during the execution of the finalization. - public MultiTestRunFinalizationCompleteEventArgs(bool isCanceled, Exception error) + /// Specifies whether the attachments processing is canceled. + /// Specifies the error encountered during the execution of the attachments processing. + public TestRunAttachmentsProcessingCompleteEventArgs(bool isCanceled, Exception error) { this.IsCanceled = isCanceled; this.Error = error; } /// - /// Gets a value indicating whether the finalization is canceled or not. + /// Gets a value indicating whether the attachments processing is canceled or not. /// [DataMember] public bool IsCanceled { get; private set; } /// - /// Gets the error encountered during the finalization of the test runs. Null if there is no error. + /// Gets the error encountered during the attachments processing of the test runs. Null if there is no error. /// [DataMember] public Exception Error { get; private set; } diff --git a/src/Microsoft.TestPlatform.ObjectModel/Client/Events/MultiTestRunFinalizationProgressEventArgs.cs b/src/Microsoft.TestPlatform.ObjectModel/Client/Events/TestRunAttachmentsProcessingProgressEventArgs.cs similarity index 87% rename from src/Microsoft.TestPlatform.ObjectModel/Client/Events/MultiTestRunFinalizationProgressEventArgs.cs rename to src/Microsoft.TestPlatform.ObjectModel/Client/Events/TestRunAttachmentsProcessingProgressEventArgs.cs index 9710add944..8218336e5b 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Client/Events/MultiTestRunFinalizationProgressEventArgs.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/Client/Events/TestRunAttachmentsProcessingProgressEventArgs.cs @@ -8,7 +8,7 @@ namespace Microsoft.VisualStudio.TestPlatform.ObjectModel.Client using System.Runtime.Serialization; [DataContract] - public class MultiTestRunFinalizationProgressEventArgs : EventArgs + public class TestRunAttachmentsProcessingProgressEventArgs : EventArgs { /// /// Default constructor. @@ -17,7 +17,7 @@ public class MultiTestRunFinalizationProgressEventArgs : EventArgs /// Specifies current processor Uris. /// Specifies current processor progress. /// Specifies the overall number of processors. - public MultiTestRunFinalizationProgressEventArgs(long currentAttachmentProcessorIndex, ICollection currentAttachmentProcessorUris, long currentAttachmentProcessorProgress, long attachmentProcessorsCount) + public TestRunAttachmentsProcessingProgressEventArgs(long currentAttachmentProcessorIndex, ICollection currentAttachmentProcessorUris, long currentAttachmentProcessorProgress, long attachmentProcessorsCount) { CurrentAttachmentProcessorIndex = currentAttachmentProcessorIndex; CurrentAttachmentProcessorUris = currentAttachmentProcessorUris; diff --git a/src/Microsoft.TestPlatform.ObjectModel/Client/Interfaces/IMultiTestRunFinalizationEventsHandler.cs b/src/Microsoft.TestPlatform.ObjectModel/Client/Interfaces/IMultiTestRunFinalizationEventsHandler.cs deleted file mode 100644 index 3983bd571e..0000000000 --- a/src/Microsoft.TestPlatform.ObjectModel/Client/Interfaces/IMultiTestRunFinalizationEventsHandler.cs +++ /dev/null @@ -1,32 +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; - -namespace Microsoft.VisualStudio.TestPlatform.ObjectModel.Client -{ - /// - /// Interface contract for handling multi test run finalization events - /// - public interface IMultiTestRunFinalizationEventsHandler : ITestMessageEventHandler - { - /// - /// Dispatch MultiTestRunFinalizationComplete event to listeners. - /// - /// Finalization Complete event args. - /// Last set of processed attachment sets. - void HandleMultiTestRunFinalizationComplete(MultiTestRunFinalizationCompleteEventArgs finalizationCompleteEventArgs, IEnumerable lastChunk); - - /// - /// Dispatch ProcessedAttachmentsChunk event to listeners. - /// - /// Processed attachment sets. - void HandleProcessedAttachmentsChunk(IEnumerable attachments); - - /// - /// Dispatch MultiTestRunFinalizationProgress event to listeners. - /// - /// Finalization Progress event args. - void HandleMultiTestRunFinalizationProgress(MultiTestRunFinalizationProgressEventArgs finalizationProgressEventArgs); - } -} \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.ObjectModel/Client/Interfaces/ITestRunAttachmentsProcessingEventsHandler.cs b/src/Microsoft.TestPlatform.ObjectModel/Client/Interfaces/ITestRunAttachmentsProcessingEventsHandler.cs new file mode 100644 index 0000000000..f6235a92e9 --- /dev/null +++ b/src/Microsoft.TestPlatform.ObjectModel/Client/Interfaces/ITestRunAttachmentsProcessingEventsHandler.cs @@ -0,0 +1,32 @@ +// 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; + +namespace Microsoft.VisualStudio.TestPlatform.ObjectModel.Client +{ + /// + /// Interface contract for handling test run attachments processing events + /// + public interface ITestRunAttachmentsProcessingEventsHandler : ITestMessageEventHandler + { + /// + /// Dispatch TestRunAttachmentsProcessingComplete event to listeners. + /// + /// AttachmentsProcessing Complete event args. + /// Last set of processed attachment sets. + void HandleTestRunAttachmentsProcessingComplete(TestRunAttachmentsProcessingCompleteEventArgs attachmentsProcessingCompleteEventArgs, IEnumerable lastChunk); + + /// + /// Dispatch ProcessedAttachmentsChunk event to listeners. + /// + /// Processed attachment sets. + void HandleProcessedAttachmentsChunk(IEnumerable attachments); + + /// + /// Dispatch TestRunAttachmentsProcessingProgress event to listeners. + /// + /// AttachmentsProcessing Progress event args. + void HandleTestRunAttachmentsProcessingProgress(TestRunAttachmentsProcessingProgressEventArgs AttachmentsProcessingProgressEventArgs); + } +} \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.ObjectModel/Client/Payloads/MultiTestRunFinalizationPayload.cs b/src/Microsoft.TestPlatform.ObjectModel/Client/Payloads/TestRunAttachmentsProcessingPayload.cs similarity index 79% rename from src/Microsoft.TestPlatform.ObjectModel/Client/Payloads/MultiTestRunFinalizationPayload.cs rename to src/Microsoft.TestPlatform.ObjectModel/Client/Payloads/TestRunAttachmentsProcessingPayload.cs index 844b86e8dc..6abdb68082 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Client/Payloads/MultiTestRunFinalizationPayload.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/Client/Payloads/TestRunAttachmentsProcessingPayload.cs @@ -7,9 +7,9 @@ namespace Microsoft.VisualStudio.TestPlatform.ObjectModel.Client using System.Runtime.Serialization; /// - /// Class used to define the MultiTestRunFinalizationPayload sent by the Vstest.console translation layers into design mode + /// Class used to define the TestRunAttachmentsProcessingPayload sent by the Vstest.console translation layers into design mode /// - public class MultiTestRunFinalizationPayload + public class TestRunAttachmentsProcessingPayload { /// /// Collection of attachments. diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITranslationLayerRequestSenderAsync.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITranslationLayerRequestSenderAsync.cs index 19ef32c915..23166126d7 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITranslationLayerRequestSenderAsync.cs +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITranslationLayerRequestSenderAsync.cs @@ -53,8 +53,8 @@ internal interface ITranslationLayerRequestSenderAsync : IDisposable /// /// Collection of attachments /// Enables metrics collection - /// Events handler + /// Events handler /// Cancellation token - Task FinalizeMultiTestRunAsync(IEnumerable attachments, bool collectMetrics, IMultiTestRunFinalizationEventsHandler multiTestRunFinalizationCompleteEventsHandler, CancellationToken cancellationToken); + Task ProcessTestRunAttachmentsAsync(IEnumerable attachments, bool collectMetrics, ITestRunAttachmentsProcessingEventsHandler testRunAttachmentsProcessingCompleteEventsHandler, CancellationToken cancellationToken); } } diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/IVsTestConsoleWrapperAsync.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/IVsTestConsoleWrapperAsync.cs index 14b32ab427..9c5af36304 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/IVsTestConsoleWrapperAsync.cs +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/IVsTestConsoleWrapperAsync.cs @@ -100,7 +100,7 @@ public interface IVsTestConsoleWrapperAsync /// Enables metrics collection (used for telemetry) /// EventHandler to receive session complete event /// Cancellation token - Task FinalizeMultiTestRunAsync(IEnumerable attachments, bool multiTestRunCompleted, bool collectMetrics, IMultiTestRunFinalizationEventsHandler eventsHandler, CancellationToken cancellationToken); + Task ProcessTestRunAttachmentsAsync(IEnumerable attachments, bool multiTestRunCompleted, bool collectMetrics, ITestRunAttachmentsProcessingEventsHandler eventsHandler, CancellationToken cancellationToken); /// /// See . diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Resources/Resources.Designer.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Resources/Resources.Designer.cs index d20d874ef0..a218efe7f5 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Resources/Resources.Designer.cs +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Resources/Resources.Designer.cs @@ -62,11 +62,11 @@ internal Resources() { } /// - /// Looks up a localized string similar to The active Multi Test Runs Finalization was aborted.. + /// Looks up a localized string similar to The active Test Run Attachments Processing was aborted.. /// - public static string AbortedMultiTestRunFinalization { + public static string AbortedTestRunAttachmentsProcessing { get { - return ResourceManager.GetString("AbortedMultiTestRunFinalization", resourceCulture); + return ResourceManager.GetString("AbortedTestRunAttachmentsProcessing", resourceCulture); } } diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Resources/Resources.resx b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Resources/Resources.resx index ff17cc093a..eb053d0a74 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Resources/Resources.resx +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Resources/Resources.resx @@ -117,8 +117,8 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - The active Multi Test Runs Finalization was aborted. + + The active Test Run Attachments Processing was aborted. The active Tests Discovery was aborted. diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Resources/xlf/Resources.cs.xlf b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Resources/xlf/Resources.cs.xlf index 819e22e1d4..378546e5aa 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Resources/xlf/Resources.cs.xlf +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Resources/xlf/Resources.cs.xlf @@ -61,9 +61,9 @@ Soubor {0} neexistuje. - - The active Multi Test Runs Finalization was aborted. - The active Multi Test Runs Finalization was aborted. + + The active Test Run Attachments Processing was aborted. + The active Test Run Attachments Processing was aborted. diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Resources/xlf/Resources.de.xlf b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Resources/xlf/Resources.de.xlf index 0b8284ad05..ead9e18cd3 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Resources/xlf/Resources.de.xlf +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Resources/xlf/Resources.de.xlf @@ -61,9 +61,9 @@ Die Datei "{0}" ist nicht vorhanden. - - The active Multi Test Runs Finalization was aborted. - The active Multi Test Runs Finalization was aborted. + + The active Test Run Attachments Processing was aborted. + The active Test Run Attachments Processing was aborted. diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Resources/xlf/Resources.es.xlf b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Resources/xlf/Resources.es.xlf index c3f256ea4f..704f3fc1d1 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Resources/xlf/Resources.es.xlf +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Resources/xlf/Resources.es.xlf @@ -61,9 +61,9 @@ El archivo {0} no existe - - The active Multi Test Runs Finalization was aborted. - The active Multi Test Runs Finalization was aborted. + + The active Test Run Attachments Processing was aborted. + The active Test Run Attachments Processing was aborted. diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Resources/xlf/Resources.fr.xlf b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Resources/xlf/Resources.fr.xlf index 9a0dfc259c..788ee98fbb 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Resources/xlf/Resources.fr.xlf +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Resources/xlf/Resources.fr.xlf @@ -61,9 +61,9 @@ Le fichier {0} n'existe pas - - The active Multi Test Runs Finalization was aborted. - The active Multi Test Runs Finalization was aborted. + + The active Test Run Attachments Processing was aborted. + The active Test Run Attachments Processing was aborted. diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Resources/xlf/Resources.it.xlf b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Resources/xlf/Resources.it.xlf index 1928a75bf6..471c34b6ce 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Resources/xlf/Resources.it.xlf +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Resources/xlf/Resources.it.xlf @@ -61,9 +61,9 @@ Il file {0} non esiste - - The active Multi Test Runs Finalization was aborted. - The active Multi Test Runs Finalization was aborted. + + The active Test Run Attachments Processing was aborted. + The active Test Run Attachments Processing was aborted. diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Resources/xlf/Resources.ja.xlf b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Resources/xlf/Resources.ja.xlf index 0c65c579e2..9bbf726d85 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Resources/xlf/Resources.ja.xlf +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Resources/xlf/Resources.ja.xlf @@ -61,9 +61,9 @@ ファイル {0} が存在しません - - The active Multi Test Runs Finalization was aborted. - The active Multi Test Runs Finalization was aborted. + + The active Test Run Attachments Processing was aborted. + The active Test Run Attachments Processing was aborted. diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Resources/xlf/Resources.ko.xlf b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Resources/xlf/Resources.ko.xlf index 273ff35d2c..250d2e203d 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Resources/xlf/Resources.ko.xlf +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Resources/xlf/Resources.ko.xlf @@ -61,9 +61,9 @@ {0} 파일이 없습니다. - - The active Multi Test Runs Finalization was aborted. - The active Multi Test Runs Finalization was aborted. + + The active Test Run Attachments Processing was aborted. + The active Test Run Attachments Processing was aborted. diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Resources/xlf/Resources.pl.xlf b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Resources/xlf/Resources.pl.xlf index 59a2514c1a..d9a8a303ef 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Resources/xlf/Resources.pl.xlf +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Resources/xlf/Resources.pl.xlf @@ -61,9 +61,9 @@ Plik {0} nie istnieje - - The active Multi Test Runs Finalization was aborted. - The active Multi Test Runs Finalization was aborted. + + The active Test Run Attachments Processing was aborted. + The active Test Run Attachments Processing was aborted. diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Resources/xlf/Resources.pt-BR.xlf b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Resources/xlf/Resources.pt-BR.xlf index a2dfe8395f..ac67cd51d7 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Resources/xlf/Resources.pt-BR.xlf +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Resources/xlf/Resources.pt-BR.xlf @@ -61,9 +61,9 @@ O arquivo {0} não existe - - The active Multi Test Runs Finalization was aborted. - The active Multi Test Runs Finalization was aborted. + + The active Test Run Attachments Processing was aborted. + The active Test Run Attachments Processing was aborted. diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Resources/xlf/Resources.ru.xlf b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Resources/xlf/Resources.ru.xlf index d4c27e0dc4..40d4023b26 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Resources/xlf/Resources.ru.xlf +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Resources/xlf/Resources.ru.xlf @@ -61,9 +61,9 @@ Файл {0} не существует. - - The active Multi Test Runs Finalization was aborted. - The active Multi Test Runs Finalization was aborted. + + The active Test Run Attachments Processing was aborted. + The active Test Run Attachments Processing was aborted. diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Resources/xlf/Resources.tr.xlf b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Resources/xlf/Resources.tr.xlf index 8bc197a0b0..f1817063cc 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Resources/xlf/Resources.tr.xlf +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Resources/xlf/Resources.tr.xlf @@ -61,9 +61,9 @@ {0} dosyası yok - - The active Multi Test Runs Finalization was aborted. - The active Multi Test Runs Finalization was aborted. + + The active Test Run Attachments Processing was aborted. + The active Test Run Attachments Processing was aborted. diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Resources/xlf/Resources.xlf b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Resources/xlf/Resources.xlf index 1772dac841..7c79b0d188 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Resources/xlf/Resources.xlf +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Resources/xlf/Resources.xlf @@ -23,9 +23,9 @@ File {0} does not exists - - The active Multi Test Runs Finalization was aborted. - The active Multi Test Runs Finalization was aborted. + + The active Test Run Attachments Processing was aborted. + The active Test Run Attachments Processing was aborted. diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Resources/xlf/Resources.zh-Hans.xlf b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Resources/xlf/Resources.zh-Hans.xlf index 6824d9b9db..35db394ca4 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Resources/xlf/Resources.zh-Hans.xlf +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Resources/xlf/Resources.zh-Hans.xlf @@ -61,9 +61,9 @@ 文件 {0} 不存在 - - The active Multi Test Runs Finalization was aborted. - The active Multi Test Runs Finalization was aborted. + + The active Test Run Attachments Processing was aborted. + The active Test Run Attachments Processing was aborted. diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Resources/xlf/Resources.zh-Hant.xlf b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Resources/xlf/Resources.zh-Hant.xlf index 2d27648708..77b761a7ee 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Resources/xlf/Resources.zh-Hant.xlf +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Resources/xlf/Resources.zh-Hant.xlf @@ -61,9 +61,9 @@ 檔案 {0} 不存在 - - The active Multi Test Runs Finalization was aborted. - The active Multi Test Runs Finalization was aborted. + + The active Test Run Attachments Processing was aborted. + The active Test Run Attachments Processing was aborted. diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleRequestSender.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleRequestSender.cs index ef2c9644ec..f61b47fdce 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleRequestSender.cs +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleRequestSender.cs @@ -384,9 +384,9 @@ public void EndSession() } /// - public Task FinalizeMultiTestRunAsync(IEnumerable attachments, bool collectMetrics, IMultiTestRunFinalizationEventsHandler testSessionEventsHandler, CancellationToken cancellationToken) + public Task ProcessTestRunAttachmentsAsync(IEnumerable attachments, bool collectMetrics, ITestRunAttachmentsProcessingEventsHandler testSessionEventsHandler, CancellationToken cancellationToken) { - return this.SendMessageAndListenAndReportFinalizationResultAsync(attachments, collectMetrics, testSessionEventsHandler, cancellationToken); + return this.SendMessageAndListenAndReportAttachmentsProcessingResultAsync(attachments, collectMetrics, testSessionEventsHandler, cancellationToken); } /// @@ -731,44 +731,44 @@ private async Task SendMessageAndListenAndReportTestResultsAsync(string messageT this.testPlatformEventSource.TranslationLayerExecutionStop(); } - private async Task SendMessageAndListenAndReportFinalizationResultAsync(IEnumerable attachments, bool collectMetrics, IMultiTestRunFinalizationEventsHandler eventHandler, CancellationToken cancellationToken) + private async Task SendMessageAndListenAndReportAttachmentsProcessingResultAsync(IEnumerable attachments, bool collectMetrics, ITestRunAttachmentsProcessingEventsHandler eventHandler, CancellationToken cancellationToken) { try { - var payload = new MultiTestRunFinalizationPayload + var payload = new TestRunAttachmentsProcessingPayload { Attachments = attachments, CollectMetrics = collectMetrics }; - this.communicationManager.SendMessage(MessageType.MultiTestRunFinalizationStart, payload); - var isMultiTestRunFinalizationComplete = false; + this.communicationManager.SendMessage(MessageType.TestRunAttachmentsProcessingStart, payload); + var isTestRunAttachmentsProcessingComplete = false; - using (cancellationToken.Register(() => this.communicationManager.SendMessage(MessageType.MultiTestRunFinalizationCancel))) + using (cancellationToken.Register(() => this.communicationManager.SendMessage(MessageType.TestRunAttachmentsProcessingCancel))) { // Cycle through the messages that the vstest.console sends. // Currently each of the operations are not separate tasks since they should not each take much time. // This is just a notification. - while (!isMultiTestRunFinalizationComplete) + while (!isTestRunAttachmentsProcessingComplete) { var message = await this.TryReceiveMessageAsync().ConfigureAwait(false); - if (string.Equals(MessageType.MultiTestRunFinalizationComplete, message.MessageType)) + if (string.Equals(MessageType.TestRunAttachmentsProcessingComplete, message.MessageType)) { if (EqtTrace.IsInfoEnabled) { EqtTrace.Info("VsTestConsoleRequestSender.SendMessageAndListenAndReportAttachments: Process complete."); } - var multiTestRunFinalizationCompletePayload = this.dataSerializer.DeserializePayload(message); + var testRunAttachmentsProcessingCompletePayload = this.dataSerializer.DeserializePayload(message); - eventHandler.HandleMultiTestRunFinalizationComplete(multiTestRunFinalizationCompletePayload.FinalizationCompleteEventArgs, multiTestRunFinalizationCompletePayload.Attachments); - isMultiTestRunFinalizationComplete = true; + eventHandler.HandleTestRunAttachmentsProcessingComplete(testRunAttachmentsProcessingCompletePayload.AttachmentsProcessingCompleteEventArgs, testRunAttachmentsProcessingCompletePayload.Attachments); + isTestRunAttachmentsProcessingComplete = true; } - else if (string.Equals(MessageType.MultiTestRunFinalizationProgress, message.MessageType)) + else if (string.Equals(MessageType.TestRunAttachmentsProcessingProgress, message.MessageType)) { - var multiTestRunFinalizationProgressPayload = this.dataSerializer.DeserializePayload(message); - eventHandler.HandleMultiTestRunFinalizationProgress(multiTestRunFinalizationProgressPayload.FinalizationProgressEventArgs); + var testRunAttachmentsProcessingProgressPayload = this.dataSerializer.DeserializePayload(message); + eventHandler.HandleTestRunAttachmentsProcessingProgress(testRunAttachmentsProcessingProgressPayload.AttachmentsProcessingProgressEventArgs); } else if (string.Equals(MessageType.TestMessage, message.MessageType)) { @@ -785,8 +785,8 @@ private async Task SendMessageAndListenAndReportFinalizationResultAsync(IEnumera catch (Exception exception) { EqtTrace.Error("Aborting Test Session End Operation: {0}", exception); - eventHandler.HandleLogMessage(TestMessageLevel.Error, TranslationLayerResources.AbortedMultiTestRunFinalization); - eventHandler.HandleMultiTestRunFinalizationComplete(new MultiTestRunFinalizationCompleteEventArgs(false, exception), null); + eventHandler.HandleLogMessage(TestMessageLevel.Error, TranslationLayerResources.AbortedTestRunAttachmentsProcessing); + eventHandler.HandleTestRunAttachmentsProcessingComplete(new TestRunAttachmentsProcessingCompleteEventArgs(false, exception), null); // Earlier we were closing the connection with vstest.console in case of exceptions // Removing that code because vstest.console might be in a healthy state and letting the client @@ -795,7 +795,7 @@ private async Task SendMessageAndListenAndReportFinalizationResultAsync(IEnumera } finally { - this.testPlatformEventSource.TranslationLayerMultiTestRunFinalizationStop(); + this.testPlatformEventSource.TranslationLayerTestRunAttachmentsProcessingStop(); } } diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleWrapper.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleWrapper.cs index e2750b80fe..c92a85f9db 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleWrapper.cs +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleWrapper.cs @@ -407,12 +407,12 @@ public async Task RunTestsWithCustomTestHostAsync(IEnumerable testCase } /// - public async Task FinalizeMultiTestRunAsync(IEnumerable attachments, bool multiTestRunCompleted, bool collectMetrics, IMultiTestRunFinalizationEventsHandler testSessionEventsHandler, CancellationToken cancellationToken) + public async Task ProcessTestRunAttachmentsAsync(IEnumerable attachments, bool multiTestRunCompleted, bool collectMetrics, ITestRunAttachmentsProcessingEventsHandler testSessionEventsHandler, CancellationToken cancellationToken) { - this.testPlatformEventSource.TranslationLayerMultiTestRunFinalizationStart(); + this.testPlatformEventSource.TranslationLayerTestRunAttachmentsProcessingStart(); await this.EnsureInitializedAsync().ConfigureAwait(false); - await requestSender.FinalizeMultiTestRunAsync(attachments, collectMetrics, testSessionEventsHandler, cancellationToken).ConfigureAwait(false); + await requestSender.ProcessTestRunAttachmentsAsync(attachments, collectMetrics, testSessionEventsHandler, cancellationToken).ConfigureAwait(false); } #endregion diff --git a/src/vstest.console/TestPlatformHelpers/TestRequestManager.cs b/src/vstest.console/TestPlatformHelpers/TestRequestManager.cs index ac53184926..3fc25a44e8 100644 --- a/src/vstest.console/TestPlatformHelpers/TestRequestManager.cs +++ b/src/vstest.console/TestPlatformHelpers/TestRequestManager.cs @@ -13,7 +13,7 @@ namespace Microsoft.VisualStudio.TestPlatform.CommandLine.TestPlatformHelpers using System.Xml; using System.Xml.XPath; using Microsoft.VisualStudio.TestPlatform.Client; - using Microsoft.VisualStudio.TestPlatform.Client.MultiTestRunFinalization; + using Microsoft.VisualStudio.TestPlatform.Client.TestRunAttachmentsProcessing; using Microsoft.VisualStudio.TestPlatform.Client.RequestHelper; using Microsoft.VisualStudio.TestPlatform.CommandLine.Internal; using Microsoft.VisualStudio.TestPlatform.CommandLine.Processors.Utilities; @@ -26,7 +26,7 @@ namespace Microsoft.VisualStudio.TestPlatform.CommandLine.TestPlatformHelpers using Microsoft.VisualStudio.TestPlatform.Common.Utilities; using Microsoft.VisualStudio.TestPlatform.CoreUtilities.Tracing; using Microsoft.VisualStudio.TestPlatform.CoreUtilities.Tracing.Interfaces; - using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.MultiTestRunFinalization; + using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.TestRunAttachmentsProcessing; using Microsoft.VisualStudio.TestPlatform.ObjectModel; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.Interfaces; @@ -53,7 +53,7 @@ internal class TestRequestManager : ITestRequestManager private readonly Task metricsPublisher; private bool isDisposed; private IProcessHelper processHelper; - private IMultiTestRunFinalizationManager finalizationManager; + private ITestRunAttachmentsProcessingManager attachmentsProcessingManager; /// /// Maintains the current active execution request @@ -68,10 +68,10 @@ internal class TestRequestManager : ITestRequestManager private IDiscoveryRequest currentDiscoveryRequest; /// - /// Maintains the current active multi test run finalization cancellation token source - /// Assumption : There can only be one active finalization request. + /// Maintains the current active test run attachments processing cancellation token source + /// Assumption : There can only be one active attachments processing request. /// - private CancellationTokenSource currentFinalizationCancellationTokenSource; + private CancellationTokenSource currentAttachmentsProcessingCancellationTokenSource; #region Constructor @@ -84,11 +84,11 @@ public TestRequestManager() new InferHelper(AssemblyMetadataProvider.Instance), MetricsPublisherFactory.GetMetricsPublisher(IsTelemetryOptedIn(), CommandLineOptions.Instance.IsDesignMode), new ProcessHelper(), - new MultiTestRunFinalizationManager(TestPlatformEventSource.Instance, new CodeCoverageDataAttachmentsHandler())) + new TestRunAttachmentsProcessingManager(TestPlatformEventSource.Instance, new CodeCoverageDataAttachmentsHandler())) { } - internal TestRequestManager(CommandLineOptions commandLineOptions, ITestPlatform testPlatform, TestRunResultAggregator testRunResultAggregator, ITestPlatformEventSource testPlatformEventSource, InferHelper inferHelper, Task metricsPublisher, IProcessHelper processHelper, IMultiTestRunFinalizationManager finalizationManager) + internal TestRequestManager(CommandLineOptions commandLineOptions, ITestPlatform testPlatform, TestRunResultAggregator testRunResultAggregator, ITestPlatformEventSource testPlatformEventSource, InferHelper inferHelper, Task metricsPublisher, IProcessHelper processHelper, ITestRunAttachmentsProcessingManager attachmentsProcessingManager) { this.testPlatform = testPlatform; this.commandLineOptions = commandLineOptions; @@ -97,7 +97,7 @@ internal TestRequestManager(CommandLineOptions commandLineOptions, ITestPlatform this.inferHelper = inferHelper; this.metricsPublisher = metricsPublisher; this.processHelper = processHelper; - this.finalizationManager = finalizationManager; + this.attachmentsProcessingManager = attachmentsProcessingManager; } #endregion @@ -313,40 +313,40 @@ public void RunTests(TestRunRequestPayload testRunRequestPayload, ITestHostLaunc } /// - public void FinalizeMultiTestRun(MultiTestRunFinalizationPayload finalizationPayload, IMultiTestRunFinalizationEventsHandler finalizationEventsHandler, ProtocolConfig protocolConfig) + public void ProcessTestRunAttachments(TestRunAttachmentsProcessingPayload attachmentsProcessingPayload, ITestRunAttachmentsProcessingEventsHandler attachmentsProcessingEventsHandler, ProtocolConfig protocolConfig) { - EqtTrace.Info("TestRequestManager.FinalizeMultiTestRun: Multi test run finalization started."); + EqtTrace.Info("TestRequestManager.ProcessTestRunAttachments: Test run attachments processing started."); - this.telemetryOptedIn = finalizationPayload.CollectMetrics; + this.telemetryOptedIn = attachmentsProcessingPayload.CollectMetrics; var requestData = this.GetRequestData(protocolConfig); // Make sure to run the run request inside a lock as the below section is not thread-safe - // There can be only one discovery, execution or finalization request at a given point in time + // There can be only one discovery, execution or attachments processing request at a given point in time lock (this.syncObject) { try { - EqtTrace.Info("TestRequestManager.FinalizeMultiTestRun: Synchronization context taken"); - this.testPlatformEventSource.MultiTestRunFinalizationRequestStart(); + EqtTrace.Info("TestRequestManager.ProcessTestRunAttachments: Synchronization context taken"); + this.testPlatformEventSource.TestRunAttachmentsProcessingRequestStart(); - this.currentFinalizationCancellationTokenSource = new CancellationTokenSource(); + this.currentAttachmentsProcessingCancellationTokenSource = new CancellationTokenSource(); - Task task = this.finalizationManager.FinalizeMultiTestRunAsync(requestData, finalizationPayload.Attachments, finalizationEventsHandler, this.currentFinalizationCancellationTokenSource.Token); + Task task = this.attachmentsProcessingManager.ProcessTestRunAttachmentsAsync(requestData, attachmentsProcessingPayload.Attachments, attachmentsProcessingEventsHandler, this.currentAttachmentsProcessingCancellationTokenSource.Token); task.Wait(); } finally { - if (this.currentFinalizationCancellationTokenSource != null) + if (this.currentAttachmentsProcessingCancellationTokenSource != null) { - this.currentFinalizationCancellationTokenSource.Dispose(); - this.currentFinalizationCancellationTokenSource = null; + this.currentAttachmentsProcessingCancellationTokenSource.Dispose(); + this.currentAttachmentsProcessingCancellationTokenSource = null; } - EqtTrace.Info("TestRequestManager.FinalizeMultiTestRun: Multi test run finalization completed."); - this.testPlatformEventSource.MultiTestRunFinalizationRequestStop(); + EqtTrace.Info("TestRequestManager.ProcessTestRunAttachments: Test run attachments processing completed."); + this.testPlatformEventSource.TestRunAttachmentsProcessingRequestStop(); - // Post the finalization complete event - this.metricsPublisher.Result.PublishMetrics(TelemetryDataConstants.TestFinalizationCompleteEvent, requestData.MetricsCollection.Metrics); + // Post the attachments processing complete event + this.metricsPublisher.Result.PublishMetrics(TelemetryDataConstants.TestAttachmentsProcessingCompleteEvent, requestData.MetricsCollection.Metrics); } } } @@ -393,10 +393,10 @@ public void AbortTestRun() } /// - public void CancelMultiTestRunFinalization() + public void CancelTestRunAttachmentsProcessing() { - EqtTrace.Info("TestRequestManager.CancelMultiTestRunFinalization: Sending cancel request."); - this.currentFinalizationCancellationTokenSource?.Cancel(); + EqtTrace.Info("TestRequestManager.CancelTestRunAttachmentsProcessing: Sending cancel request."); + this.currentAttachmentsProcessingCancellationTokenSource?.Cancel(); } #endregion diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/TranslationLayerTests/CodeCoverageTests.cs b/test/Microsoft.TestPlatform.AcceptanceTests/TranslationLayerTests/CodeCoverageTests.cs index cc3c7efe62..964a22cf1e 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/TranslationLayerTests/CodeCoverageTests.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/TranslationLayerTests/CodeCoverageTests.cs @@ -19,7 +19,7 @@ namespace Microsoft.TestPlatform.AcceptanceTests.TranslationLayerTests using System.Xml; /// - /// The Multi test run finalization tests using VsTestConsoleWrapper API's + /// The Test run attachments processing tests using VsTestConsoleWrapper API's /// [TestClass] public class CodeCoverageTests : AcceptanceTestBase @@ -32,13 +32,13 @@ public class CodeCoverageTests : AcceptanceTestBase private IVsTestConsoleWrapper vstestConsoleWrapper; private RunEventHandler runEventHandler; - private MultiTestRunFinalizationEventHandler multiTestRunFinalizationEventHandler; + private TestRunAttachmentsProcessingEventHandler testRunAttachmentsProcessingEventHandler; private void Setup() { this.vstestConsoleWrapper = this.GetVsTestConsoleWrapper(); this.runEventHandler = new RunEventHandler(); - this.multiTestRunFinalizationEventHandler = new MultiTestRunFinalizationEventHandler(); + this.testRunAttachmentsProcessingEventHandler = new TestRunAttachmentsProcessingEventHandler(); } [TestCleanup] @@ -91,7 +91,7 @@ public void TestRunWithCodeCoverageParallel(RunnerInfo runnerInfo) [TestMethod] [NetFullTargetFrameworkDataSource] [NetCoreTargetFrameworkDataSource] - public async Task TestRunWithCodeCoverageAndFinalization(RunnerInfo runnerInfo) + public async Task TestRunWithCodeCoverageAndAttachmentsProcessing(RunnerInfo runnerInfo) { // arrange AcceptanceTestBase.SetTestEnvironment(this.testEnvironment, runnerInfo); @@ -104,34 +104,34 @@ public async Task TestRunWithCodeCoverageAndFinalization(RunnerInfo runnerInfo) Assert.AreEqual(2, this.runEventHandler.Attachments.Count); // act - await this.vstestConsoleWrapper.FinalizeMultiTestRunAsync(runEventHandler.Attachments, true, true, multiTestRunFinalizationEventHandler, CancellationToken.None); + await this.vstestConsoleWrapper.ProcessTestRunAttachmentsAsync(runEventHandler.Attachments, true, true, testRunAttachmentsProcessingEventHandler, CancellationToken.None); // Assert - multiTestRunFinalizationEventHandler.EnsureSuccess(); - Assert.AreEqual(testEnvironment.RunnerFramework.Equals(IntegrationTestBase.DesktopRunnerFramework) ? 1 : 2, this.multiTestRunFinalizationEventHandler.Attachments.Count); + testRunAttachmentsProcessingEventHandler.EnsureSuccess(); + Assert.AreEqual(testEnvironment.RunnerFramework.Equals(IntegrationTestBase.DesktopRunnerFramework) ? 1 : 2, this.testRunAttachmentsProcessingEventHandler.Attachments.Count); - AssertCoverageResults(this.multiTestRunFinalizationEventHandler.Attachments); + AssertCoverageResults(this.testRunAttachmentsProcessingEventHandler.Attachments); - Assert.IsFalse(multiTestRunFinalizationEventHandler.CompleteArgs.IsCanceled); - Assert.IsNull(multiTestRunFinalizationEventHandler.CompleteArgs.Error); + Assert.IsFalse(testRunAttachmentsProcessingEventHandler.CompleteArgs.IsCanceled); + Assert.IsNull(testRunAttachmentsProcessingEventHandler.CompleteArgs.Error); - for (int i = 0; i < multiTestRunFinalizationEventHandler.ProgressArgs.Count; i++) + for (int i = 0; i < testRunAttachmentsProcessingEventHandler.ProgressArgs.Count; i++) { - VisualStudio.TestPlatform.ObjectModel.Client.MultiTestRunFinalizationProgressEventArgs progressArgs = multiTestRunFinalizationEventHandler.ProgressArgs[i]; + VisualStudio.TestPlatform.ObjectModel.Client.TestRunAttachmentsProcessingProgressEventArgs progressArgs = testRunAttachmentsProcessingEventHandler.ProgressArgs[i]; Assert.AreEqual(1, progressArgs.CurrentAttachmentProcessorIndex); Assert.AreEqual(1, progressArgs.CurrentAttachmentProcessorUris.Count); Assert.AreEqual("datacollector://microsoft/CodeCoverage/2.0", progressArgs.CurrentAttachmentProcessorUris.First().AbsoluteUri); Assert.AreEqual(1, progressArgs.AttachmentProcessorsCount); - if (multiTestRunFinalizationEventHandler.ProgressArgs.Count == 2) + if (testRunAttachmentsProcessingEventHandler.ProgressArgs.Count == 2) { Assert.AreEqual(i == 0 ? 50 : 100, progressArgs.CurrentAttachmentProcessorProgress); } } - Assert.AreEqual("Completed", multiTestRunFinalizationEventHandler.CompleteArgs.Metrics[TelemetryDataConstants.FinalizationState]); - Assert.AreEqual(2L, multiTestRunFinalizationEventHandler.CompleteArgs.Metrics[TelemetryDataConstants.NumberOfAttachmentsSentForFinalization]); - Assert.AreEqual(testEnvironment.RunnerFramework.Equals(IntegrationTestBase.DesktopRunnerFramework) ? 1L : 2L, multiTestRunFinalizationEventHandler.CompleteArgs.Metrics[TelemetryDataConstants.NumberOfAttachmentsAfterFinalization]); - Assert.IsTrue(multiTestRunFinalizationEventHandler.CompleteArgs.Metrics.ContainsKey(TelemetryDataConstants.TimeTakenInSecForFinalization)); + Assert.AreEqual("Completed", testRunAttachmentsProcessingEventHandler.CompleteArgs.Metrics[TelemetryDataConstants.AttachmentsProcessingState]); + Assert.AreEqual(2L, testRunAttachmentsProcessingEventHandler.CompleteArgs.Metrics[TelemetryDataConstants.NumberOfAttachmentsSentForProcessing]); + Assert.AreEqual(testEnvironment.RunnerFramework.Equals(IntegrationTestBase.DesktopRunnerFramework) ? 1L : 2L, testRunAttachmentsProcessingEventHandler.CompleteArgs.Metrics[TelemetryDataConstants.NumberOfAttachmentsAfterProcessing]); + Assert.IsTrue(testRunAttachmentsProcessingEventHandler.CompleteArgs.Metrics.ContainsKey(TelemetryDataConstants.TimeTakenInSecForAttachmentsProcessing)); Assert.IsTrue(File.Exists(runEventHandler.Attachments.First().Attachments.First().Uri.LocalPath)); Assert.IsTrue(File.Exists(runEventHandler.Attachments.Last().Attachments.First().Uri.LocalPath) != testEnvironment.RunnerFramework.Equals(IntegrationTestBase.DesktopRunnerFramework)); @@ -140,7 +140,7 @@ public async Task TestRunWithCodeCoverageAndFinalization(RunnerInfo runnerInfo) [TestMethod] [NetFullTargetFrameworkDataSource] [NetCoreTargetFrameworkDataSource] - public async Task TestRunWithCodeCoverageAndFinalizationNoMetrics(RunnerInfo runnerInfo) + public async Task TestRunWithCodeCoverageAndAttachmentsProcessingNoMetrics(RunnerInfo runnerInfo) { // arrange AcceptanceTestBase.SetTestEnvironment(this.testEnvironment, runnerInfo); @@ -153,31 +153,31 @@ public async Task TestRunWithCodeCoverageAndFinalizationNoMetrics(RunnerInfo run Assert.AreEqual(2, this.runEventHandler.Attachments.Count); // act - await this.vstestConsoleWrapper.FinalizeMultiTestRunAsync(runEventHandler.Attachments, true, false, multiTestRunFinalizationEventHandler, CancellationToken.None); + await this.vstestConsoleWrapper.ProcessTestRunAttachmentsAsync(runEventHandler.Attachments, true, false, testRunAttachmentsProcessingEventHandler, CancellationToken.None); // Assert - multiTestRunFinalizationEventHandler.EnsureSuccess(); - Assert.AreEqual(testEnvironment.RunnerFramework.Equals(IntegrationTestBase.DesktopRunnerFramework) ? 1 : 2, this.multiTestRunFinalizationEventHandler.Attachments.Count); + testRunAttachmentsProcessingEventHandler.EnsureSuccess(); + Assert.AreEqual(testEnvironment.RunnerFramework.Equals(IntegrationTestBase.DesktopRunnerFramework) ? 1 : 2, this.testRunAttachmentsProcessingEventHandler.Attachments.Count); - AssertCoverageResults(this.multiTestRunFinalizationEventHandler.Attachments); + AssertCoverageResults(this.testRunAttachmentsProcessingEventHandler.Attachments); - Assert.IsFalse(multiTestRunFinalizationEventHandler.CompleteArgs.IsCanceled); - Assert.IsNull(multiTestRunFinalizationEventHandler.CompleteArgs.Error); + Assert.IsFalse(testRunAttachmentsProcessingEventHandler.CompleteArgs.IsCanceled); + Assert.IsNull(testRunAttachmentsProcessingEventHandler.CompleteArgs.Error); - for (int i = 0; i < multiTestRunFinalizationEventHandler.ProgressArgs.Count; i++) + for (int i = 0; i < testRunAttachmentsProcessingEventHandler.ProgressArgs.Count; i++) { - VisualStudio.TestPlatform.ObjectModel.Client.MultiTestRunFinalizationProgressEventArgs progressArgs = multiTestRunFinalizationEventHandler.ProgressArgs[i]; + VisualStudio.TestPlatform.ObjectModel.Client.TestRunAttachmentsProcessingProgressEventArgs progressArgs = testRunAttachmentsProcessingEventHandler.ProgressArgs[i]; Assert.AreEqual(1, progressArgs.CurrentAttachmentProcessorIndex); Assert.AreEqual(1, progressArgs.CurrentAttachmentProcessorUris.Count); Assert.AreEqual("datacollector://microsoft/CodeCoverage/2.0", progressArgs.CurrentAttachmentProcessorUris.First().AbsoluteUri); Assert.AreEqual(1, progressArgs.AttachmentProcessorsCount); - if (multiTestRunFinalizationEventHandler.ProgressArgs.Count == 2) + if (testRunAttachmentsProcessingEventHandler.ProgressArgs.Count == 2) { Assert.AreEqual(i == 0 ? 50 : 100, progressArgs.CurrentAttachmentProcessorProgress); } } - Assert.IsTrue(multiTestRunFinalizationEventHandler.CompleteArgs.Metrics.IsNullOrEmpty()); + Assert.IsTrue(testRunAttachmentsProcessingEventHandler.CompleteArgs.Metrics.IsNullOrEmpty()); Assert.IsTrue(File.Exists(runEventHandler.Attachments.First().Attachments.First().Uri.LocalPath)); Assert.IsTrue(File.Exists(runEventHandler.Attachments.Last().Attachments.First().Uri.LocalPath) != testEnvironment.RunnerFramework.Equals(IntegrationTestBase.DesktopRunnerFramework)); @@ -186,7 +186,7 @@ public async Task TestRunWithCodeCoverageAndFinalizationNoMetrics(RunnerInfo run [TestMethod] [NetFullTargetFrameworkDataSource] [NetCoreTargetFrameworkDataSource] - public async Task TestRunWithCodeCoverageAndFinalizationModuleDuplicated(RunnerInfo runnerInfo) + public async Task TestRunWithCodeCoverageAndAttachmentsProcessingModuleDuplicated(RunnerInfo runnerInfo) { // arrange AcceptanceTestBase.SetTestEnvironment(this.testEnvironment, runnerInfo); @@ -200,34 +200,34 @@ public async Task TestRunWithCodeCoverageAndFinalizationModuleDuplicated(RunnerI Assert.AreEqual(3, this.runEventHandler.Attachments.Count); // act - await this.vstestConsoleWrapper.FinalizeMultiTestRunAsync(runEventHandler.Attachments, true, true, multiTestRunFinalizationEventHandler, CancellationToken.None); + await this.vstestConsoleWrapper.ProcessTestRunAttachmentsAsync(runEventHandler.Attachments, true, true, testRunAttachmentsProcessingEventHandler, CancellationToken.None); // Assert - multiTestRunFinalizationEventHandler.EnsureSuccess(); - Assert.AreEqual(testEnvironment.RunnerFramework.Equals(IntegrationTestBase.DesktopRunnerFramework) ? 1 : 3, this.multiTestRunFinalizationEventHandler.Attachments.Count); + testRunAttachmentsProcessingEventHandler.EnsureSuccess(); + Assert.AreEqual(testEnvironment.RunnerFramework.Equals(IntegrationTestBase.DesktopRunnerFramework) ? 1 : 3, this.testRunAttachmentsProcessingEventHandler.Attachments.Count); - AssertCoverageResults(this.multiTestRunFinalizationEventHandler.Attachments); + AssertCoverageResults(this.testRunAttachmentsProcessingEventHandler.Attachments); - Assert.IsFalse(multiTestRunFinalizationEventHandler.CompleteArgs.IsCanceled); - Assert.IsNull(multiTestRunFinalizationEventHandler.CompleteArgs.Error); + Assert.IsFalse(testRunAttachmentsProcessingEventHandler.CompleteArgs.IsCanceled); + Assert.IsNull(testRunAttachmentsProcessingEventHandler.CompleteArgs.Error); - for (int i = 0; i < multiTestRunFinalizationEventHandler.ProgressArgs.Count; i++) + for (int i = 0; i < testRunAttachmentsProcessingEventHandler.ProgressArgs.Count; i++) { - VisualStudio.TestPlatform.ObjectModel.Client.MultiTestRunFinalizationProgressEventArgs progressArgs = multiTestRunFinalizationEventHandler.ProgressArgs[i]; + VisualStudio.TestPlatform.ObjectModel.Client.TestRunAttachmentsProcessingProgressEventArgs progressArgs = testRunAttachmentsProcessingEventHandler.ProgressArgs[i]; Assert.AreEqual(1, progressArgs.CurrentAttachmentProcessorIndex); Assert.AreEqual("datacollector://microsoft/CodeCoverage/2.0", progressArgs.CurrentAttachmentProcessorUris.First().AbsoluteUri); Assert.AreEqual(1, progressArgs.AttachmentProcessorsCount); - if (multiTestRunFinalizationEventHandler.ProgressArgs.Count == 3) + if (testRunAttachmentsProcessingEventHandler.ProgressArgs.Count == 3) { Assert.AreEqual(i == 0 ? 33 : i == 1 ? 66 : 100, progressArgs.CurrentAttachmentProcessorProgress); } } - Assert.AreEqual("Completed", multiTestRunFinalizationEventHandler.CompleteArgs.Metrics[TelemetryDataConstants.FinalizationState]); - Assert.AreEqual(3L, multiTestRunFinalizationEventHandler.CompleteArgs.Metrics[TelemetryDataConstants.NumberOfAttachmentsSentForFinalization]); - Assert.AreEqual(testEnvironment.RunnerFramework.Equals(IntegrationTestBase.DesktopRunnerFramework) ? 1L : 3L, multiTestRunFinalizationEventHandler.CompleteArgs.Metrics[TelemetryDataConstants.NumberOfAttachmentsAfterFinalization]); - Assert.IsTrue(multiTestRunFinalizationEventHandler.CompleteArgs.Metrics.ContainsKey(TelemetryDataConstants.TimeTakenInSecForFinalization)); + Assert.AreEqual("Completed", testRunAttachmentsProcessingEventHandler.CompleteArgs.Metrics[TelemetryDataConstants.AttachmentsProcessingState]); + Assert.AreEqual(3L, testRunAttachmentsProcessingEventHandler.CompleteArgs.Metrics[TelemetryDataConstants.NumberOfAttachmentsSentForProcessing]); + Assert.AreEqual(testEnvironment.RunnerFramework.Equals(IntegrationTestBase.DesktopRunnerFramework) ? 1L : 3L, testRunAttachmentsProcessingEventHandler.CompleteArgs.Metrics[TelemetryDataConstants.NumberOfAttachmentsAfterProcessing]); + Assert.IsTrue(testRunAttachmentsProcessingEventHandler.CompleteArgs.Metrics.ContainsKey(TelemetryDataConstants.TimeTakenInSecForAttachmentsProcessing)); Assert.IsTrue(File.Exists(runEventHandler.Attachments.First().Attachments.First().Uri.LocalPath)); Assert.IsTrue(File.Exists(runEventHandler.Attachments.Last().Attachments.First().Uri.LocalPath) != testEnvironment.RunnerFramework.Equals(IntegrationTestBase.DesktopRunnerFramework)); @@ -236,7 +236,7 @@ public async Task TestRunWithCodeCoverageAndFinalizationModuleDuplicated(RunnerI [TestMethod] [NetFullTargetFrameworkDataSource] [NetCoreTargetFrameworkDataSource] - public async Task TestRunWithCodeCoverageAndFinalizationCancelled(RunnerInfo runnerInfo) + public async Task TestRunWithCodeCoverageAndAttachmentsProcessingCancelled(RunnerInfo runnerInfo) { // arrange AcceptanceTestBase.SetTestEnvironment(this.testEnvironment, runnerInfo); @@ -252,13 +252,13 @@ public async Task TestRunWithCodeCoverageAndFinalizationCancelled(RunnerInfo run CancellationTokenSource cts = new CancellationTokenSource(); - Task finalization = this.vstestConsoleWrapper.FinalizeMultiTestRunAsync(attachments, true, true, multiTestRunFinalizationEventHandler, cts.Token); + Task attachmentsProcessing = this.vstestConsoleWrapper.ProcessTestRunAttachmentsAsync(attachments, true, true, testRunAttachmentsProcessingEventHandler, cts.Token); while (true) { try { - if (multiTestRunFinalizationEventHandler.ProgressArgs.Count >= 3) + if (testRunAttachmentsProcessingEventHandler.ProgressArgs.Count >= 3) break; } catch @@ -272,18 +272,18 @@ public async Task TestRunWithCodeCoverageAndFinalizationCancelled(RunnerInfo run cts.Cancel(); // Assert - await finalization; - multiTestRunFinalizationEventHandler.EnsureSuccess(); + await attachmentsProcessing; + testRunAttachmentsProcessingEventHandler.EnsureSuccess(); - Assert.AreEqual(1000, this.multiTestRunFinalizationEventHandler.Attachments.Count); + Assert.AreEqual(1000, this.testRunAttachmentsProcessingEventHandler.Attachments.Count); - Assert.IsTrue(multiTestRunFinalizationEventHandler.CompleteArgs.IsCanceled); - Assert.IsNull(multiTestRunFinalizationEventHandler.CompleteArgs.Error); + Assert.IsTrue(testRunAttachmentsProcessingEventHandler.CompleteArgs.IsCanceled); + Assert.IsNull(testRunAttachmentsProcessingEventHandler.CompleteArgs.Error); - Assert.IsTrue((testEnvironment.RunnerFramework.Equals(IntegrationTestBase.DesktopRunnerFramework) ? 3 : 0) <= multiTestRunFinalizationEventHandler.ProgressArgs.Count); - for (int i = 0; i < multiTestRunFinalizationEventHandler.ProgressArgs.Count; i++) + Assert.IsTrue((testEnvironment.RunnerFramework.Equals(IntegrationTestBase.DesktopRunnerFramework) ? 3 : 0) <= testRunAttachmentsProcessingEventHandler.ProgressArgs.Count); + for (int i = 0; i < testRunAttachmentsProcessingEventHandler.ProgressArgs.Count; i++) { - VisualStudio.TestPlatform.ObjectModel.Client.MultiTestRunFinalizationProgressEventArgs progressArgs = multiTestRunFinalizationEventHandler.ProgressArgs[i]; + VisualStudio.TestPlatform.ObjectModel.Client.TestRunAttachmentsProcessingProgressEventArgs progressArgs = testRunAttachmentsProcessingEventHandler.ProgressArgs[i]; Assert.AreEqual(1, progressArgs.CurrentAttachmentProcessorIndex); Assert.AreEqual("datacollector://microsoft/CodeCoverage/2.0", progressArgs.CurrentAttachmentProcessorUris.First().AbsoluteUri); Assert.AreEqual(1, progressArgs.AttachmentProcessorsCount); @@ -294,10 +294,10 @@ public async Task TestRunWithCodeCoverageAndFinalizationCancelled(RunnerInfo run } } - Assert.AreEqual("Canceled", multiTestRunFinalizationEventHandler.CompleteArgs.Metrics[TelemetryDataConstants.FinalizationState]); - Assert.AreEqual(1000L, multiTestRunFinalizationEventHandler.CompleteArgs.Metrics[TelemetryDataConstants.NumberOfAttachmentsSentForFinalization]); - Assert.AreEqual(1000L, multiTestRunFinalizationEventHandler.CompleteArgs.Metrics[TelemetryDataConstants.NumberOfAttachmentsAfterFinalization]); - Assert.IsTrue(multiTestRunFinalizationEventHandler.CompleteArgs.Metrics.ContainsKey(TelemetryDataConstants.TimeTakenInSecForFinalization)); + Assert.AreEqual("Canceled", testRunAttachmentsProcessingEventHandler.CompleteArgs.Metrics[TelemetryDataConstants.AttachmentsProcessingState]); + Assert.AreEqual(1000L, testRunAttachmentsProcessingEventHandler.CompleteArgs.Metrics[TelemetryDataConstants.NumberOfAttachmentsSentForProcessing]); + Assert.AreEqual(1000L, testRunAttachmentsProcessingEventHandler.CompleteArgs.Metrics[TelemetryDataConstants.NumberOfAttachmentsAfterProcessing]); + Assert.IsTrue(testRunAttachmentsProcessingEventHandler.CompleteArgs.Metrics.ContainsKey(TelemetryDataConstants.TimeTakenInSecForAttachmentsProcessing)); Assert.IsTrue(File.Exists(runEventHandler.Attachments.First().Attachments.First().Uri.LocalPath)); } @@ -318,7 +318,7 @@ public async Task EndSessionShouldEnsureVstestConsoleProcessDies(RunnerInfo runn Assert.AreEqual(6, this.runEventHandler.TestResults.Count); Assert.AreEqual(2, this.runEventHandler.Attachments.Count); - await this.vstestConsoleWrapper.FinalizeMultiTestRunAsync(runEventHandler.Attachments, true, true, multiTestRunFinalizationEventHandler, CancellationToken.None); + await this.vstestConsoleWrapper.ProcessTestRunAttachmentsAsync(runEventHandler.Attachments, true, true, testRunAttachmentsProcessingEventHandler, CancellationToken.None); // act this.vstestConsoleWrapper?.EndSession(); diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/TranslationLayerTests/EventHandler/MultiTestRunFinalizationEventHandler.cs b/test/Microsoft.TestPlatform.AcceptanceTests/TranslationLayerTests/EventHandler/TestRunAttachmentsProcessingEventHandler.cs similarity index 68% rename from test/Microsoft.TestPlatform.AcceptanceTests/TranslationLayerTests/EventHandler/MultiTestRunFinalizationEventHandler.cs rename to test/Microsoft.TestPlatform.AcceptanceTests/TranslationLayerTests/EventHandler/TestRunAttachmentsProcessingEventHandler.cs index ed3fc68204..8a0b6513c6 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/TranslationLayerTests/EventHandler/MultiTestRunFinalizationEventHandler.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/TranslationLayerTests/EventHandler/TestRunAttachmentsProcessingEventHandler.cs @@ -11,13 +11,13 @@ namespace Microsoft.TestPlatform.AcceptanceTests.TranslationLayerTests using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging; /// - public class MultiTestRunFinalizationEventHandler : IMultiTestRunFinalizationEventsHandler + public class TestRunAttachmentsProcessingEventHandler : ITestRunAttachmentsProcessingEventsHandler { public List Attachments { get; private set; } - public MultiTestRunFinalizationCompleteEventArgs CompleteArgs { get; private set; } + public TestRunAttachmentsProcessingCompleteEventArgs CompleteArgs { get; private set; } - public List ProgressArgs { get; private set; } + public List ProgressArgs { get; private set; } /// /// Gets the log message. @@ -31,11 +31,11 @@ public class MultiTestRunFinalizationEventHandler : IMultiTestRunFinalizationEve /// public TestMessageLevel TestMessageLevel { get; private set; } - public MultiTestRunFinalizationEventHandler() + public TestRunAttachmentsProcessingEventHandler() { this.Errors = new List(); this.Attachments = new List(); - this.ProgressArgs = new List(); + this.ProgressArgs = new List(); } public void EnsureSuccess() @@ -73,7 +73,7 @@ public bool AttachDebuggerToProcess(int pid) return true; } - public void HandleMultiTestRunFinalizationComplete(ICollection attachments) + public void HandleTestRunAttachmentsProcessingComplete(ICollection attachments) { if(attachments != null) { @@ -81,19 +81,19 @@ public void HandleMultiTestRunFinalizationComplete(ICollection at } } - public void HandleMultiTestRunFinalizationComplete(MultiTestRunFinalizationCompleteEventArgs finalizationCompleteEventArgs, IEnumerable lastChunk) + public void HandleTestRunAttachmentsProcessingComplete(TestRunAttachmentsProcessingCompleteEventArgs attachmentsProcessingCompleteEventArgs, IEnumerable lastChunk) { if (lastChunk != null) { this.Attachments.AddRange(lastChunk); } - if (finalizationCompleteEventArgs.Error != null) + if (attachmentsProcessingCompleteEventArgs.Error != null) { - Errors.Add(finalizationCompleteEventArgs.Error.Message); + Errors.Add(attachmentsProcessingCompleteEventArgs.Error.Message); } - CompleteArgs = finalizationCompleteEventArgs; + CompleteArgs = attachmentsProcessingCompleteEventArgs; } public void HandleProcessedAttachmentsChunk(IEnumerable attachments) @@ -101,9 +101,9 @@ public void HandleProcessedAttachmentsChunk(IEnumerable attachmen throw new NotImplementedException(); } - public void HandleMultiTestRunFinalizationProgress(MultiTestRunFinalizationProgressEventArgs finalizationProgressEventArgs) + public void HandleTestRunAttachmentsProcessingProgress(TestRunAttachmentsProcessingProgressEventArgs AttachmentsProcessingProgressEventArgs) { - ProgressArgs.Add(finalizationProgressEventArgs); + ProgressArgs.Add(AttachmentsProcessingProgressEventArgs); } } } diff --git a/test/Microsoft.TestPlatform.Client.UnitTests/MultiTestRunFinalization/MultiTestRunFinalizationEventsHandlerTests.cs b/test/Microsoft.TestPlatform.Client.UnitTests/AttachmentsProcessing/TestRunAttachmentsProcessingEventsHandlerTests.cs similarity index 57% rename from test/Microsoft.TestPlatform.Client.UnitTests/MultiTestRunFinalization/MultiTestRunFinalizationEventsHandlerTests.cs rename to test/Microsoft.TestPlatform.Client.UnitTests/AttachmentsProcessing/TestRunAttachmentsProcessingEventsHandlerTests.cs index 852554361c..2988e594c6 100644 --- a/test/Microsoft.TestPlatform.Client.UnitTests/MultiTestRunFinalization/MultiTestRunFinalizationEventsHandlerTests.cs +++ b/test/Microsoft.TestPlatform.Client.UnitTests/AttachmentsProcessing/TestRunAttachmentsProcessingEventsHandlerTests.cs @@ -1,8 +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. -namespace Microsoft.TestPlatform.Client.UnitTests.MultiTestRunFinalization +namespace Microsoft.TestPlatform.Client.UnitTests.TestRunAttachmentsProcessing { - using Microsoft.VisualStudio.TestPlatform.Client.MultiTestRunFinalization; + using Microsoft.VisualStudio.TestPlatform.Client.TestRunAttachmentsProcessing; using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.Interfaces; using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.ObjectModel; using Microsoft.VisualStudio.TestPlatform.ObjectModel; @@ -13,15 +13,15 @@ namespace Microsoft.TestPlatform.Client.UnitTests.MultiTestRunFinalization using Moq; [TestClass] - public class MultiTestRunFinalizationEventsHandlerTests + public class TestRunAttachmentsProcessingEventsHandlerTests { private readonly Mock mockCommunicationManager; - private readonly IMultiTestRunFinalizationEventsHandler handler; + private readonly ITestRunAttachmentsProcessingEventsHandler handler; - public MultiTestRunFinalizationEventsHandlerTests() + public TestRunAttachmentsProcessingEventsHandlerTests() { this.mockCommunicationManager = new Mock(); - this.handler = new MultiTestRunFinalizationEventsHandler(mockCommunicationManager.Object); + this.handler = new TestRunAttachmentsProcessingEventsHandler(mockCommunicationManager.Object); } [TestMethod] @@ -35,24 +35,24 @@ public void EventsHandlerHandleLogMessageShouldSendTestMessage() } [TestMethod] - public void EventsHandlerHandleMultiTestRunFinalizationCompleteShouldSendFinalizationCompleteMessage() + public void EventsHandlerHandleTestRunAttachmentsProcessingCompleteShouldSendAttachmentsProcessingCompleteMessage() { var attachments = new[] { new AttachmentSet(new System.Uri("http://www.bing.com/"), "code coverage") }; - var args = new MultiTestRunFinalizationCompleteEventArgs(false, null); + var args = new TestRunAttachmentsProcessingCompleteEventArgs(false, null); - handler.HandleMultiTestRunFinalizationComplete(args, attachments); + handler.HandleTestRunAttachmentsProcessingComplete(args, attachments); - mockCommunicationManager.Verify(cm => cm.SendMessage(MessageType.MultiTestRunFinalizationComplete, It.Is(p => p.Attachments == attachments && p.FinalizationCompleteEventArgs == args))); + mockCommunicationManager.Verify(cm => cm.SendMessage(MessageType.TestRunAttachmentsProcessingComplete, It.Is(p => p.Attachments == attachments && p.AttachmentsProcessingCompleteEventArgs == args))); } [TestMethod] - public void EventsHandlerHandleMultiTestRunFinalizationProgressShouldSendFinalizationProgressMessage() + public void EventsHandlerHandleTestRunAttachmentsProcessingProgressShouldSendAttachmentsProcessingProgressMessage() { - var args = new MultiTestRunFinalizationProgressEventArgs(1, new[] { new System.Uri("http://www.bing.com/") }, 90, 2); + var args = new TestRunAttachmentsProcessingProgressEventArgs(1, new[] { new System.Uri("http://www.bing.com/") }, 90, 2); - handler.HandleMultiTestRunFinalizationProgress(args); + handler.HandleTestRunAttachmentsProcessingProgress(args); - mockCommunicationManager.Verify(cm => cm.SendMessage(MessageType.MultiTestRunFinalizationProgress, It.Is(p => p.FinalizationProgressEventArgs == args))); + mockCommunicationManager.Verify(cm => cm.SendMessage(MessageType.TestRunAttachmentsProcessingProgress, It.Is(p => p.AttachmentsProcessingProgressEventArgs == args))); } [TestMethod] diff --git a/test/Microsoft.TestPlatform.Client.UnitTests/DesignMode/DesignModeClientTests.cs b/test/Microsoft.TestPlatform.Client.UnitTests/DesignMode/DesignModeClientTests.cs index 28818876d9..1066cc4f3d 100644 --- a/test/Microsoft.TestPlatform.Client.UnitTests/DesignMode/DesignModeClientTests.cs +++ b/test/Microsoft.TestPlatform.Client.UnitTests/DesignMode/DesignModeClientTests.cs @@ -9,7 +9,7 @@ namespace Microsoft.VisualStudio.TestPlatform.Client.UnitTests.DesignMode using System.Threading.Tasks; using Microsoft.VisualStudio.TestPlatform.Client.DesignMode; - using Microsoft.VisualStudio.TestPlatform.Client.MultiTestRunFinalization; + using Microsoft.VisualStudio.TestPlatform.Client.TestRunAttachmentsProcessing; using Microsoft.VisualStudio.TestPlatform.Client.RequestHelper; using Microsoft.VisualStudio.TestPlatform.Common.Interfaces; using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities; @@ -407,89 +407,89 @@ public void DesignModeClientConnectShouldSendTestMessageAndDiscoverCompleteOnTes } [TestMethod] - public void DesignModeClientConnectShouldSendTestMessageAndFinalizationCompleteOnExceptionInFinalization() + public void DesignModeClientConnectShouldSendTestMessageAndAttachmentsProcessingCompleteOnExceptionInAttachmentsProcessing() { - var payload = new MultiTestRunFinalizationPayload(); - var startFinalization = new Message { MessageType = MessageType.MultiTestRunFinalizationStart, Payload = JToken.FromObject(payload) }; + var payload = new TestRunAttachmentsProcessingPayload(); + var startAttachmentsProcessing = new Message { MessageType = MessageType.TestRunAttachmentsProcessingStart, Payload = JToken.FromObject(payload) }; this.mockCommunicationManager.Setup(cm => cm.WaitForServerConnection(It.IsAny())).Returns(true); - this.mockCommunicationManager.SetupSequence(cm => cm.ReceiveMessage()).Returns(startFinalization); + this.mockCommunicationManager.SetupSequence(cm => cm.ReceiveMessage()).Returns(startAttachmentsProcessing); this.mockCommunicationManager - .Setup(cm => cm.SendMessage(MessageType.MultiTestRunFinalizationComplete, It.IsAny())) + .Setup(cm => cm.SendMessage(MessageType.TestRunAttachmentsProcessingComplete, It.IsAny())) .Callback(() => complateEvent.Set()); this.mockTestRequestManager.Setup( - rm => rm.FinalizeMultiTestRun( - It.IsAny(), - It.IsAny(), + rm => rm.ProcessTestRunAttachments( + It.IsAny(), + It.IsAny(), It.IsAny())) .Throws(new Exception()); this.designModeClient.ConnectToClientAndProcessRequests(PortNumber, this.mockTestRequestManager.Object); - Assert.IsTrue(this.complateEvent.WaitOne(Timeout), "Finalization not completed."); + Assert.IsTrue(this.complateEvent.WaitOne(Timeout), "AttachmentsProcessing not completed."); this.mockCommunicationManager.Verify(cm => cm.SendMessage(MessageType.TestMessage, It.IsAny()), Times.Once()); - this.mockCommunicationManager.Verify(cm => cm.SendMessage(MessageType.MultiTestRunFinalizationComplete, It.Is(p => p.Attachments == null)), Times.Once()); + this.mockCommunicationManager.Verify(cm => cm.SendMessage(MessageType.TestRunAttachmentsProcessingComplete, It.Is(p => p.Attachments == null)), Times.Once()); } [TestMethod] - public void DesignModeClientConnectShouldSendTestMessageAndDiscoverCompleteOnTestPlatformExceptionInFinalization() + public void DesignModeClientConnectShouldSendTestMessageAndDiscoverCompleteOnTestPlatformExceptionInAttachmentsProcessing() { - var payload = new MultiTestRunFinalizationPayload(); - var startFinalization = new Message { MessageType = MessageType.MultiTestRunFinalizationStart, Payload = JToken.FromObject(payload) }; + var payload = new TestRunAttachmentsProcessingPayload(); + var startAttachmentsProcessing = new Message { MessageType = MessageType.TestRunAttachmentsProcessingStart, Payload = JToken.FromObject(payload) }; this.mockCommunicationManager.Setup(cm => cm.WaitForServerConnection(It.IsAny())).Returns(true); - this.mockCommunicationManager.SetupSequence(cm => cm.ReceiveMessage()).Returns(startFinalization); + this.mockCommunicationManager.SetupSequence(cm => cm.ReceiveMessage()).Returns(startAttachmentsProcessing); this.mockCommunicationManager - .Setup(cm => cm.SendMessage(MessageType.MultiTestRunFinalizationComplete, It.IsAny())) + .Setup(cm => cm.SendMessage(MessageType.TestRunAttachmentsProcessingComplete, It.IsAny())) .Callback(() => complateEvent.Set()); this.mockTestRequestManager.Setup( - rm => rm.FinalizeMultiTestRun( - It.IsAny(), - It.IsAny(), + rm => rm.ProcessTestRunAttachments( + It.IsAny(), + It.IsAny(), It.IsAny())) .Throws(new TestPlatformException("Hello world")); this.designModeClient.ConnectToClientAndProcessRequests(PortNumber, this.mockTestRequestManager.Object); - Assert.IsTrue(this.complateEvent.WaitOne(Timeout), "Finalization not completed."); + Assert.IsTrue(this.complateEvent.WaitOne(Timeout), "AttachmentsProcessing not completed."); this.mockCommunicationManager.Verify(cm => cm.SendMessage(MessageType.TestMessage, It.IsAny()), Times.Once()); - this.mockCommunicationManager.Verify(cm => cm.SendMessage(MessageType.MultiTestRunFinalizationComplete, It.Is(p => p.Attachments == null)), Times.Once()); + this.mockCommunicationManager.Verify(cm => cm.SendMessage(MessageType.TestRunAttachmentsProcessingComplete, It.Is(p => p.Attachments == null)), Times.Once()); } [TestMethod] - public void DesignModeClientConnectShouldCallRequestManagerForFinalizationStart() + public void DesignModeClientConnectShouldCallRequestManagerForAttachmentsProcessingStart() { - var payload = new MultiTestRunFinalizationPayload(); - var startFinalization = new Message { MessageType = MessageType.MultiTestRunFinalizationStart, Payload = JToken.FromObject(payload) }; + var payload = new TestRunAttachmentsProcessingPayload(); + var startAttachmentsProcessing = new Message { MessageType = MessageType.TestRunAttachmentsProcessingStart, Payload = JToken.FromObject(payload) }; this.mockCommunicationManager.Setup(cm => cm.WaitForServerConnection(It.IsAny())).Returns(true); - this.mockCommunicationManager.SetupSequence(cm => cm.ReceiveMessage()).Returns(startFinalization); + this.mockCommunicationManager.SetupSequence(cm => cm.ReceiveMessage()).Returns(startAttachmentsProcessing); this.mockTestRequestManager .Setup( - rm => rm.FinalizeMultiTestRun( - It.IsAny(), - It.IsAny(), + rm => rm.ProcessTestRunAttachments( + It.IsAny(), + It.IsAny(), It.IsAny())) .Callback(() => complateEvent.Set()); this.designModeClient.ConnectToClientAndProcessRequests(PortNumber, this.mockTestRequestManager.Object); - Assert.IsTrue(this.complateEvent.WaitOne(Timeout), "Finalization not completed."); + Assert.IsTrue(this.complateEvent.WaitOne(Timeout), "AttachmentsProcessing not completed."); this.mockCommunicationManager.Verify(cm => cm.SendMessage(MessageType.TestMessage, It.IsAny()), Times.Never); - this.mockCommunicationManager.Verify(cm => cm.SendMessage(MessageType.MultiTestRunFinalizationComplete, It.IsAny()), Times.Never); - this.mockTestRequestManager.Verify(rm => rm.FinalizeMultiTestRun(It.IsAny(), It.IsAny(), It.IsAny())); + this.mockCommunicationManager.Verify(cm => cm.SendMessage(MessageType.TestRunAttachmentsProcessingComplete, It.IsAny()), Times.Never); + this.mockTestRequestManager.Verify(rm => rm.ProcessTestRunAttachments(It.IsAny(), It.IsAny(), It.IsAny())); } [TestMethod] - public void DesignModeClientConnectShouldCallRequestManagerForFinalizationCancel() + public void DesignModeClientConnectShouldCallRequestManagerForAttachmentsProcessingCancel() { - var cancelFinalization = new Message { MessageType = MessageType.MultiTestRunFinalizationCancel }; + var cancelAttachmentsProcessing = new Message { MessageType = MessageType.TestRunAttachmentsProcessingCancel }; this.mockCommunicationManager.Setup(cm => cm.WaitForServerConnection(It.IsAny())).Returns(true); - this.mockCommunicationManager.SetupSequence(cm => cm.ReceiveMessage()).Returns(cancelFinalization); + this.mockCommunicationManager.SetupSequence(cm => cm.ReceiveMessage()).Returns(cancelAttachmentsProcessing); this.designModeClient.ConnectToClientAndProcessRequests(PortNumber, this.mockTestRequestManager.Object); this.mockCommunicationManager.Verify(cm => cm.SendMessage(MessageType.TestMessage, It.IsAny()), Times.Never); - this.mockCommunicationManager.Verify(cm => cm.SendMessage(MessageType.MultiTestRunFinalizationComplete, It.IsAny()), Times.Never); - this.mockTestRequestManager.Verify(rm => rm.CancelMultiTestRunFinalization()); + this.mockCommunicationManager.Verify(cm => cm.SendMessage(MessageType.TestRunAttachmentsProcessingComplete, It.IsAny()), Times.Never); + this.mockTestRequestManager.Verify(rm => rm.CancelTestRunAttachmentsProcessing()); } [TestMethod] diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/MultiTestRunFinalization/MultiTestRunFinalizationManagerTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/AttachmentsProcessing/TestRunAttachmentsProcessingManagerTests.cs similarity index 74% rename from test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/MultiTestRunFinalization/MultiTestRunFinalizationManagerTests.cs rename to test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/AttachmentsProcessing/TestRunAttachmentsProcessingManagerTests.cs index a8f7aa866e..9569bde562 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/MultiTestRunFinalization/MultiTestRunFinalizationManagerTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/AttachmentsProcessing/TestRunAttachmentsProcessingManagerTests.cs @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -namespace Microsoft.TestPlatform.CrossPlatEngine.UnitTests.MultiTestRunFinalization +namespace Microsoft.TestPlatform.CrossPlatEngine.UnitTests.TestRunAttachmentsProcessing { using System; using System.Collections.Generic; @@ -10,7 +10,7 @@ namespace Microsoft.TestPlatform.CrossPlatEngine.UnitTests.MultiTestRunFinalizat using System.Threading.Tasks; using Microsoft.VisualStudio.TestPlatform.Common.Telemetry; using Microsoft.VisualStudio.TestPlatform.CoreUtilities.Tracing.Interfaces; - using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.MultiTestRunFinalization; + using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.TestRunAttachmentsProcessing; using Microsoft.VisualStudio.TestPlatform.ObjectModel; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client; using Microsoft.VisualStudio.TestPlatform.ObjectModel.DataCollection; @@ -19,7 +19,7 @@ namespace Microsoft.TestPlatform.CrossPlatEngine.UnitTests.MultiTestRunFinalizat using Moq; [TestClass] - public class MultiTestRunFinalizationManagerTests + public class TestRunAttachmentsProcessingManagerTests { private const string uri1 = "datacollector://microsoft/some1/1.0"; private const string uri2 = "datacollector://microsoft/some2/2.0"; @@ -30,11 +30,11 @@ public class MultiTestRunFinalizationManagerTests private readonly Mock mockEventSource; private readonly Mock mockAttachmentHandler1; private readonly Mock mockAttachmentHandler2; - private readonly Mock mockEventsHandler; - private readonly MultiTestRunFinalizationManager manager; + private readonly Mock mockEventsHandler; + private readonly TestRunAttachmentsProcessingManager manager; private readonly CancellationTokenSource cancellationTokenSource; - public MultiTestRunFinalizationManagerTests() + public TestRunAttachmentsProcessingManagerTests() { mockRequestData = new Mock(); mockMetricsCollection = new Mock(); @@ -43,32 +43,32 @@ public MultiTestRunFinalizationManagerTests() mockEventSource = new Mock(); mockAttachmentHandler1 = new Mock(); mockAttachmentHandler2 = new Mock(); - mockEventsHandler = new Mock(); + mockEventsHandler = new Mock(); mockAttachmentHandler1.Setup(h => h.GetExtensionUris()).Returns(new[] { new Uri(uri1) }); mockAttachmentHandler2.Setup(h => h.GetExtensionUris()).Returns(new[] { new Uri(uri2) }); - manager = new MultiTestRunFinalizationManager(mockEventSource.Object, mockAttachmentHandler1.Object, mockAttachmentHandler2.Object); + manager = new TestRunAttachmentsProcessingManager(mockEventSource.Object, mockAttachmentHandler1.Object, mockAttachmentHandler2.Object); cancellationTokenSource = new CancellationTokenSource(); } [TestMethod] - public async Task FinalizeMultiTestRunAsync_ShouldReturnInitialAttachmentsThroughEventsHandler_IfNoAttachmentsOnInput() + public async Task ProcessTestRunAttachmentsAsync_ShouldReturnInitialAttachmentsThroughEventsHandler_IfNoAttachmentsOnInput() { // arrange List inputAttachments = new List(); // act - await manager.FinalizeMultiTestRunAsync(mockRequestData.Object, inputAttachments, mockEventsHandler.Object, cancellationTokenSource.Token); + await manager.ProcessTestRunAttachmentsAsync(mockRequestData.Object, inputAttachments, mockEventsHandler.Object, cancellationTokenSource.Token); // assert VerifyCompleteEvent(false, false); - mockEventsHandler.Verify(h => h.HandleMultiTestRunFinalizationComplete(It.Is(a => !a.IsCanceled), It.Is>(c => c.Count == 0))); + mockEventsHandler.Verify(h => h.HandleTestRunAttachmentsProcessingComplete(It.Is(a => !a.IsCanceled), It.Is>(c => c.Count == 0))); mockEventsHandler.Verify(h => h.HandleLogMessage(It.IsAny(), It.IsAny()), Times.Never); - mockEventsHandler.Verify(h => h.HandleMultiTestRunFinalizationProgress(It.IsAny()), Times.Never); - mockEventSource.Verify(s => s.MultiTestRunFinalizationStart(0)); - mockEventSource.Verify(s => s.MultiTestRunFinalizationStop(0)); + mockEventsHandler.Verify(h => h.HandleTestRunAttachmentsProcessingProgress(It.IsAny()), Times.Never); + mockEventSource.Verify(s => s.TestRunAttachmentsProcessingStart(0)); + mockEventSource.Verify(s => s.TestRunAttachmentsProcessingStop(0)); mockAttachmentHandler1.Verify(h => h.GetExtensionUris(), Times.Never); mockAttachmentHandler2.Verify(h => h.GetExtensionUris(), Times.Never); mockAttachmentHandler1.Verify(h => h.ProcessAttachmentSetsAsync(It.IsAny>(), It.IsAny>(), It.IsAny(), It.IsAny()), Times.Never); @@ -78,13 +78,13 @@ public async Task FinalizeMultiTestRunAsync_ShouldReturnInitialAttachmentsThroug } [TestMethod] - public async Task FinalizeMultiTestRunAsync_ShouldReturnNoAttachments_IfNoAttachmentsOnInput() + public async Task ProcessTestRunAttachmentsAsync_ShouldReturnNoAttachments_IfNoAttachmentsOnInput() { // arrange List inputAttachments = new List(); // act - var result = await manager.FinalizeMultiTestRunAsync(mockRequestData.Object, inputAttachments, cancellationTokenSource.Token); + var result = await manager.ProcessTestRunAttachmentsAsync(mockRequestData.Object, inputAttachments, cancellationTokenSource.Token); // assert Assert.AreEqual(0, result.Count); @@ -97,7 +97,7 @@ public async Task FinalizeMultiTestRunAsync_ShouldReturnNoAttachments_IfNoAttach } [TestMethod] - public async Task FinalizeMultiTestRunAsync_ShouldReturn1NotProcessedAttachmentThroughEventsHandler_If1NotRelatedAttachmentOnInput() + public async Task ProcessTestRunAttachmentsAsync_ShouldReturn1NotProcessedAttachmentThroughEventsHandler_If1NotRelatedAttachmentOnInput() { // arrange List inputAttachments = new List @@ -106,11 +106,11 @@ public async Task FinalizeMultiTestRunAsync_ShouldReturn1NotProcessedAttachmentT }; // act - await manager.FinalizeMultiTestRunAsync(mockRequestData.Object, inputAttachments, mockEventsHandler.Object, cancellationTokenSource.Token); + await manager.ProcessTestRunAttachmentsAsync(mockRequestData.Object, inputAttachments, mockEventsHandler.Object, cancellationTokenSource.Token); // assert VerifyCompleteEvent(false, false, inputAttachments[0]); - mockEventsHandler.Verify(h => h.HandleMultiTestRunFinalizationProgress(It.IsAny()), Times.Never); + mockEventsHandler.Verify(h => h.HandleTestRunAttachmentsProcessingProgress(It.IsAny()), Times.Never); mockEventsHandler.Verify(h => h.HandleLogMessage(It.IsAny(), It.IsAny()), Times.Never); mockAttachmentHandler1.Verify(h => h.GetExtensionUris()); mockAttachmentHandler2.Verify(h => h.GetExtensionUris()); @@ -121,7 +121,7 @@ public async Task FinalizeMultiTestRunAsync_ShouldReturn1NotProcessedAttachmentT } [TestMethod] - public async Task FinalizeMultiTestRunAsync_ShouldReturn1NotProcessedAttachment_If1NotRelatedAttachmentOnInput() + public async Task ProcessTestRunAttachmentsAsync_ShouldReturn1NotProcessedAttachment_If1NotRelatedAttachmentOnInput() { // arrange List inputAttachments = new List @@ -130,7 +130,7 @@ public async Task FinalizeMultiTestRunAsync_ShouldReturn1NotProcessedAttachment_ }; // act - var result = await manager.FinalizeMultiTestRunAsync(mockRequestData.Object, inputAttachments, cancellationTokenSource.Token); + var result = await manager.ProcessTestRunAttachmentsAsync(mockRequestData.Object, inputAttachments, cancellationTokenSource.Token); // assert Assert.AreEqual(1, result.Count); @@ -144,7 +144,7 @@ public async Task FinalizeMultiTestRunAsync_ShouldReturn1NotProcessedAttachment_ } [TestMethod] - public async Task FinalizeMultiTestRunAsync_ShouldReturn1ProcessedAttachmentThroughEventsHandler_IfRelatedAttachmentOnInput() + public async Task ProcessTestRunAttachmentsAsync_ShouldReturn1ProcessedAttachmentThroughEventsHandler_IfRelatedAttachmentOnInput() { // arrange List inputAttachments = new List @@ -160,11 +160,11 @@ public async Task FinalizeMultiTestRunAsync_ShouldReturn1ProcessedAttachmentThro mockAttachmentHandler1.Setup(h => h.ProcessAttachmentSetsAsync(It.IsAny>(), It.IsAny>(), It.IsAny(), It.IsAny())).ReturnsAsync(outputAttachments); // act - await manager.FinalizeMultiTestRunAsync(mockRequestData.Object, inputAttachments, mockEventsHandler.Object, cancellationTokenSource.Token); + await manager.ProcessTestRunAttachmentsAsync(mockRequestData.Object, inputAttachments, mockEventsHandler.Object, cancellationTokenSource.Token); // assert VerifyCompleteEvent(false, false, outputAttachments[0]); - mockEventsHandler.Verify(h => h.HandleMultiTestRunFinalizationProgress(It.IsAny()), Times.Never); + mockEventsHandler.Verify(h => h.HandleTestRunAttachmentsProcessingProgress(It.IsAny()), Times.Never); mockEventsHandler.Verify(h => h.HandleLogMessage(It.IsAny(), It.IsAny()), Times.Never); mockAttachmentHandler1.Verify(h => h.GetExtensionUris()); mockAttachmentHandler2.Verify(h => h.GetExtensionUris()); @@ -175,7 +175,7 @@ public async Task FinalizeMultiTestRunAsync_ShouldReturn1ProcessedAttachmentThro } [TestMethod] - public async Task FinalizeMultiTestRunAsync_ShouldReturn1ProcessedAttachment_IfRelatedAttachmentOnInput() + public async Task ProcessTestRunAttachmentsAsync_ShouldReturn1ProcessedAttachment_IfRelatedAttachmentOnInput() { // arrange List inputAttachments = new List @@ -191,13 +191,13 @@ public async Task FinalizeMultiTestRunAsync_ShouldReturn1ProcessedAttachment_IfR mockAttachmentHandler1.Setup(h => h.ProcessAttachmentSetsAsync(It.IsAny>(), It.IsAny>(), It.IsAny(), It.IsAny())).ReturnsAsync(outputAttachments); // act - var result = await manager.FinalizeMultiTestRunAsync(mockRequestData.Object, inputAttachments, cancellationTokenSource.Token); + var result = await manager.ProcessTestRunAttachmentsAsync(mockRequestData.Object, inputAttachments, cancellationTokenSource.Token); // assert Assert.AreEqual(1, result.Count); Assert.IsTrue(result.Contains(outputAttachments[0])); - mockEventSource.Verify(s => s.MultiTestRunFinalizationStart(1)); - mockEventSource.Verify(s => s.MultiTestRunFinalizationStop(1)); + mockEventSource.Verify(s => s.TestRunAttachmentsProcessingStart(1)); + mockEventSource.Verify(s => s.TestRunAttachmentsProcessingStop(1)); mockAttachmentHandler1.Verify(h => h.GetExtensionUris()); mockAttachmentHandler2.Verify(h => h.GetExtensionUris()); mockAttachmentHandler1.Verify(h => h.ProcessAttachmentSetsAsync(It.Is>(c => c.Count == 1 && c.Contains(inputAttachments[0])), It.IsAny>(), It.IsAny(), cancellationTokenSource.Token)); @@ -207,7 +207,7 @@ public async Task FinalizeMultiTestRunAsync_ShouldReturn1ProcessedAttachment_IfR } [TestMethod] - public async Task FinalizeMultiTestRunAsync_ShouldReturnInitialAttachmentsThroughEventsHandler_IfRelatedAttachmentOnInputButHandlerThrowsException() + public async Task ProcessTestRunAttachmentsAsync_ShouldReturnInitialAttachmentsThroughEventsHandler_IfRelatedAttachmentOnInputButHandlerThrowsException() { // arrange List inputAttachments = new List @@ -218,11 +218,11 @@ public async Task FinalizeMultiTestRunAsync_ShouldReturnInitialAttachmentsThroug mockAttachmentHandler1.Setup(h => h.ProcessAttachmentSetsAsync(It.IsAny>(), It.IsAny>(), It.IsAny(), It.IsAny())).Throws(new Exception("exception message")); // act - await manager.FinalizeMultiTestRunAsync(mockRequestData.Object, inputAttachments, mockEventsHandler.Object, cancellationTokenSource.Token); + await manager.ProcessTestRunAttachmentsAsync(mockRequestData.Object, inputAttachments, mockEventsHandler.Object, cancellationTokenSource.Token); // assert VerifyCompleteEvent(false, true, inputAttachments[0]); - mockEventsHandler.Verify(h => h.HandleMultiTestRunFinalizationProgress(It.IsAny()), Times.Never); + mockEventsHandler.Verify(h => h.HandleTestRunAttachmentsProcessingProgress(It.IsAny()), Times.Never); mockEventsHandler.Verify(h => h.HandleLogMessage(TestMessageLevel.Error, "exception message"), Times.Once); mockAttachmentHandler1.Verify(h => h.GetExtensionUris()); mockAttachmentHandler2.Verify(h => h.GetExtensionUris(), Times.Never); @@ -233,7 +233,7 @@ public async Task FinalizeMultiTestRunAsync_ShouldReturnInitialAttachmentsThroug } [TestMethod] - public async Task FinalizeMultiTestRunAsync_ShouldReturnInitialAttachments_IfRelatedAttachmentOnInputButHandlerThrowsException() + public async Task ProcessTestRunAttachmentsAsync_ShouldReturnInitialAttachments_IfRelatedAttachmentOnInputButHandlerThrowsException() { // arrange List inputAttachments = new List @@ -244,7 +244,7 @@ public async Task FinalizeMultiTestRunAsync_ShouldReturnInitialAttachments_IfRel mockAttachmentHandler1.Setup(h => h.ProcessAttachmentSetsAsync(It.IsAny>(), It.IsAny>(), It.IsAny(), It.IsAny())).Throws(new Exception("exception message")); // act - var result = await manager.FinalizeMultiTestRunAsync(mockRequestData.Object, inputAttachments, cancellationTokenSource.Token); + var result = await manager.ProcessTestRunAttachmentsAsync(mockRequestData.Object, inputAttachments, cancellationTokenSource.Token); // assert Assert.AreEqual(1, result.Count); @@ -258,7 +258,7 @@ public async Task FinalizeMultiTestRunAsync_ShouldReturnInitialAttachments_IfRel } [TestMethod] - public async Task FinalizeMultiTestRunAsync_ShouldReturnInitialAttachmentsThroughEventsHandler_IfOperationIsCancelled() + public async Task ProcessTestRunAttachmentsAsync_ShouldReturnInitialAttachmentsThroughEventsHandler_IfOperationIsCancelled() { // arrange cancellationTokenSource.Cancel(); @@ -268,11 +268,11 @@ public async Task FinalizeMultiTestRunAsync_ShouldReturnInitialAttachmentsThroug }; // act - await manager.FinalizeMultiTestRunAsync(mockRequestData.Object, inputAttachments, mockEventsHandler.Object, cancellationTokenSource.Token); + await manager.ProcessTestRunAttachmentsAsync(mockRequestData.Object, inputAttachments, mockEventsHandler.Object, cancellationTokenSource.Token); // assert VerifyCompleteEvent(true, false, inputAttachments[0]); - mockEventsHandler.Verify(h => h.HandleMultiTestRunFinalizationProgress(It.IsAny()), Times.Never); + mockEventsHandler.Verify(h => h.HandleTestRunAttachmentsProcessingProgress(It.IsAny()), Times.Never); mockAttachmentHandler1.Verify(h => h.GetExtensionUris(), Times.Never); mockAttachmentHandler2.Verify(h => h.GetExtensionUris(), Times.Never); mockAttachmentHandler1.Verify(h => h.ProcessAttachmentSetsAsync(It.IsAny>(), It.IsAny>(), It.IsAny(), It.IsAny()), Times.Never); @@ -282,7 +282,7 @@ public async Task FinalizeMultiTestRunAsync_ShouldReturnInitialAttachmentsThroug } [TestMethod] - public async Task FinalizeMultiTestRunAsync_ShouldReturnInitialAttachments_IfOperationIsCancelled() + public async Task ProcessTestRunAttachmentsAsync_ShouldReturnInitialAttachments_IfOperationIsCancelled() { // arrange cancellationTokenSource.Cancel(); @@ -292,7 +292,7 @@ public async Task FinalizeMultiTestRunAsync_ShouldReturnInitialAttachments_IfOpe }; // act - var result = await manager.FinalizeMultiTestRunAsync(mockRequestData.Object, inputAttachments, cancellationTokenSource.Token); + var result = await manager.ProcessTestRunAttachmentsAsync(mockRequestData.Object, inputAttachments, cancellationTokenSource.Token); // assert Assert.AreEqual(1, result.Count); @@ -306,7 +306,7 @@ public async Task FinalizeMultiTestRunAsync_ShouldReturnInitialAttachments_IfOpe } [TestMethod] - public async Task FinalizeMultiTestRunAsync_ShouldReturnProcessedAttachmentsThroughEventsHandler_IfRelatedAttachmentsOnInput() + public async Task ProcessTestRunAttachmentsAsync_ShouldReturnProcessedAttachmentsThroughEventsHandler_IfRelatedAttachmentsOnInput() { // arrange List inputAttachments = new List @@ -332,11 +332,11 @@ public async Task FinalizeMultiTestRunAsync_ShouldReturnProcessedAttachmentsThro mockAttachmentHandler2.Setup(h => h.ProcessAttachmentSetsAsync(It.IsAny>(), It.IsAny>(), It.IsAny(), It.IsAny())).ReturnsAsync(outputAttachmentsForHandler2); // act - await manager.FinalizeMultiTestRunAsync(mockRequestData.Object, inputAttachments, mockEventsHandler.Object, cancellationTokenSource.Token); + await manager.ProcessTestRunAttachmentsAsync(mockRequestData.Object, inputAttachments, mockEventsHandler.Object, cancellationTokenSource.Token); // assert VerifyCompleteEvent(false, false, inputAttachments[4], outputAttachmentsForHandler1.First(), outputAttachmentsForHandler2.First()); - mockEventsHandler.Verify(h => h.HandleMultiTestRunFinalizationProgress(It.IsAny()), Times.Never); + mockEventsHandler.Verify(h => h.HandleTestRunAttachmentsProcessingProgress(It.IsAny()), Times.Never); mockEventsHandler.Verify(h => h.HandleLogMessage(It.IsAny(), It.IsAny()), Times.Never); mockAttachmentHandler1.Verify(h => h.GetExtensionUris()); mockAttachmentHandler2.Verify(h => h.GetExtensionUris()); @@ -347,7 +347,7 @@ public async Task FinalizeMultiTestRunAsync_ShouldReturnProcessedAttachmentsThro } [TestMethod] - public async Task FinalizeMultiTestRunAsync_ShouldReturnProcessedAttachments_IfRelatedAttachmentsOnInput() + public async Task ProcessTestRunAttachmentsAsync_ShouldReturnProcessedAttachments_IfRelatedAttachmentsOnInput() { // arrange List inputAttachments = new List @@ -373,7 +373,7 @@ public async Task FinalizeMultiTestRunAsync_ShouldReturnProcessedAttachments_IfR mockAttachmentHandler2.Setup(h => h.ProcessAttachmentSetsAsync(It.IsAny>(), It.IsAny>(), It.IsAny(), It.IsAny())).ReturnsAsync(outputAttachmentsForHandler2); // act - var result = await manager.FinalizeMultiTestRunAsync(mockRequestData.Object, inputAttachments, cancellationTokenSource.Token); + var result = await manager.ProcessTestRunAttachmentsAsync(mockRequestData.Object, inputAttachments, cancellationTokenSource.Token); // assert Assert.AreEqual(3, result.Count); @@ -389,7 +389,7 @@ public async Task FinalizeMultiTestRunAsync_ShouldReturnProcessedAttachments_IfR } [TestMethod] - public async Task FinalizeMultiTestRunAsync_ShouldReturnInitialAttachmentsThroughEventsHandler_IfOperationCancelled() + public async Task ProcessTestRunAttachmentsAsync_ShouldReturnInitialAttachmentsThroughEventsHandler_IfOperationCancelled() { // arrange List inputAttachments = new List @@ -433,18 +433,18 @@ public async Task FinalizeMultiTestRunAsync_ShouldReturnInitialAttachmentsThroug }); // act - await manager.FinalizeMultiTestRunAsync(mockRequestData.Object, inputAttachments, mockEventsHandler.Object, cancellationTokenSource.Token); - Console.WriteLine("Finalization done"); + await manager.ProcessTestRunAttachmentsAsync(mockRequestData.Object, inputAttachments, mockEventsHandler.Object, cancellationTokenSource.Token); + Console.WriteLine("Attachments processing done"); await innerTaskCompletionSource.Task; // assert VerifyCompleteEvent(true, false, inputAttachments[0]); - mockEventsHandler.Verify(h => h.HandleMultiTestRunFinalizationProgress(It.IsAny()), Times.Exactly(4)); - mockEventsHandler.Verify(h => h.HandleMultiTestRunFinalizationProgress(It.Is(a => VerifyProgressArgs(a, 1)))); - mockEventsHandler.Verify(h => h.HandleMultiTestRunFinalizationProgress(It.Is(a => VerifyProgressArgs(a, 2)))); - mockEventsHandler.Verify(h => h.HandleMultiTestRunFinalizationProgress(It.Is(a => VerifyProgressArgs(a, 3)))); - mockEventsHandler.Verify(h => h.HandleMultiTestRunFinalizationProgress(It.Is(a => VerifyProgressArgs(a, 4)))); - mockEventsHandler.Verify(h => h.HandleLogMessage(TestMessageLevel.Informational, "Finalization was cancelled.")); + mockEventsHandler.Verify(h => h.HandleTestRunAttachmentsProcessingProgress(It.IsAny()), Times.Exactly(4)); + mockEventsHandler.Verify(h => h.HandleTestRunAttachmentsProcessingProgress(It.Is(a => VerifyProgressArgs(a, 1)))); + mockEventsHandler.Verify(h => h.HandleTestRunAttachmentsProcessingProgress(It.Is(a => VerifyProgressArgs(a, 2)))); + mockEventsHandler.Verify(h => h.HandleTestRunAttachmentsProcessingProgress(It.Is(a => VerifyProgressArgs(a, 3)))); + mockEventsHandler.Verify(h => h.HandleTestRunAttachmentsProcessingProgress(It.Is(a => VerifyProgressArgs(a, 4)))); + mockEventsHandler.Verify(h => h.HandleLogMessage(TestMessageLevel.Informational, "Attachments processing was cancelled.")); mockAttachmentHandler1.Verify(h => h.GetExtensionUris()); mockAttachmentHandler2.Verify(h => h.GetExtensionUris(), Times.Never); mockAttachmentHandler1.Verify(h => h.ProcessAttachmentSetsAsync(It.Is>(c => c.Count == 1 && c.Contains(inputAttachments[0])), It.IsAny>(), It.IsAny(), cancellationTokenSource.Token)); @@ -454,7 +454,7 @@ public async Task FinalizeMultiTestRunAsync_ShouldReturnInitialAttachmentsThroug } [TestMethod] - public async Task FinalizeMultiTestRunAsync_ShouldReturnInitialAttachments_IfOperationCancelled() + public async Task ProcessTestRunAttachmentsAsync_ShouldReturnInitialAttachments_IfOperationCancelled() { // arrange List inputAttachments = new List @@ -497,8 +497,8 @@ public async Task FinalizeMultiTestRunAsync_ShouldReturnInitialAttachments_IfOpe }); // act - var result = await manager.FinalizeMultiTestRunAsync(mockRequestData.Object, inputAttachments, cancellationTokenSource.Token); - Console.WriteLine("Finalization done"); + var result = await manager.ProcessTestRunAttachmentsAsync(mockRequestData.Object, inputAttachments, cancellationTokenSource.Token); + Console.WriteLine("Attachments processing done"); await innerTaskCompletionSource.Task; // assert @@ -514,7 +514,7 @@ public async Task FinalizeMultiTestRunAsync_ShouldReturnInitialAttachments_IfOpe } [TestMethod] - public async Task FinalizeMultiTestRunAsync_ShouldReturnProperlySendProgressEvents_IfHandlersPropagesEvents() + public async Task ProcessTestRunAttachmentsAsync_ShouldReturnProperlySendProgressEvents_IfHandlersPropagesEvents() { // arrange List inputAttachments = new List @@ -536,7 +536,7 @@ public async Task FinalizeMultiTestRunAsync_ShouldReturnProperlySendProgressEven var innerTaskCompletionSource = new TaskCompletionSource(); int counter = 0; - mockEventsHandler.Setup(h => h.HandleMultiTestRunFinalizationProgress(It.IsAny())).Callback(() => + mockEventsHandler.Setup(h => h.HandleTestRunAttachmentsProcessingProgress(It.IsAny())).Callback(() => { counter++; if(counter == 6) @@ -564,18 +564,18 @@ public async Task FinalizeMultiTestRunAsync_ShouldReturnProperlySendProgressEven }); // act - await manager.FinalizeMultiTestRunAsync(mockRequestData.Object, inputAttachments, mockEventsHandler.Object, CancellationToken.None); + await manager.ProcessTestRunAttachmentsAsync(mockRequestData.Object, inputAttachments, mockEventsHandler.Object, CancellationToken.None); // assert await innerTaskCompletionSource.Task; VerifyCompleteEvent(false, false, outputAttachments1.First(), outputAttachments2.First()); - mockEventsHandler.Verify(h => h.HandleMultiTestRunFinalizationProgress(It.IsAny()), Times.Exactly(6)); - mockEventsHandler.Verify(h => h.HandleMultiTestRunFinalizationProgress(It.Is(a => VerifyProgressArgsForTwoHandlers(a, 1, 25, uri1)))); - mockEventsHandler.Verify(h => h.HandleMultiTestRunFinalizationProgress(It.Is(a => VerifyProgressArgsForTwoHandlers(a, 1, 50, uri1)))); - mockEventsHandler.Verify(h => h.HandleMultiTestRunFinalizationProgress(It.Is(a => VerifyProgressArgsForTwoHandlers(a, 1, 75, uri1)))); - mockEventsHandler.Verify(h => h.HandleMultiTestRunFinalizationProgress(It.Is(a => VerifyProgressArgsForTwoHandlers(a, 1, 100, uri1)))); - mockEventsHandler.Verify(h => h.HandleMultiTestRunFinalizationProgress(It.Is(a => VerifyProgressArgsForTwoHandlers(a, 2, 50, uri2)))); - mockEventsHandler.Verify(h => h.HandleMultiTestRunFinalizationProgress(It.Is(a => VerifyProgressArgsForTwoHandlers(a, 2, 100, uri2)))); + mockEventsHandler.Verify(h => h.HandleTestRunAttachmentsProcessingProgress(It.IsAny()), Times.Exactly(6)); + mockEventsHandler.Verify(h => h.HandleTestRunAttachmentsProcessingProgress(It.Is(a => VerifyProgressArgsForTwoHandlers(a, 1, 25, uri1)))); + mockEventsHandler.Verify(h => h.HandleTestRunAttachmentsProcessingProgress(It.Is(a => VerifyProgressArgsForTwoHandlers(a, 1, 50, uri1)))); + mockEventsHandler.Verify(h => h.HandleTestRunAttachmentsProcessingProgress(It.Is(a => VerifyProgressArgsForTwoHandlers(a, 1, 75, uri1)))); + mockEventsHandler.Verify(h => h.HandleTestRunAttachmentsProcessingProgress(It.Is(a => VerifyProgressArgsForTwoHandlers(a, 1, 100, uri1)))); + mockEventsHandler.Verify(h => h.HandleTestRunAttachmentsProcessingProgress(It.Is(a => VerifyProgressArgsForTwoHandlers(a, 2, 50, uri2)))); + mockEventsHandler.Verify(h => h.HandleTestRunAttachmentsProcessingProgress(It.Is(a => VerifyProgressArgsForTwoHandlers(a, 2, 100, uri2)))); mockAttachmentHandler1.Verify(h => h.GetExtensionUris()); mockAttachmentHandler2.Verify(h => h.GetExtensionUris()); mockAttachmentHandler1.Verify(h => h.ProcessAttachmentSetsAsync(It.Is>(c => c.Count == 1 && c.Contains(inputAttachments[0])), It.IsAny>(), It.IsAny(), CancellationToken.None)); @@ -589,23 +589,23 @@ public async Task FinalizeMultiTestRunAsync_ShouldReturnProperlySendProgressEven private void VerifyMetrics(int inputCount, int outputCount, string status = "Completed") { - mockEventSource.Verify(s => s.MultiTestRunFinalizationStart(inputCount)); - mockEventSource.Verify(s => s.MultiTestRunFinalizationStop(outputCount)); + mockEventSource.Verify(s => s.TestRunAttachmentsProcessingStart(inputCount)); + mockEventSource.Verify(s => s.TestRunAttachmentsProcessingStop(outputCount)); - mockMetricsCollection.Verify(m => m.Add(TelemetryDataConstants.NumberOfAttachmentsSentForFinalization, inputCount)); - mockMetricsCollection.Verify(m => m.Add(TelemetryDataConstants.NumberOfAttachmentsAfterFinalization, outputCount)); - mockMetricsCollection.Verify(m => m.Add(TelemetryDataConstants.FinalizationState, status)); - mockMetricsCollection.Verify(m => m.Add(TelemetryDataConstants.TimeTakenInSecForFinalization, It.IsAny())); + mockMetricsCollection.Verify(m => m.Add(TelemetryDataConstants.NumberOfAttachmentsSentForProcessing, inputCount)); + mockMetricsCollection.Verify(m => m.Add(TelemetryDataConstants.NumberOfAttachmentsAfterProcessing, outputCount)); + mockMetricsCollection.Verify(m => m.Add(TelemetryDataConstants.AttachmentsProcessingState, status)); + mockMetricsCollection.Verify(m => m.Add(TelemetryDataConstants.TimeTakenInSecForAttachmentsProcessing, It.IsAny())); } private void VerifyCompleteEvent(bool isCanceled, bool containsError, params AttachmentSet[] expectedSets) { - mockEventsHandler.Verify(h => h.HandleMultiTestRunFinalizationComplete( - It.Is(a => a.IsCanceled == isCanceled && (a.Error != null) == containsError), + mockEventsHandler.Verify(h => h.HandleTestRunAttachmentsProcessingComplete( + It.Is(a => a.IsCanceled == isCanceled && (a.Error != null) == containsError), It.Is>(c => c.Count == expectedSets.Length && expectedSets.All(e => c.Contains(e))))); } - private bool VerifyProgressArgs(MultiTestRunFinalizationProgressEventArgs args, int progress) + private bool VerifyProgressArgs(TestRunAttachmentsProcessingProgressEventArgs args, int progress) { Assert.AreEqual(1, args.CurrentAttachmentProcessorIndex); Assert.AreEqual(2, args.AttachmentProcessorsCount); @@ -614,7 +614,7 @@ private bool VerifyProgressArgs(MultiTestRunFinalizationProgressEventArgs args, return progress == args.CurrentAttachmentProcessorProgress; } - private bool VerifyProgressArgsForTwoHandlers(MultiTestRunFinalizationProgressEventArgs args, long handlerIndex, long progress, string uri) + private bool VerifyProgressArgsForTwoHandlers(TestRunAttachmentsProcessingProgressEventArgs args, long handlerIndex, long progress, string uri) { return progress == args.CurrentAttachmentProcessorProgress && args.CurrentAttachmentProcessorIndex == handlerIndex && diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/DataCollection/ParallelDataCollectionEventsHandlerTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/DataCollection/ParallelDataCollectionEventsHandlerTests.cs index e341bb5c74..6823e8efc1 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/DataCollection/ParallelDataCollectionEventsHandlerTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/DataCollection/ParallelDataCollectionEventsHandlerTests.cs @@ -27,7 +27,7 @@ public class ParallelDataCollectionEventsHandlerTests private readonly Mock mockProxyExecutionManager; private readonly Mock mockTestRunEventsHandler; private readonly Mock mockParallelProxyExecutionManager; - private readonly Mock mockMultiTestRunFinalizationManager; + private readonly Mock mockTestRunAttachmentsProcessingManager; private readonly CancellationTokenSource cancellationTokenSource; private readonly ParallelDataCollectionEventsHandler parallelDataCollectionEventsHandler; @@ -37,16 +37,16 @@ public ParallelDataCollectionEventsHandlerTests() mockProxyExecutionManager = new Mock(); mockTestRunEventsHandler = new Mock(); mockParallelProxyExecutionManager = new Mock(); - mockMultiTestRunFinalizationManager = new Mock(); + mockTestRunAttachmentsProcessingManager = new Mock(); cancellationTokenSource = new CancellationTokenSource(); parallelDataCollectionEventsHandler = new ParallelDataCollectionEventsHandler(mockRequestData.Object, mockProxyExecutionManager.Object, mockTestRunEventsHandler.Object, - mockParallelProxyExecutionManager.Object, new ParallelRunDataAggregator(), mockMultiTestRunFinalizationManager.Object, cancellationTokenSource.Token); + mockParallelProxyExecutionManager.Object, new ParallelRunDataAggregator(), mockTestRunAttachmentsProcessingManager.Object, cancellationTokenSource.Token); mockParallelProxyExecutionManager.Setup(m => m.HandlePartialRunComplete(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny>())).Returns(true); } [TestMethod] - public void HandleTestRunComplete_ShouldCallFinalizerWithAttachmentsAndUseResults() + public void HandleTestRunComplete_ShouldCallProcessTestRunAttachmentsAsyncWithAttachmentsAndUseResults() { // arrange List inputAttachments = new List @@ -61,18 +61,18 @@ public void HandleTestRunComplete_ShouldCallFinalizerWithAttachmentsAndUseResult new AttachmentSet(new Uri(uri1), "uri1_input1") }; - mockMultiTestRunFinalizationManager.Setup(f => f.FinalizeMultiTestRunAsync(mockRequestData.Object, It.IsAny>(), It.IsAny())).Returns(Task.FromResult(outputAttachments)); + mockTestRunAttachmentsProcessingManager.Setup(f => f.ProcessTestRunAttachmentsAsync(mockRequestData.Object, It.IsAny>(), It.IsAny())).Returns(Task.FromResult(outputAttachments)); // act parallelDataCollectionEventsHandler.HandleTestRunComplete(new TestRunCompleteEventArgs(null, false, false, null, null, TimeSpan.FromSeconds(1)), null, inputAttachments, null); // assert mockTestRunEventsHandler.Verify(h => h.HandleTestRunComplete(It.IsAny(), It.IsAny(), It.Is>(c => c.Count == 1 && c.Contains(outputAttachments[0])), It.IsAny>())); - mockMultiTestRunFinalizationManager.Verify(f => f.FinalizeMultiTestRunAsync(mockRequestData.Object, It.Is>(a => a.Count == 3), cancellationTokenSource.Token)); + mockTestRunAttachmentsProcessingManager.Verify(f => f.ProcessTestRunAttachmentsAsync(mockRequestData.Object, It.Is>(a => a.Count == 3), cancellationTokenSource.Token)); } [TestMethod] - public void HandleTestRunComplete_ShouldCallFinalizerWithAttachmentsAndNotUserResults_IfFinalizerReturnsNull() + public void HandleTestRunComplete_ShouldCallProcessTestRunAttachmentsAsyncWithAttachmentsAndNotUserResults_IfManagerReturnsNull() { // arrange List inputAttachments = new List @@ -82,14 +82,14 @@ public void HandleTestRunComplete_ShouldCallFinalizerWithAttachmentsAndNotUserRe new AttachmentSet(new Uri(uri3), "uri3_input1") }; - mockMultiTestRunFinalizationManager.Setup(f => f.FinalizeMultiTestRunAsync(mockRequestData.Object, It.IsAny>(), It.IsAny())).Returns(Task.FromResult((Collection)null)); + mockTestRunAttachmentsProcessingManager.Setup(f => f.ProcessTestRunAttachmentsAsync(mockRequestData.Object, It.IsAny>(), It.IsAny())).Returns(Task.FromResult((Collection)null)); // act parallelDataCollectionEventsHandler.HandleTestRunComplete(new TestRunCompleteEventArgs(null, false, false, null, null, TimeSpan.FromSeconds(1)), null, inputAttachments, null); // assert mockTestRunEventsHandler.Verify(h => h.HandleTestRunComplete(It.IsAny(), It.IsAny(), It.Is>(c => c.Count == 3), It.IsAny>())); - mockMultiTestRunFinalizationManager.Verify(f => f.FinalizeMultiTestRunAsync(mockRequestData.Object, It.Is>(a => a.Count == 3), cancellationTokenSource.Token)); + mockTestRunAttachmentsProcessingManager.Verify(f => f.ProcessTestRunAttachmentsAsync(mockRequestData.Object, It.Is>(a => a.Count == 3), cancellationTokenSource.Token)); } } } diff --git a/test/TranslationLayer.UnitTests/VsTestConsoleRequestSenderTests.cs b/test/TranslationLayer.UnitTests/VsTestConsoleRequestSenderTests.cs index b90aabfbc8..add71d422e 100644 --- a/test/TranslationLayer.UnitTests/VsTestConsoleRequestSenderTests.cs +++ b/test/TranslationLayer.UnitTests/VsTestConsoleRequestSenderTests.cs @@ -1893,79 +1893,79 @@ public async Task StartTestRunAsyncShouldLogErrorOnProcessExited() #endregion - #region Finalization Tests + #region Attachments Processing Tests [TestMethod] - public async Task FinalizeTestsShouldCompleteWithZeroAttachments() + public async Task ProcessTestRunAttachmentsAsyncShouldCompleteWithZeroAttachments() { await this.InitializeCommunicationAsync(); - var mockHandler = new Mock(); + var mockHandler = new Mock(); - var payload = new MultiTestRunFinalizationCompletePayload() + var payload = new TestRunAttachmentsProcessingCompletePayload() { - FinalizationCompleteEventArgs = new MultiTestRunFinalizationCompleteEventArgs(false, null), + AttachmentsProcessingCompleteEventArgs = new TestRunAttachmentsProcessingCompleteEventArgs(false, null), Attachments = new AttachmentSet[0] }; - var finalizationComplete = new Message() + var attachmentsProcessingComplete = new Message() { - MessageType = MessageType.MultiTestRunFinalizationComplete, + MessageType = MessageType.TestRunAttachmentsProcessingComplete, Payload = JToken.FromObject(payload) }; - this.mockCommunicationManager.Setup(cm => cm.ReceiveMessageAsync(It.IsAny())).Returns(Task.FromResult(finalizationComplete)); + this.mockCommunicationManager.Setup(cm => cm.ReceiveMessageAsync(It.IsAny())).Returns(Task.FromResult(attachmentsProcessingComplete)); - await this.requestSender.FinalizeMultiTestRunAsync(new List { new AttachmentSet(new Uri("http://www.bing.com"), "a") }, true, mockHandler.Object, CancellationToken.None); + await this.requestSender.ProcessTestRunAttachmentsAsync(new List { new AttachmentSet(new Uri("http://www.bing.com"), "a") }, true, mockHandler.Object, CancellationToken.None); - mockCommunicationManager.Verify(c => c.SendMessage(MessageType.MultiTestRunFinalizationStart, It.IsAny())); - mockCommunicationManager.Verify(c => c.SendMessage(MessageType.MultiTestRunFinalizationCancel), Times.Never); - mockHandler.Verify(mh => mh.HandleMultiTestRunFinalizationComplete(It.Is(a => !a.IsCanceled && a.Error == null), It.Is>(a => a.Count == 0)), Times.Once, "Finalization Complete must be called"); + mockCommunicationManager.Verify(c => c.SendMessage(MessageType.TestRunAttachmentsProcessingStart, It.IsAny())); + mockCommunicationManager.Verify(c => c.SendMessage(MessageType.TestRunAttachmentsProcessingCancel), Times.Never); + mockHandler.Verify(mh => mh.HandleTestRunAttachmentsProcessingComplete(It.Is(a => !a.IsCanceled && a.Error == null), It.Is>(a => a.Count == 0)), Times.Once, "Attachments Processing Complete must be called"); mockHandler.Verify(mh => mh.HandleLogMessage(It.IsAny(), It.IsAny()), Times.Never, "TestMessage event must not be called"); } [TestMethod] - public async Task FinalizeTestsShouldCompleteWithOneAttachment() + public async Task ProcessTestRunAttachmentsAsyncShouldCompleteWithOneAttachment() { await this.InitializeCommunicationAsync(); - var mockHandler = new Mock(); + var mockHandler = new Mock(); - var payload = new MultiTestRunFinalizationCompletePayload() + var payload = new TestRunAttachmentsProcessingCompletePayload() { - FinalizationCompleteEventArgs = new MultiTestRunFinalizationCompleteEventArgs(true, new Exception("msg")), + AttachmentsProcessingCompleteEventArgs = new TestRunAttachmentsProcessingCompleteEventArgs(true, new Exception("msg")), Attachments = new List { new AttachmentSet(new Uri("http://www.bing.com"), "out") } }; - var finalizationComplete = new Message() + var attachmentsProcessingComplete = new Message() { - MessageType = MessageType.MultiTestRunFinalizationComplete, + MessageType = MessageType.TestRunAttachmentsProcessingComplete, Payload = JToken.FromObject(payload) }; - this.mockCommunicationManager.Setup(cm => cm.ReceiveMessageAsync(It.IsAny())).Returns(Task.FromResult(finalizationComplete)); + this.mockCommunicationManager.Setup(cm => cm.ReceiveMessageAsync(It.IsAny())).Returns(Task.FromResult(attachmentsProcessingComplete)); - await this.requestSender.FinalizeMultiTestRunAsync(new List { new AttachmentSet(new Uri("http://www.bing.com"), "a") }, true, mockHandler.Object, CancellationToken.None); + await this.requestSender.ProcessTestRunAttachmentsAsync(new List { new AttachmentSet(new Uri("http://www.bing.com"), "a") }, true, mockHandler.Object, CancellationToken.None); - mockCommunicationManager.Verify(c => c.SendMessage(MessageType.MultiTestRunFinalizationStart, It.IsAny())); - mockCommunicationManager.Verify(c => c.SendMessage(MessageType.MultiTestRunFinalizationCancel), Times.Never); - mockHandler.Verify(mh => mh.HandleMultiTestRunFinalizationComplete(It.Is(a => a.IsCanceled && a.Error != null), It.Is>(a => a.Count == 1)), Times.Once, "Finalization Complete must be called"); + mockCommunicationManager.Verify(c => c.SendMessage(MessageType.TestRunAttachmentsProcessingStart, It.IsAny())); + mockCommunicationManager.Verify(c => c.SendMessage(MessageType.TestRunAttachmentsProcessingCancel), Times.Never); + mockHandler.Verify(mh => mh.HandleTestRunAttachmentsProcessingComplete(It.Is(a => a.IsCanceled && a.Error != null), It.Is>(a => a.Count == 1)), Times.Once, "Attachments Processing Complete must be called"); mockHandler.Verify(mh => mh.HandleLogMessage(It.IsAny(), It.IsAny()), Times.Never, "TestMessage event must not be called"); } [TestMethod] - public async Task FinalizeTestsShouldCompleteWithOneAttachmentAndTestMessage() + public async Task ProcessTestRunAttachmentsAsyncShouldCompleteWithOneAttachmentAndTestMessage() { await this.InitializeCommunicationAsync(); - var mockHandler = new Mock(); + var mockHandler = new Mock(); - var payload = new MultiTestRunFinalizationCompletePayload() + var payload = new TestRunAttachmentsProcessingCompletePayload() { - FinalizationCompleteEventArgs = new MultiTestRunFinalizationCompleteEventArgs(false, null), + AttachmentsProcessingCompleteEventArgs = new TestRunAttachmentsProcessingCompleteEventArgs(false, null), Attachments = new List { new AttachmentSet(new Uri("http://www.bing.com"), "out") } }; - var finalizationComplete = new Message() + var attachmentsProcessingComplete = new Message() { - MessageType = MessageType.MultiTestRunFinalizationComplete, + MessageType = MessageType.TestRunAttachmentsProcessingComplete, Payload = JToken.FromObject(payload) }; @@ -1974,75 +1974,75 @@ public async Task FinalizeTestsShouldCompleteWithOneAttachmentAndTestMessage() this.mockCommunicationManager.Setup(cm => cm.ReceiveMessageAsync(It.IsAny())).Returns(Task.FromResult(message)); mockHandler.Setup(mh => mh.HandleLogMessage(It.IsAny(), It.IsAny())).Callback( - () => this.mockCommunicationManager.Setup(cm => cm.ReceiveMessageAsync(It.IsAny())).Returns(Task.FromResult(finalizationComplete))); + () => this.mockCommunicationManager.Setup(cm => cm.ReceiveMessageAsync(It.IsAny())).Returns(Task.FromResult(attachmentsProcessingComplete))); - await this.requestSender.FinalizeMultiTestRunAsync(new List { new AttachmentSet(new Uri("http://www.bing.com"), "a") }, false, mockHandler.Object, CancellationToken.None); + await this.requestSender.ProcessTestRunAttachmentsAsync(new List { new AttachmentSet(new Uri("http://www.bing.com"), "a") }, false, mockHandler.Object, CancellationToken.None); - mockCommunicationManager.Verify(c => c.SendMessage(MessageType.MultiTestRunFinalizationStart, It.IsAny())); - mockCommunicationManager.Verify(c => c.SendMessage(MessageType.MultiTestRunFinalizationCancel), Times.Never); - mockHandler.Verify(mh => mh.HandleMultiTestRunFinalizationComplete(It.IsAny(), It.Is>(a => a.Count == 1)), Times.Once, "Finalization Complete must be called"); + mockCommunicationManager.Verify(c => c.SendMessage(MessageType.TestRunAttachmentsProcessingStart, It.IsAny())); + mockCommunicationManager.Verify(c => c.SendMessage(MessageType.TestRunAttachmentsProcessingCancel), Times.Never); + mockHandler.Verify(mh => mh.HandleTestRunAttachmentsProcessingComplete(It.IsAny(), It.Is>(a => a.Count == 1)), Times.Once, "Attachments Processing Complete must be called"); mockHandler.Verify(mh => mh.HandleLogMessage(TestMessageLevel.Informational, "Hello"), Times.Once, "TestMessage event must be called"); } [TestMethod] - public async Task FinalizeTestsShouldCompleteWithOneAttachmentAndProgressMessage() + public async Task ProcessTestRunAttachmentsAsyncShouldCompleteWithOneAttachmentAndProgressMessage() { await this.InitializeCommunicationAsync(); - var mockHandler = new Mock(); + var mockHandler = new Mock(); - var completePayload = new MultiTestRunFinalizationCompletePayload() + var completePayload = new TestRunAttachmentsProcessingCompletePayload() { - FinalizationCompleteEventArgs = new MultiTestRunFinalizationCompleteEventArgs(false, null), + AttachmentsProcessingCompleteEventArgs = new TestRunAttachmentsProcessingCompleteEventArgs(false, null), Attachments = new List { new AttachmentSet(new Uri("http://www.bing.com"), "out") } }; - var finalizationComplete = new Message() + var attachmentsProcessingComplete = new Message() { - MessageType = MessageType.MultiTestRunFinalizationComplete, + MessageType = MessageType.TestRunAttachmentsProcessingComplete, Payload = JToken.FromObject(completePayload) }; - var progressPayload = new MultiTestRunFinalizationProgressPayload() + var progressPayload = new TestRunAttachmentsProcessingProgressPayload() { - FinalizationProgressEventArgs = new MultiTestRunFinalizationProgressEventArgs(1, new[] { new Uri("http://www.bing.com/") }, 50, 2) + AttachmentsProcessingProgressEventArgs = new TestRunAttachmentsProcessingProgressEventArgs(1, new[] { new Uri("http://www.bing.com/") }, 50, 2) }; - var finalizationProgress = new Message() + var attachmentsProcessingProgress = new Message() { - MessageType = MessageType.MultiTestRunFinalizationProgress, + MessageType = MessageType.TestRunAttachmentsProcessingProgress, Payload = JToken.FromObject(progressPayload) }; - this.mockCommunicationManager.Setup(cm => cm.ReceiveMessageAsync(It.IsAny())).Returns(Task.FromResult(finalizationProgress)); + this.mockCommunicationManager.Setup(cm => cm.ReceiveMessageAsync(It.IsAny())).Returns(Task.FromResult(attachmentsProcessingProgress)); - mockHandler.Setup(mh => mh.HandleMultiTestRunFinalizationProgress(It.IsAny())).Callback( - () => this.mockCommunicationManager.Setup(cm => cm.ReceiveMessageAsync(It.IsAny())).Returns(Task.FromResult(finalizationComplete))); + mockHandler.Setup(mh => mh.HandleTestRunAttachmentsProcessingProgress(It.IsAny())).Callback( + () => this.mockCommunicationManager.Setup(cm => cm.ReceiveMessageAsync(It.IsAny())).Returns(Task.FromResult(attachmentsProcessingComplete))); - await this.requestSender.FinalizeMultiTestRunAsync(new List { new AttachmentSet(new Uri("http://www.bing.com"), "a") }, false, mockHandler.Object, CancellationToken.None); + await this.requestSender.ProcessTestRunAttachmentsAsync(new List { new AttachmentSet(new Uri("http://www.bing.com"), "a") }, false, mockHandler.Object, CancellationToken.None); - mockCommunicationManager.Verify(c => c.SendMessage(MessageType.MultiTestRunFinalizationStart, It.IsAny())); - mockCommunicationManager.Verify(c => c.SendMessage(MessageType.MultiTestRunFinalizationCancel), Times.Never); - mockHandler.Verify(mh => mh.HandleMultiTestRunFinalizationComplete(It.IsAny(), It.Is>(a => a.Count == 1)), Times.Once, "Finalization Complete must be called"); - mockHandler.Verify(mh => mh.HandleMultiTestRunFinalizationProgress(It.Is(a => a.CurrentAttachmentProcessorIndex == 1 && a.CurrentAttachmentProcessorUris.First() == new Uri("http://www.bing.com/") && a.CurrentAttachmentProcessorProgress == 50 && a.AttachmentProcessorsCount == 2)), Times.Once, "Finalization Progress must be called"); + mockCommunicationManager.Verify(c => c.SendMessage(MessageType.TestRunAttachmentsProcessingStart, It.IsAny())); + mockCommunicationManager.Verify(c => c.SendMessage(MessageType.TestRunAttachmentsProcessingCancel), Times.Never); + mockHandler.Verify(mh => mh.HandleTestRunAttachmentsProcessingComplete(It.IsAny(), It.Is>(a => a.Count == 1)), Times.Once, "Attachments Processing Complete must be called"); + mockHandler.Verify(mh => mh.HandleTestRunAttachmentsProcessingProgress(It.Is(a => a.CurrentAttachmentProcessorIndex == 1 && a.CurrentAttachmentProcessorUris.First() == new Uri("http://www.bing.com/") && a.CurrentAttachmentProcessorProgress == 50 && a.AttachmentProcessorsCount == 2)), Times.Once, "Attachments processing Progress must be called"); mockHandler.Verify(mh => mh.HandleLogMessage(TestMessageLevel.Informational, "Hello"), Times.Never); } [TestMethod] - public async Task FinalizeTestsShouldSendCancelMessageIfCancellationTokenCancelled() + public async Task ProcessTestRunAttachmentsAsyncShouldSendCancelMessageIfCancellationTokenCancelled() { await this.InitializeCommunicationAsync(); var cts = new CancellationTokenSource(); - var mockHandler = new Mock(); + var mockHandler = new Mock(); - var payload = new MultiTestRunFinalizationCompletePayload() + var payload = new TestRunAttachmentsProcessingCompletePayload() { Attachments = new List { new AttachmentSet(new Uri("http://www.bing.com"), "out") } }; - var finalizationComplete = new Message() + var attachmentsProcessingComplete = new Message() { - MessageType = MessageType.MultiTestRunFinalizationComplete, + MessageType = MessageType.TestRunAttachmentsProcessingComplete, Payload = JToken.FromObject(payload) }; @@ -2053,56 +2053,56 @@ public async Task FinalizeTestsShouldSendCancelMessageIfCancellationTokenCancell mockHandler.Setup(mh => mh.HandleLogMessage(It.IsAny(), It.IsAny())).Callback(() => { cts.Cancel(); - this.mockCommunicationManager.Setup(cm => cm.ReceiveMessageAsync(It.IsAny())).Returns(Task.FromResult(finalizationComplete)); + this.mockCommunicationManager.Setup(cm => cm.ReceiveMessageAsync(It.IsAny())).Returns(Task.FromResult(attachmentsProcessingComplete)); }); - await this.requestSender.FinalizeMultiTestRunAsync(new List { new AttachmentSet(new Uri("http://www.bing.com"), "a") }, false, mockHandler.Object, cts.Token); + await this.requestSender.ProcessTestRunAttachmentsAsync(new List { new AttachmentSet(new Uri("http://www.bing.com"), "a") }, false, mockHandler.Object, cts.Token); - mockCommunicationManager.Verify(c => c.SendMessage(MessageType.MultiTestRunFinalizationStart, It.IsAny())); - mockCommunicationManager.Verify(c => c.SendMessage(MessageType.MultiTestRunFinalizationCancel)); - mockHandler.Verify(mh => mh.HandleMultiTestRunFinalizationComplete(It.IsAny(), It.Is>(a => a.Count == 1)), Times.Once, "Finalization Complete must be called"); + mockCommunicationManager.Verify(c => c.SendMessage(MessageType.TestRunAttachmentsProcessingStart, It.IsAny())); + mockCommunicationManager.Verify(c => c.SendMessage(MessageType.TestRunAttachmentsProcessingCancel)); + mockHandler.Verify(mh => mh.HandleTestRunAttachmentsProcessingComplete(It.IsAny(), It.Is>(a => a.Count == 1)), Times.Once, "Attachments Processing Complete must be called"); mockHandler.Verify(mh => mh.HandleLogMessage(TestMessageLevel.Informational, "Hello"), Times.Once, "TestMessage event must be called"); } [TestMethod] - public async Task FinalizeTestsShouldSendCancelMessageIfCancellationTokenCancelledAtTheBeginning() + public async Task ProcessTestRunAttachmentsAsyncShouldSendCancelMessageIfCancellationTokenCancelledAtTheBeginning() { await this.InitializeCommunicationAsync(); var cts = new CancellationTokenSource(); cts.Cancel(); - var mockHandler = new Mock(); + var mockHandler = new Mock(); - var payload = new MultiTestRunFinalizationCompletePayload() + var payload = new TestRunAttachmentsProcessingCompletePayload() { Attachments = new List { new AttachmentSet(new Uri("http://www.bing.com"), "out") } }; - var finalizationComplete = new Message() + var attachmentsProcessingComplete = new Message() { - MessageType = MessageType.MultiTestRunFinalizationComplete, + MessageType = MessageType.TestRunAttachmentsProcessingComplete, Payload = JToken.FromObject(payload) }; - this.mockCommunicationManager.Setup(cm => cm.ReceiveMessageAsync(It.IsAny())).Returns(Task.FromResult(finalizationComplete)); + this.mockCommunicationManager.Setup(cm => cm.ReceiveMessageAsync(It.IsAny())).Returns(Task.FromResult(attachmentsProcessingComplete)); - await this.requestSender.FinalizeMultiTestRunAsync(new List { new AttachmentSet(new Uri("http://www.bing.com"), "a") }, true, mockHandler.Object, cts.Token); + await this.requestSender.ProcessTestRunAttachmentsAsync(new List { new AttachmentSet(new Uri("http://www.bing.com"), "a") }, true, mockHandler.Object, cts.Token); - mockCommunicationManager.Verify(c => c.SendMessage(MessageType.MultiTestRunFinalizationStart, It.IsAny())); - mockCommunicationManager.Verify(c => c.SendMessage(MessageType.MultiTestRunFinalizationCancel)); - mockHandler.Verify(mh => mh.HandleMultiTestRunFinalizationComplete(It.IsAny(), It.Is>(a => a.Count == 1)), Times.Once, "Finalizationomplete must be called"); + mockCommunicationManager.Verify(c => c.SendMessage(MessageType.TestRunAttachmentsProcessingStart, It.IsAny())); + mockCommunicationManager.Verify(c => c.SendMessage(MessageType.TestRunAttachmentsProcessingCancel)); + mockHandler.Verify(mh => mh.HandleTestRunAttachmentsProcessingComplete(It.IsAny(), It.Is>(a => a.Count == 1)), Times.Once, "Attachments Processing Complete must be called"); mockHandler.Verify(mh => mh.HandleLogMessage(TestMessageLevel.Informational, "Hello"), Times.Never, "TestMessage event must be called"); } [TestMethod] - public async Task FinalizeTestsShouldAbortOnExceptionInSendMessage() + public async Task ProcessTestRunAttachmentsAsyncShouldAbortOnExceptionInSendMessage() { - var mockHandler = new Mock(); - this.mockCommunicationManager.Setup(cm => cm.SendMessage(MessageType.MultiTestRunFinalizationStart, It.IsAny())).Throws(new IOException()); + var mockHandler = new Mock(); + this.mockCommunicationManager.Setup(cm => cm.SendMessage(MessageType.TestRunAttachmentsProcessingStart, It.IsAny())).Throws(new IOException()); - await this.requestSender.FinalizeMultiTestRunAsync(new List { new AttachmentSet(new Uri("http://www.bing.com"), "out") }, false, mockHandler.Object, CancellationToken.None); + await this.requestSender.ProcessTestRunAttachmentsAsync(new List { new AttachmentSet(new Uri("http://www.bing.com"), "out") }, false, mockHandler.Object, CancellationToken.None); - mockHandler.Verify(mh => mh.HandleMultiTestRunFinalizationComplete(It.Is(a => !a.IsCanceled && a.Error is IOException), null), Times.Once, "Finalization Complete must be called"); + mockHandler.Verify(mh => mh.HandleTestRunAttachmentsProcessingComplete(It.Is(a => !a.IsCanceled && a.Error is IOException), null), Times.Once, "Attachments Processing Complete must be called"); mockHandler.Verify(mh => mh.HandleLogMessage(TestMessageLevel.Error, It.IsAny()), Times.Once, "TestMessage event must be called"); this.mockCommunicationManager.Verify(cm => cm.StopServer(), Times.Never); } diff --git a/test/TranslationLayer.UnitTests/VsTestConsoleWrapperAsyncTests.cs b/test/TranslationLayer.UnitTests/VsTestConsoleWrapperAsyncTests.cs index 302302f9d5..8efdaabdd9 100644 --- a/test/TranslationLayer.UnitTests/VsTestConsoleWrapperAsyncTests.cs +++ b/test/TranslationLayer.UnitTests/VsTestConsoleWrapperAsyncTests.cs @@ -310,19 +310,19 @@ await this.consoleWrapper.RunTestsWithCustomTestHostAsync( } [TestMethod] - public async Task FinalizeMultiTestRunAsyncShouldSucceed() + public async Task ProcessTestRunAttachmentsAsyncShouldSucceed() { var attachments = new Collection(); var cancellationToken = new CancellationToken(); - await this.consoleWrapper.FinalizeMultiTestRunAsync( + await this.consoleWrapper.ProcessTestRunAttachmentsAsync( attachments, true, true, - new Mock().Object, + new Mock().Object, cancellationToken); - this.mockRequestSender.Verify(rs => rs.FinalizeMultiTestRunAsync(attachments, true, It.IsAny(), cancellationToken)); + this.mockRequestSender.Verify(rs => rs.ProcessTestRunAttachmentsAsync(attachments, true, It.IsAny(), cancellationToken)); } [TestMethod] diff --git a/test/TranslationLayer.UnitTests/VsTestConsoleWrapperTests.cs b/test/TranslationLayer.UnitTests/VsTestConsoleWrapperTests.cs index 5f3f099a76..94e451c43e 100644 --- a/test/TranslationLayer.UnitTests/VsTestConsoleWrapperTests.cs +++ b/test/TranslationLayer.UnitTests/VsTestConsoleWrapperTests.cs @@ -308,19 +308,19 @@ public void RunTestsWithSelectedTestsAndOptionsUsingACustomHostShouldPassOnOptio } [TestMethod] - public async Task FinalizeMultiTestRunAsyncShouldSucceed() + public async Task ProcessTestRunAttachmentsAsyncShouldSucceed() { var attachments = new Collection(); var cancellationToken = new CancellationToken(); - await this.consoleWrapper.FinalizeMultiTestRunAsync( + await this.consoleWrapper.ProcessTestRunAttachmentsAsync( attachments, true, true, - new Mock().Object, + new Mock().Object, cancellationToken); - this.mockRequestSender.Verify(rs => rs.FinalizeMultiTestRunAsync(attachments, true, It.IsAny(), cancellationToken)); + this.mockRequestSender.Verify(rs => rs.ProcessTestRunAttachmentsAsync(attachments, true, It.IsAny(), cancellationToken)); } [TestMethod] diff --git a/test/vstest.console.UnitTests/Processors/ListFullyQualifiedTestsArgumentProcessorTests.cs b/test/vstest.console.UnitTests/Processors/ListFullyQualifiedTestsArgumentProcessorTests.cs index 1c7cdef211..4a12456ce3 100644 --- a/test/vstest.console.UnitTests/Processors/ListFullyQualifiedTestsArgumentProcessorTests.cs +++ b/test/vstest.console.UnitTests/Processors/ListFullyQualifiedTestsArgumentProcessorTests.cs @@ -45,7 +45,7 @@ public class ListFullyQualifiedTestsArgumentProcessorTests private Task mockMetricsPublisherTask; private Mock mockMetricsPublisher; private Mock mockProcessHelper; - private Mock mockFinalizationManager; + private Mock mockAttachmentsProcessingManager; private static ListFullyQualifiedTestsArgumentExecutor GetExecutor(ITestRequestManager testRequestManager, IOutput output) { @@ -80,7 +80,7 @@ public ListFullyQualifiedTestsArgumentProcessorTests() this.mockAssemblyMetadataProvider.Setup(x => x.GetFrameWork(It.IsAny())).Returns(new FrameworkName(Constants.DotNetFramework40)); this.inferHelper = new InferHelper(this.mockAssemblyMetadataProvider.Object); this.mockProcessHelper = new Mock(); - this.mockFinalizationManager = new Mock(); + this.mockAttachmentsProcessingManager = new Mock(); } /// @@ -127,7 +127,7 @@ public void ExecutorInitializeWithValidSourceShouldAddItToTestSources() { CommandLineOptions.Instance.FileHelper = this.mockFileHelper.Object; CommandLineOptions.Instance.FilePatternParser = new FilePatternParser(new Mock().Object, this.mockFileHelper.Object); - var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, TestPlatformFactory.GetTestPlatform(), TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockFinalizationManager.Object); + var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, TestPlatformFactory.GetTestPlatform(), TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockAttachmentsProcessingManager.Object); var executor = GetExecutor(testRequestManager, null); executor.Initialize(this.dummyTestFilePath); @@ -139,7 +139,7 @@ public void ExecutorInitializeWithValidSourceShouldAddItToTestSources() public void ExecutorExecuteForNoSourcesShouldReturnFail() { CommandLineOptions.Instance.Reset(); - var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, TestPlatformFactory.GetTestPlatform(), TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockFinalizationManager.Object); + var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, TestPlatformFactory.GetTestPlatform(), TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockAttachmentsProcessingManager.Object); var executor = GetExecutor(testRequestManager, null); Assert.ThrowsException(() => executor.Execute()); @@ -156,7 +156,7 @@ public void ExecutorExecuteShouldThrowTestPlatformException() this.ResetAndAddSourceToCommandLineOptions(true); - var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockFinalizationManager.Object); + var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockAttachmentsProcessingManager.Object); var executor = GetExecutor(testRequestManager, null); @@ -173,7 +173,7 @@ public void ExecutorExecuteShouldThrowSettingsException() mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny())).Returns(mockDiscoveryRequest.Object); this.ResetAndAddSourceToCommandLineOptions(true); - var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockFinalizationManager.Object); + var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockAttachmentsProcessingManager.Object); var listTestsArgumentExecutor = GetExecutor(testRequestManager, null); @@ -192,7 +192,7 @@ public void ExecutorExecuteShouldThrowInvalidOperationException() this.ResetAndAddSourceToCommandLineOptions(true); - var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockFinalizationManager.Object); + var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockAttachmentsProcessingManager.Object); var listTestsArgumentExecutor = GetExecutor(testRequestManager, null); @@ -210,7 +210,7 @@ public void ExecutorExecuteShouldThrowOtherExceptions() this.ResetAndAddSourceToCommandLineOptions(true); - var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockFinalizationManager.Object); + var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockAttachmentsProcessingManager.Object); var executor = GetExecutor(testRequestManager, null); @@ -302,7 +302,7 @@ private void RunListFullyQualifiedTestArgumentProcessorWithTraits(Mock mockMetricsPublisherTask; private Mock mockMetricsPublisher; private Mock mockProcessHelper; - private Mock mockFinalizationManager; + private Mock mockAttachmentsProcessingManager; private static ListTestsArgumentExecutor GetExecutor(ITestRequestManager testRequestManager, IOutput output) { @@ -78,7 +78,7 @@ public ListTestsArgumentProcessorTests() this.mockAssemblyMetadataProvider.Setup(x => x.GetFrameWork(It.IsAny())).Returns(new FrameworkName(Constants.DotNetFramework40)); this.inferHelper = new InferHelper(this.mockAssemblyMetadataProvider.Object); this.mockProcessHelper = new Mock(); - this.mockFinalizationManager = new Mock(); + this.mockAttachmentsProcessingManager = new Mock(); } /// @@ -128,7 +128,7 @@ public void ExecutorInitializeWithValidSourceShouldAddItToTestSources() { CommandLineOptions.Instance.FileHelper = this.mockFileHelper.Object; CommandLineOptions.Instance.FilePatternParser = new FilePatternParser(new Mock().Object, this.mockFileHelper.Object); - var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, TestPlatformFactory.GetTestPlatform(), TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockFinalizationManager.Object); + var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, TestPlatformFactory.GetTestPlatform(), TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockAttachmentsProcessingManager.Object); var executor = GetExecutor(testRequestManager, null); executor.Initialize(this.dummyTestFilePath); @@ -141,7 +141,7 @@ public void ExecutorExecuteForNoSourcesShouldReturnFail() { CommandLineOptions.Instance.Reset(); - var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, TestPlatformFactory.GetTestPlatform(), TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockFinalizationManager.Object); + var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, TestPlatformFactory.GetTestPlatform(), TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockAttachmentsProcessingManager.Object); var executor = GetExecutor(testRequestManager, null); Assert.ThrowsException(() => executor.Execute()); @@ -158,7 +158,7 @@ public void ExecutorExecuteShouldThrowTestPlatformException() this.ResetAndAddSourceToCommandLineOptions(); - var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockFinalizationManager.Object); + var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockAttachmentsProcessingManager.Object); var executor = GetExecutor(testRequestManager, null); Assert.ThrowsException(() => executor.Execute()); @@ -175,7 +175,7 @@ public void ExecutorExecuteShouldThrowSettingsException() this.ResetAndAddSourceToCommandLineOptions(); - var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockFinalizationManager.Object); + var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockAttachmentsProcessingManager.Object); var listTestsArgumentExecutor = GetExecutor(testRequestManager, null); Assert.ThrowsException(() => listTestsArgumentExecutor.Execute()); @@ -192,7 +192,7 @@ public void ExecutorExecuteShouldThrowInvalidOperationException() this.ResetAndAddSourceToCommandLineOptions(); - var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockFinalizationManager.Object); + var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockAttachmentsProcessingManager.Object); var listTestsArgumentExecutor = GetExecutor(testRequestManager, null); Assert.ThrowsException(() => listTestsArgumentExecutor.Execute()); @@ -209,7 +209,7 @@ public void ExecutorExecuteShouldThrowOtherExceptions() this.ResetAndAddSourceToCommandLineOptions(); - var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockFinalizationManager.Object); + var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockAttachmentsProcessingManager.Object); var executor = GetExecutor(testRequestManager, null); Assert.ThrowsException(() => executor.Execute()); @@ -266,7 +266,7 @@ private void RunListTestArgumentProcessorExecuteWithMockSetup(Mock mockMetricsPublisherTask; private Mock mockMetricsPublisher; private Mock mockProcessHelper; - private Mock mockFinalizationManager; + private Mock mockAttachmentsProcessingManager; private RunSpecificTestsArgumentExecutor GetExecutor(ITestRequestManager testRequestManager) { @@ -69,7 +69,7 @@ public RunSpecificTestsArgumentProcessorTests() this.mockProcessHelper = new Mock(); this.mockProcessHelper.Setup(x => x.GetCurrentProcessId()).Returns(1234); this.mockProcessHelper.Setup(x => x.GetProcessName(It.IsAny())).Returns("dotnet.exe"); - this.mockFinalizationManager = new Mock(); + this.mockAttachmentsProcessingManager = new Mock(); } [TestMethod] @@ -114,7 +114,7 @@ public void InitializeShouldThrowIfArgumentIsNull() { CommandLineOptions.Instance.Reset(); - var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, TestPlatformFactory.GetTestPlatform(), TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockFinalizationManager.Object); + var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, TestPlatformFactory.GetTestPlatform(), TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockAttachmentsProcessingManager.Object); var executor = GetExecutor(testRequestManager); Assert.ThrowsException(() => { executor.Initialize(null); }); @@ -125,7 +125,7 @@ public void InitializeShouldThrowIfArgumentIsEmpty() { CommandLineOptions.Instance.Reset(); - var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, TestPlatformFactory.GetTestPlatform(), TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockFinalizationManager.Object); + var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, TestPlatformFactory.GetTestPlatform(), TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockAttachmentsProcessingManager.Object); var executor = GetExecutor(testRequestManager); Assert.ThrowsException(() => { executor.Initialize(String.Empty); }); @@ -136,7 +136,7 @@ public void InitializeShouldThrowIfArgumentIsWhiteSpace() { CommandLineOptions.Instance.Reset(); - var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, TestPlatformFactory.GetTestPlatform(), TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockFinalizationManager.Object); + var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, TestPlatformFactory.GetTestPlatform(), TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockAttachmentsProcessingManager.Object); var executor = GetExecutor(testRequestManager); Assert.ThrowsException(() => { executor.Initialize(" "); }); @@ -147,7 +147,7 @@ public void InitializeShouldThrowIfArgumentsAreEmpty() { CommandLineOptions.Instance.Reset(); - var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, TestPlatformFactory.GetTestPlatform(), TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockFinalizationManager.Object); + var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, TestPlatformFactory.GetTestPlatform(), TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockAttachmentsProcessingManager.Object); var executor = GetExecutor(testRequestManager); Assert.ThrowsException(() => { executor.Initialize(" , "); }); @@ -158,7 +158,7 @@ public void ExecutorShouldSplitTestsSeparatedByComma() { CommandLineOptions.Instance.Reset(); - var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, TestPlatformFactory.GetTestPlatform(), TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockFinalizationManager.Object); + var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, TestPlatformFactory.GetTestPlatform(), TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockAttachmentsProcessingManager.Object); var executor = GetExecutor(testRequestManager); Assert.ThrowsException(() => executor.Execute()); @@ -169,7 +169,7 @@ public void ExecutorExecuteForNoSourcesShouldThrowCommandLineException() { CommandLineOptions.Instance.Reset(); - var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, TestPlatformFactory.GetTestPlatform(), TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockFinalizationManager.Object); + var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, TestPlatformFactory.GetTestPlatform(), TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockAttachmentsProcessingManager.Object); var executor = GetExecutor(testRequestManager); Assert.ThrowsException(() => executor.Execute()); @@ -192,7 +192,7 @@ public void ExecutorExecuteForValidSourceWithTestCaseFilterShouldRunTests() mockTestPlatform.Setup(tp => tp.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny())).Returns(mockTestRunRequest.Object); mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny())).Returns(mockDiscoveryRequest.Object); - var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockFinalizationManager.Object);; + var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockAttachmentsProcessingManager.Object);; var executor = GetExecutor(testRequestManager); CommandLineOptions.Instance.TestCaseFilterValue = "Filter"; @@ -217,7 +217,7 @@ public void ExecutorExecuteShouldThrowTestPlatformExceptionThrownDuringDiscovery mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny())).Returns(mockDiscoveryRequest.Object); this.ResetAndAddSourceToCommandLineOptions(); - var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockFinalizationManager.Object);; + var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockAttachmentsProcessingManager.Object);; var executor = GetExecutor(testRequestManager); Assert.ThrowsException(() => executor.Execute()); @@ -235,7 +235,7 @@ public void ExecutorExecuteShouldThrowInvalidOperationExceptionThrownDuringDisco mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny())).Returns(mockDiscoveryRequest.Object); this.ResetAndAddSourceToCommandLineOptions(); - var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockFinalizationManager.Object);; + var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockAttachmentsProcessingManager.Object);; var executor = GetExecutor(testRequestManager); Assert.ThrowsException(() => executor.Execute()); @@ -253,7 +253,7 @@ public void ExecutorExecuteShouldThrowSettingsExceptionThrownDuringDiscovery() mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny())).Returns(mockDiscoveryRequest.Object); this.ResetAndAddSourceToCommandLineOptions(); - var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockFinalizationManager.Object);; + var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockAttachmentsProcessingManager.Object);; var executor = GetExecutor(testRequestManager); Assert.ThrowsException(() => executor.Execute()); @@ -276,7 +276,7 @@ public void ExecutorExecuteShouldThrowTestPlatformExceptionThrownDuringExecution mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny())).Returns(mockDiscoveryRequest.Object); this.ResetAndAddSourceToCommandLineOptions(); - var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockFinalizationManager.Object);; + var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockAttachmentsProcessingManager.Object);; var executor = GetExecutor(testRequestManager); executor.Initialize("Test1"); @@ -301,7 +301,7 @@ public void ExecutorExecuteShouldThrowSettingsExceptionThrownDuringExecution() mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny())).Returns(mockDiscoveryRequest.Object); this.ResetAndAddSourceToCommandLineOptions(); - var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockFinalizationManager.Object);; + var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockAttachmentsProcessingManager.Object);; var executor = GetExecutor(testRequestManager); executor.Initialize("Test1"); @@ -327,7 +327,7 @@ public void ExecutorExecuteShouldThrowInvalidOperationExceptionThrownDuringExecu this.ResetAndAddSourceToCommandLineOptions(); - var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockFinalizationManager.Object);; + var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockAttachmentsProcessingManager.Object);; var executor = GetExecutor(testRequestManager); executor.Initialize("Test1"); @@ -348,7 +348,7 @@ public void ExecutorExecuteShouldForValidSourcesAndNoTestsDiscoveredShouldLogWar 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())).Returns(mockDiscoveryRequest.Object); - var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockFinalizationManager.Object);; + var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockAttachmentsProcessingManager.Object);; var executor = GetExecutor(testRequestManager); executor.Initialize("Test1"); @@ -369,7 +369,7 @@ public void ExecutorExecuteShouldForValidSourcesAndNoTestsDiscoveredShouldLogApp 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())).Returns(mockDiscoveryRequest.Object); - var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockFinalizationManager.Object);; + var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockAttachmentsProcessingManager.Object);; var executor = GetExecutor(testRequestManager); executor.Initialize("Test1"); @@ -396,7 +396,7 @@ public void ExecutorExecuteShouldForValidSourcesAndValidSelectedTestsRunsTestsAn mockTestPlatform.Setup(tp => tp.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny())).Returns(mockTestRunRequest.Object); mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny())).Returns(mockDiscoveryRequest.Object); - var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockFinalizationManager.Object);; + var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockAttachmentsProcessingManager.Object);; var executor = GetExecutor(testRequestManager); executor.Initialize("Test1"); @@ -422,7 +422,7 @@ public void ExecutorShouldRunTestsWhenTestsAreCommaSeparated() mockTestPlatform.Setup(tp => tp.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny())).Returns(mockTestRunRequest.Object); mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny())).Returns(mockDiscoveryRequest.Object); - var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockFinalizationManager.Object);; + var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockAttachmentsProcessingManager.Object);; var executor = GetExecutor(testRequestManager); executor.Initialize("Test1, Test2"); @@ -449,7 +449,7 @@ public void ExecutorShouldRunTestsWhenTestsAreFiltered() mockTestPlatform.Setup(tp => tp.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny())).Returns(mockTestRunRequest.Object); mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny())).Returns(mockDiscoveryRequest.Object); - var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockFinalizationManager.Object);; + var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockAttachmentsProcessingManager.Object);; var executor = GetExecutor(testRequestManager); executor.Initialize("Test1"); @@ -475,7 +475,7 @@ public void ExecutorShouldWarnWhenTestsAreNotAvailable() mockTestPlatform.Setup(tp => tp.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny())).Returns(mockTestRunRequest.Object); mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny())).Returns(mockDiscoveryRequest.Object); - var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockFinalizationManager.Object);; + var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockAttachmentsProcessingManager.Object);; var executor = GetExecutor(testRequestManager); executor.Initialize("Test1, Test2"); @@ -502,7 +502,7 @@ public void ExecutorShouldRunTestsWhenTestsAreCommaSeparatedWithEscape() mockTestPlatform.Setup(tp => tp.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny())).Returns(mockTestRunRequest.Object); mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny())).Returns(mockDiscoveryRequest.Object); - var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockFinalizationManager.Object);; + var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockAttachmentsProcessingManager.Object);; var executor = GetExecutor(testRequestManager); executor.Initialize("Test1(a\\,b), Test2(c\\,d)"); @@ -532,7 +532,7 @@ public void ExecutorShouldDisplayWarningIfNoTestsAreExecuted() mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny())).Returns(mockDiscoveryRequest.Object); this.ResetAndAddSourceToCommandLineOptions(); - var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockFinalizationManager.Object);; + var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockAttachmentsProcessingManager.Object);; var executor = GetExecutor(testRequestManager); executor.Initialize("Test1"); @@ -561,7 +561,7 @@ public void ExecutorShouldNotDisplayWarningIfTestsAreExecuted() mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny())).Returns(mockDiscoveryRequest.Object); this.ResetAndAddSourceToCommandLineOptions(); - var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockFinalizationManager.Object);; + var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockAttachmentsProcessingManager.Object);; var executor = GetExecutor(testRequestManager); executor.Initialize("Test1"); diff --git a/test/vstest.console.UnitTests/Processors/RunTestsArgumentProcessorTests.cs b/test/vstest.console.UnitTests/Processors/RunTestsArgumentProcessorTests.cs index ac7d49b522..d3b3814117 100644 --- a/test/vstest.console.UnitTests/Processors/RunTestsArgumentProcessorTests.cs +++ b/test/vstest.console.UnitTests/Processors/RunTestsArgumentProcessorTests.cs @@ -48,7 +48,7 @@ public class RunTestsArgumentProcessorTests private Task mockMetricsPublisherTask; private Mock mockMetricsPublisher; private Mock mockProcessHelper; - private Mock mockFinalizationManager; + private Mock mockAttachmentsProcessingManager; public RunTestsArgumentProcessorTests() { @@ -66,7 +66,7 @@ public RunTestsArgumentProcessorTests() .Returns(Architecture.X86); this.mockAssemblyMetadataProvider.Setup(x => x.GetFrameWork(It.IsAny())).Returns(new FrameworkName(Constants.DotNetFramework40)); this.mockProcessHelper = new Mock(); - this.mockFinalizationManager = new Mock(); + this.mockAttachmentsProcessingManager = new Mock(); } [TestMethod] @@ -112,7 +112,7 @@ public void ExecutorExecuteShouldReturnSuccessWithoutExecutionInDesignMode() CommandLineOptions.Instance.Reset(); CommandLineOptions.Instance.IsDesignMode = true; - var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, TestPlatformFactory.GetTestPlatform(), TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockFinalizationManager.Object); + var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, TestPlatformFactory.GetTestPlatform(), TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockAttachmentsProcessingManager.Object); var executor = new RunTestsArgumentExecutor(CommandLineOptions.Instance, runSettingsProvider, testRequestManager, this.mockOutput.Object); Assert.AreEqual(ArgumentProcessorResult.Success, executor.Execute()); @@ -122,7 +122,7 @@ public void ExecutorExecuteShouldReturnSuccessWithoutExecutionInDesignMode() public void ExecutorExecuteForNoSourcesShouldThrowCommandLineException() { CommandLineOptions.Instance.Reset(); - var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, TestPlatformFactory.GetTestPlatform(), TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockFinalizationManager.Object); + var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, TestPlatformFactory.GetTestPlatform(), TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockAttachmentsProcessingManager.Object); var executor = GetExecutor(testRequestManager); Assert.ThrowsException(() => executor.Execute()); @@ -151,7 +151,7 @@ public void ExecutorExecuteShouldThrowTestPlatformException() mockTestPlatform.Setup(tp => tp.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny())).Returns(mockTestRunRequest.Object); this.ResetAndAddSourceToCommandLineOptions(); - var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockFinalizationManager.Object); + var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockAttachmentsProcessingManager.Object); var executor = GetExecutor(testRequestManager); Assert.ThrowsException(() => executor.Execute()); @@ -167,7 +167,7 @@ public void ExecutorExecuteShouldThrowSettingsException() mockTestPlatform.Setup(tp => tp.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny())).Returns(mockTestRunRequest.Object); this.ResetAndAddSourceToCommandLineOptions(); - var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockFinalizationManager.Object); + var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockAttachmentsProcessingManager.Object); var executor = GetExecutor(testRequestManager); Assert.ThrowsException(() => executor.Execute()); @@ -183,7 +183,7 @@ public void ExecutorExecuteShouldThrowInvalidOperationException() mockTestPlatform.Setup(tp => tp.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny())).Returns(mockTestRunRequest.Object); this.ResetAndAddSourceToCommandLineOptions(); - var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockFinalizationManager.Object); + var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockAttachmentsProcessingManager.Object); var executor = GetExecutor(testRequestManager); Assert.ThrowsException(() => executor.Execute()); @@ -199,7 +199,7 @@ public void ExecutorExecuteShouldThrowOtherExceptions() mockTestPlatform.Setup(tp => tp.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny())).Returns(mockTestRunRequest.Object); this.ResetAndAddSourceToCommandLineOptions(); - var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockFinalizationManager.Object); + var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockAttachmentsProcessingManager.Object); var executor = GetExecutor(testRequestManager); Assert.ThrowsException(() => executor.Execute()); @@ -254,7 +254,7 @@ private ArgumentProcessorResult RunRunArgumentProcessorExecuteWithMockSetup(ITes this.ResetAndAddSourceToCommandLineOptions(); - var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockFinalizationManager.Object); + var testRequestManager = new TestRequestManager(CommandLineOptions.Instance, mockTestPlatform.Object, TestRunResultAggregator.Instance, this.mockTestPlatformEventSource.Object, this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, this.mockAttachmentsProcessingManager.Object); var executor = GetExecutor(testRequestManager); return executor.Execute(); diff --git a/test/vstest.console.UnitTests/TestPlatformHelpers/TestRequestManagerTests.cs b/test/vstest.console.UnitTests/TestPlatformHelpers/TestRequestManagerTests.cs index 768263b8a1..e8f7ba2a30 100644 --- a/test/vstest.console.UnitTests/TestPlatformHelpers/TestRequestManagerTests.cs +++ b/test/vstest.console.UnitTests/TestPlatformHelpers/TestRequestManagerTests.cs @@ -52,7 +52,7 @@ public class TestRequestManagerTests private Task mockMetricsPublisherTask; private Mock mockMetricsPublisher; private Mock mockProcessHelper; - private Mock mockFinalizationManager; + private Mock mockAttachmentsProcessingManager; private const string DefaultRunsettings = @" @@ -77,7 +77,7 @@ public TestRequestManagerTests() this.mockMetricsPublisher = new Mock(); this.mockMetricsPublisherTask = Task.FromResult(this.mockMetricsPublisher.Object); - this.mockFinalizationManager = new Mock(); + this.mockAttachmentsProcessingManager = new Mock(); this.testRequestManager = new TestRequestManager( this.commandLineOptions, this.mockTestPlatform.Object, @@ -86,7 +86,7 @@ public TestRequestManagerTests() this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, - this.mockFinalizationManager.Object); + this.mockAttachmentsProcessingManager.Object); this.mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny())) .Returns(this.mockDiscoveryRequest.Object); this.mockTestPlatform.Setup(tp => tp.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny())) @@ -120,7 +120,7 @@ public void TestRequestManagerShouldNotInitializeConsoleLoggerIfDesignModeIsSet( this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, - this.mockFinalizationManager.Object); + this.mockAttachmentsProcessingManager.Object); Assert.IsFalse(this.mockLoggerEvents.EventsSubscribed()); } @@ -203,7 +203,7 @@ public void DiscoverTestsShouldCallTestPlatformAndSucceed() this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, - this.mockFinalizationManager.Object); + this.mockAttachmentsProcessingManager.Object); this.testRequestManager.DiscoverTests(payload, mockDiscoveryRegistrar.Object, this.protocolConfig); @@ -253,7 +253,7 @@ public void DiscoverTestsShouldPassSameProtocolConfigInRequestData() this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, - this.mockFinalizationManager.Object); + this.mockAttachmentsProcessingManager.Object); // Act this.testRequestManager.DiscoverTests(payload, mockDiscoveryRegistrar.Object, mockProtocolConfig); @@ -301,7 +301,7 @@ public void DiscoverTestsShouldCollectMetrics() this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, - this.mockFinalizationManager.Object); + this.mockAttachmentsProcessingManager.Object); // Act @@ -351,7 +351,7 @@ public void DiscoverTestsShouldCollectTargetDeviceLocalMachineIfTargetDeviceStri this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, - this.mockFinalizationManager.Object); + this.mockAttachmentsProcessingManager.Object); // Act @@ -395,7 +395,7 @@ public void DiscoverTestsShouldCollectTargetDeviceIfTargetDeviceIsDevice() this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, - this.mockFinalizationManager.Object); + this.mockAttachmentsProcessingManager.Object); // Act @@ -439,7 +439,7 @@ public void DiscoverTestsShouldCollectTargetDeviceIfTargetDeviceIsEmulator() this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, - this.mockFinalizationManager.Object); + this.mockAttachmentsProcessingManager.Object); // Act @@ -483,7 +483,7 @@ public void DiscoverTestsShouldCollectCommands() this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, - this.mockFinalizationManager.Object); + this.mockAttachmentsProcessingManager.Object); CommandLineOptions.Instance.Parallel = true; CommandLineOptions.Instance.EnableCodeCoverage = true; @@ -539,7 +539,7 @@ public void DiscoverTestsShouldCollectTestSettings() this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, - this.mockFinalizationManager.Object); + this.mockAttachmentsProcessingManager.Object); CommandLineOptions.Instance.SettingsFile = @"c://temp/.testsettings"; @@ -587,7 +587,7 @@ public void DiscoverTestsShouldCollectVsmdiFile() this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, - this.mockFinalizationManager.Object); + this.mockAttachmentsProcessingManager.Object); CommandLineOptions.Instance.SettingsFile = @"c://temp/.vsmdi"; @@ -635,7 +635,7 @@ public void DiscoverTestsShouldCollectTestRunConfigFile() this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, - this.mockFinalizationManager.Object); + this.mockAttachmentsProcessingManager.Object); CommandLineOptions.Instance.SettingsFile = @"c://temp/.testrunConfig"; @@ -958,7 +958,7 @@ public void RunTestsShouldCollectCommands() this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, - this.mockFinalizationManager.Object); + this.mockAttachmentsProcessingManager.Object); CommandLineOptions.Instance.Parallel = true; CommandLineOptions.Instance.EnableCodeCoverage = true; @@ -1026,7 +1026,7 @@ public void RunTestsShouldCollectTelemetryForLegacySettings() this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, - this.mockFinalizationManager.Object); + this.mockAttachmentsProcessingManager.Object); // Act. this.testRequestManager.RunTests(payload, new Mock().Object, new Mock().Object, mockProtocolConfig); @@ -1076,7 +1076,7 @@ public void RunTestsShouldCollectTelemetryForTestSettingsEmbeddedInsideRunSettin this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, - this.mockFinalizationManager.Object); + this.mockAttachmentsProcessingManager.Object); // Act. this.testRequestManager.RunTests(payload, new Mock().Object, new Mock().Object, mockProtocolConfig); @@ -1124,7 +1124,7 @@ public void RunTestsShouldCollectMetrics() this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, - this.mockFinalizationManager.Object); + this.mockAttachmentsProcessingManager.Object); // Act. this.testRequestManager.RunTests(payload, new Mock().Object, new Mock().Object, mockProtocolConfig); @@ -1172,7 +1172,7 @@ public void RunTestsWithSourcesShouldCallTestPlatformAndSucceed() this.inferHelper, this.mockMetricsPublisherTask, this.mockProcessHelper.Object, - this.mockFinalizationManager.Object); + this.mockAttachmentsProcessingManager.Object); this.testRequestManager.RunTests(payload, mockCustomlauncher.Object, mockRunEventsRegistrar.Object, this.protocolConfig); @@ -2178,63 +2178,63 @@ public void DiscoverTestsShouldOverrideOnlyAssemblyNameIfConsoleLoggerAlreadyPre } [TestMethod] - public void FinalizeMultiTestRunShouldSucceedWithTelemetryEnabled() + public void ProcessTestRunAttachmentsShouldSucceedWithTelemetryEnabled() { - var mockEventsHandler = new Mock(); - mockFinalizationManager - .Setup(m => m.FinalizeMultiTestRunAsync(It.IsAny(), It.IsAny>(), It.IsAny(), It.IsAny())) - .Returns((IRequestData r, ICollection a, IMultiTestRunFinalizationEventsHandler h, CancellationToken token) => Task.Run(() => + var mockEventsHandler = new Mock(); + mockAttachmentsProcessingManager + .Setup(m => m.ProcessTestRunAttachmentsAsync(It.IsAny(), It.IsAny>(), It.IsAny(), It.IsAny())) + .Returns((IRequestData r, ICollection a, ITestRunAttachmentsProcessingEventsHandler h, CancellationToken token) => Task.Run(() => { - r.MetricsCollection.Add(TelemetryDataConstants.NumberOfAttachmentsSentForFinalization, 5); - r.MetricsCollection.Add(TelemetryDataConstants.NumberOfAttachmentsAfterFinalization, 1); + r.MetricsCollection.Add(TelemetryDataConstants.NumberOfAttachmentsSentForProcessing, 5); + r.MetricsCollection.Add(TelemetryDataConstants.NumberOfAttachmentsAfterProcessing, 1); })); - var payload = new MultiTestRunFinalizationPayload() + var payload = new TestRunAttachmentsProcessingPayload() { Attachments = new List { new AttachmentSet(new Uri("http://www.bing.com"), "out") }, CollectMetrics = true }; - testRequestManager.FinalizeMultiTestRun(payload, mockEventsHandler.Object, this.protocolConfig); + testRequestManager.ProcessTestRunAttachments(payload, mockEventsHandler.Object, this.protocolConfig); - mockFinalizationManager.Verify(m => m.FinalizeMultiTestRunAsync(It.Is(r => r.IsTelemetryOptedIn), payload.Attachments, mockEventsHandler.Object, It.IsAny())); - mockTestPlatformEventSource.Verify(es => es.MultiTestRunFinalizationRequestStart()); - mockTestPlatformEventSource.Verify(es => es.MultiTestRunFinalizationRequestStop()); + mockAttachmentsProcessingManager.Verify(m => m.ProcessTestRunAttachmentsAsync(It.Is(r => r.IsTelemetryOptedIn), payload.Attachments, mockEventsHandler.Object, It.IsAny())); + mockTestPlatformEventSource.Verify(es => es.TestRunAttachmentsProcessingRequestStart()); + mockTestPlatformEventSource.Verify(es => es.TestRunAttachmentsProcessingRequestStop()); - mockMetricsPublisher.Verify(p => p.PublishMetrics(TelemetryDataConstants.TestFinalizationCompleteEvent, + mockMetricsPublisher.Verify(p => p.PublishMetrics(TelemetryDataConstants.TestAttachmentsProcessingCompleteEvent, It.Is>(m => m.Count == 2 && - m.ContainsKey(TelemetryDataConstants.NumberOfAttachmentsSentForFinalization) && (int)m[TelemetryDataConstants.NumberOfAttachmentsSentForFinalization] == 5 && - m.ContainsKey(TelemetryDataConstants.NumberOfAttachmentsAfterFinalization) && (int)m[TelemetryDataConstants.NumberOfAttachmentsAfterFinalization] == 1))); + m.ContainsKey(TelemetryDataConstants.NumberOfAttachmentsSentForProcessing) && (int)m[TelemetryDataConstants.NumberOfAttachmentsSentForProcessing] == 5 && + m.ContainsKey(TelemetryDataConstants.NumberOfAttachmentsAfterProcessing) && (int)m[TelemetryDataConstants.NumberOfAttachmentsAfterProcessing] == 1))); } [TestMethod] - public void FinalizeMultiTestRunShouldSucceedWithTelemetryDisabled() + public void ProcessTestRunAttachmentsShouldSucceedWithTelemetryDisabled() { - var mockEventsHandler = new Mock(); - mockFinalizationManager - .Setup(m => m.FinalizeMultiTestRunAsync(It.IsAny(), It.IsAny>(), It.IsAny(), It.IsAny())) + var mockEventsHandler = new Mock(); + mockAttachmentsProcessingManager + .Setup(m => m.ProcessTestRunAttachmentsAsync(It.IsAny(), It.IsAny>(), It.IsAny(), It.IsAny())) .Returns(Task.FromResult(true)); - var payload = new MultiTestRunFinalizationPayload() + var payload = new TestRunAttachmentsProcessingPayload() { Attachments = new List { new AttachmentSet(new Uri("http://www.bing.com"), "out") }, CollectMetrics = false }; - testRequestManager.FinalizeMultiTestRun(payload, mockEventsHandler.Object, this.protocolConfig); + testRequestManager.ProcessTestRunAttachments(payload, mockEventsHandler.Object, this.protocolConfig); - mockFinalizationManager.Verify(m => m.FinalizeMultiTestRunAsync(It.Is(r => !r.IsTelemetryOptedIn), payload.Attachments, mockEventsHandler.Object, It.IsAny())); - mockTestPlatformEventSource.Verify(es => es.MultiTestRunFinalizationRequestStart()); - mockTestPlatformEventSource.Verify(es => es.MultiTestRunFinalizationRequestStop()); + mockAttachmentsProcessingManager.Verify(m => m.ProcessTestRunAttachmentsAsync(It.Is(r => !r.IsTelemetryOptedIn), payload.Attachments, mockEventsHandler.Object, It.IsAny())); + mockTestPlatformEventSource.Verify(es => es.TestRunAttachmentsProcessingRequestStart()); + mockTestPlatformEventSource.Verify(es => es.TestRunAttachmentsProcessingRequestStop()); } [TestMethod] - public async Task CancelMultiTestRunFinalizationShouldSucceedIfRequestInProgress() + public async Task CancelTestRunAttachmentsProcessingShouldSucceedIfRequestInProgress() { - var mockEventsHandler = new Mock(); - mockFinalizationManager - .Setup(m => m.FinalizeMultiTestRunAsync(It.IsAny(), It.IsAny>(), It.IsAny(), It.IsAny())) - .Returns((IRequestData r, ICollection a, IMultiTestRunFinalizationEventsHandler h, CancellationToken token) => Task.Run(() => + var mockEventsHandler = new Mock(); + mockAttachmentsProcessingManager + .Setup(m => m.ProcessTestRunAttachmentsAsync(It.IsAny(), It.IsAny>(), It.IsAny(), It.IsAny())) + .Returns((IRequestData r, ICollection a, ITestRunAttachmentsProcessingEventsHandler h, CancellationToken token) => Task.Run(() => { int i = 0; while (!token.IsCancellationRequested) @@ -2244,33 +2244,33 @@ public async Task CancelMultiTestRunFinalizationShouldSucceedIfRequestInProgress Task.Delay(5).Wait(); } - r.MetricsCollection.Add(TelemetryDataConstants.FinalizationState, "Canceled"); + r.MetricsCollection.Add(TelemetryDataConstants.AttachmentsProcessingState, "Canceled"); })); - var payload = new MultiTestRunFinalizationPayload() + var payload = new TestRunAttachmentsProcessingPayload() { Attachments = new List { new AttachmentSet(new Uri("http://www.bing.com"), "out") }, CollectMetrics = true }; - Task task = Task.Run(() => testRequestManager.FinalizeMultiTestRun(payload, mockEventsHandler.Object, this.protocolConfig)); + Task task = Task.Run(() => testRequestManager.ProcessTestRunAttachments(payload, mockEventsHandler.Object, this.protocolConfig)); await Task.Delay(50); - testRequestManager.CancelMultiTestRunFinalization(); + testRequestManager.CancelTestRunAttachmentsProcessing(); await task; - mockFinalizationManager.Verify(m => m.FinalizeMultiTestRunAsync(It.IsAny(), payload.Attachments, mockEventsHandler.Object, It.IsAny())); - mockTestPlatformEventSource.Verify(es => es.MultiTestRunFinalizationRequestStart()); - mockTestPlatformEventSource.Verify(es => es.MultiTestRunFinalizationRequestStop()); + mockAttachmentsProcessingManager.Verify(m => m.ProcessTestRunAttachmentsAsync(It.IsAny(), payload.Attachments, mockEventsHandler.Object, It.IsAny())); + mockTestPlatformEventSource.Verify(es => es.TestRunAttachmentsProcessingRequestStart()); + mockTestPlatformEventSource.Verify(es => es.TestRunAttachmentsProcessingRequestStop()); - mockMetricsPublisher.Verify(p => p.PublishMetrics(TelemetryDataConstants.TestFinalizationCompleteEvent, - It.Is>(m => m.Count == 1 && m.ContainsKey(TelemetryDataConstants.FinalizationState) && (string)m[TelemetryDataConstants.FinalizationState] == "Canceled"))); + mockMetricsPublisher.Verify(p => p.PublishMetrics(TelemetryDataConstants.TestAttachmentsProcessingCompleteEvent, + It.Is>(m => m.Count == 1 && m.ContainsKey(TelemetryDataConstants.AttachmentsProcessingState) && (string)m[TelemetryDataConstants.AttachmentsProcessingState] == "Canceled"))); } [TestMethod] - public void CancelMultiTestRunFinalizationShouldSucceedIfNoRequest() + public void CancelTestRunAttachmentsProcessingShouldSucceedIfNoRequest() { - testRequestManager.CancelMultiTestRunFinalization(); + testRequestManager.CancelTestRunAttachmentsProcessing(); } private static DiscoveryRequestPayload CreateDiscoveryPayload(string runsettings)