Skip to content

Commit

Permalink
Rename to MultiTestRunsFinalization
Browse files Browse the repository at this point in the history
  • Loading branch information
jakubch1 committed May 21, 2020
1 parent 3851666 commit 1cae4c5
Show file tree
Hide file tree
Showing 13 changed files with 87 additions and 86 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,14 @@ public static class MessageType
public const string CustomTestHostLaunchCallback = "TestExecution.CustomTestHostLaunchCallback";

/// <summary>
/// Test session end
/// Multi test runs finalization
/// </summary>
public const string OnTestSessionEnd = "TestExecution.OnTestSessionEnd";
public const string MultiTestRunsFinalization = "TestExecution.MultiTestRunsFinalization";

/// <summary>
/// Test session end callback
/// Multi test runs finalization callback
/// </summary>
public const string OnTestSessionEndCallback = "TestExecution.OnTestSessionEnd";
public const string MultiTestRunsFinalizationCallback = "TestExecution.MultiTestRunsFinalizationCallback";

/// <summary>
/// Extensions Initialization
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@ namespace Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.ObjectModel
using System.Collections.Generic;

using Microsoft.VisualStudio.TestPlatform.ObjectModel;
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client;

/// <summary>
/// The test run complete payload.
/// Multi test runs finalization complete payload.
/// </summary>
public class TestSessionCompletePayload
public class MultiTestRunsFinalizationCompletePayload
{
/// <summary>
/// Gets or sets the attachments.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,52 +184,52 @@ public interface ITestPlatformEventSource
void MetricsDisposeStop();

/// <summary>
/// The session finalization request start.
/// The multi test runs finalization request start.
/// </summary>
void SessionFinalizationRequestStart();
void MultiTestRunsFinalizationRequestStart();

/// <summary>
/// The session finalization request stop.
/// The multi test runs finalization request stop.
/// </summary>
void SessionFinalizationRequestStop();
void MultiTestRunsFinalizationRequestStop();

/// <summary>
/// The adapter session finalization start.
/// The adapter multi test runs finalization start.
/// </summary>
/// <param name="numberOfAttachements">
/// The number of attachements.
/// </param>
void AdapterSessionFinalizationStart(long numberOfAttachements);
void AdapterMultiTestRunsFinalizationStart(long numberOfAttachements);

/// <summary>
/// The adapter session finalization stop.
/// The adapter multi test runs finalization stop.
/// </summary>
/// <param name="numberOfAttachements">
/// The number of attachements.
/// </param>
void AdapterSessionFinalizationStop(long numberOfAttachements);
void AdapterMultiTestRunsFinalizationStop(long numberOfAttachements);

/// <summary>
/// The session finalization start.
/// The multi test runs finalization start.
/// </summary>
void SessionFinalizationStart();
void MultiTestRunsFinalizationStart();

/// <summary>
/// The session finalization stop.
/// The multi test runs finalization stop.
/// </summary>
/// <param name="numberOfAttachements">
/// The number of attachements.
/// </param>
void SessionFinalizationStop(long numberOfAttachements);
void MultiTestRunsFinalizationStop(long numberOfAttachements);

/// <summary>
/// Mark the start of translation layer session finalization request.
/// Mark the start of translation layer multi test runs finalization request.
/// </summary>
void TranslationLayerSessionFinalizationStart();
void TranslationLayerMultiTestRunsFinalizationStart();

/// <summary>
/// Mark the completion of translation layer session finalization request.
/// Mark the completion of translation layer multi test runs finalization request.
/// </summary>
void TranslationLayerSessionFinalizationStop();
void TranslationLayerMultiTestRunsFinalizationStop();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -239,59 +239,59 @@ public void MetricsDisposeStop()
}

/// <inheritdoc/>
[Event(TestPlatformInstrumentationEvents.SessionFinalizationRequestStartEventId)]
public void SessionFinalizationRequestStart()
[Event(TestPlatformInstrumentationEvents.MultiTestRunsFinalizationRequestStartEventId)]
public void MultiTestRunsFinalizationRequestStart()
{
this.WriteEvent(TestPlatformInstrumentationEvents.SessionFinalizationRequestStartEventId);
this.WriteEvent(TestPlatformInstrumentationEvents.MultiTestRunsFinalizationRequestStartEventId);
}

/// <inheritdoc/>
[Event(TestPlatformInstrumentationEvents.SessionFinalizationRequestStopEventId)]
public void SessionFinalizationRequestStop()
[Event(TestPlatformInstrumentationEvents.MultiTestRunsFinalizationRequestStopEventId)]
public void MultiTestRunsFinalizationRequestStop()
{
this.WriteEvent(TestPlatformInstrumentationEvents.SessionFinalizationRequestStopEventId);
this.WriteEvent(TestPlatformInstrumentationEvents.MultiTestRunsFinalizationRequestStopEventId);
}

/// <inheritdoc/>
[Event(TestPlatformInstrumentationEvents.AdapterSessionFinalizationStartEventId)]
public void AdapterSessionFinalizationStart(long numberOfAttachements)
[Event(TestPlatformInstrumentationEvents.AdapterMultiTestRunsFinalizationStartEventId)]
public void AdapterMultiTestRunsFinalizationStart(long numberOfAttachements)
{
this.WriteEvent(TestPlatformInstrumentationEvents.AdapterSessionFinalizationStartEventId, numberOfAttachements);
this.WriteEvent(TestPlatformInstrumentationEvents.AdapterMultiTestRunsFinalizationStartEventId, numberOfAttachements);
}

/// <inheritdoc/>
[Event(TestPlatformInstrumentationEvents.AdapterSessionFinalizationStopEventId)]
public void AdapterSessionFinalizationStop(long numberOfAttachements)
[Event(TestPlatformInstrumentationEvents.AdapterMultiTestRunsFinalizationStopEventId)]
public void AdapterMultiTestRunsFinalizationStop(long numberOfAttachements)
{
this.WriteEvent(TestPlatformInstrumentationEvents.AdapterSessionFinalizationStopEventId, numberOfAttachements);
this.WriteEvent(TestPlatformInstrumentationEvents.AdapterMultiTestRunsFinalizationStopEventId, numberOfAttachements);
}

/// <inheritdoc/>
[Event(TestPlatformInstrumentationEvents.SessionFinalizationStartEventId)]
public void SessionFinalizationStart()
[Event(TestPlatformInstrumentationEvents.MultiTestRunsFinalizationStartEventId)]
public void MultiTestRunsFinalizationStart()
{
this.WriteEvent(TestPlatformInstrumentationEvents.SessionFinalizationStartEventId);
this.WriteEvent(TestPlatformInstrumentationEvents.MultiTestRunsFinalizationStartEventId);
}

/// <inheritdoc/>
[Event(TestPlatformInstrumentationEvents.SessionFinalizationStopEventId)]
public void SessionFinalizationStop(long numberOfAttachements)
[Event(TestPlatformInstrumentationEvents.MultiTestRunsFinalizationStopEventId)]
public void MultiTestRunsFinalizationStop(long numberOfAttachements)
{
this.WriteEvent(TestPlatformInstrumentationEvents.SessionFinalizationStopEventId, numberOfAttachements);
this.WriteEvent(TestPlatformInstrumentationEvents.MultiTestRunsFinalizationStopEventId, numberOfAttachements);
}

/// <inheritdoc/>
[Event(TestPlatformInstrumentationEvents.TranslationLayerSessionFinalizationStartEventId)]
public void TranslationLayerSessionFinalizationStart()
[Event(TestPlatformInstrumentationEvents.TranslationLayerMultiTestRunsFinalizationStartEventId)]
public void TranslationLayerMultiTestRunsFinalizationStart()
{
this.WriteEvent(TestPlatformInstrumentationEvents.TranslationLayerSessionFinalizationStartEventId);
this.WriteEvent(TestPlatformInstrumentationEvents.TranslationLayerMultiTestRunsFinalizationStartEventId);
}

/// <inheritdoc/>
[Event(TestPlatformInstrumentationEvents.TranslationLayerSessionFinalizationStopEventId)]
public void TranslationLayerSessionFinalizationStop()
[Event(TestPlatformInstrumentationEvents.TranslationLayerMultiTestRunsFinalizationStopEventId)]
public void TranslationLayerMultiTestRunsFinalizationStop()
{
this.WriteEvent(TestPlatformInstrumentationEvents.TranslationLayerSessionFinalizationStopEventId);
this.WriteEvent(TestPlatformInstrumentationEvents.TranslationLayerMultiTestRunsFinalizationStopEventId);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -161,41 +161,41 @@ internal class TestPlatformInstrumentationEvents
/// <summary>
/// The session finalization start event id.
/// </summary>
public const int SessionFinalizationStartEventId = 0x40;
public const int MultiTestRunsFinalizationStartEventId = 0x40;

/// <summary>
/// The session finalization stop event id.
/// </summary>
public const int SessionFinalizationStopEventId = 0x41;
public const int MultiTestRunsFinalizationStopEventId = 0x41;

/// <summary>
/// The session finalization request start event id.
/// </summary>
public const int SessionFinalizationRequestStartEventId = 0x42;
public const int MultiTestRunsFinalizationRequestStartEventId = 0x42;

/// <summary>
/// The session finalization request stop event id.
/// </summary>
public const int SessionFinalizationRequestStopEventId = 0x43;
public const int MultiTestRunsFinalizationRequestStopEventId = 0x43;

/// <summary>
/// The adapter session finalization start event id.
/// </summary>
public const int AdapterSessionFinalizationStartEventId = 0x44;
public const int AdapterMultiTestRunsFinalizationStartEventId = 0x44;

/// <summary>
/// The adapter session finalization stop event id.
/// </summary>
public const int AdapterSessionFinalizationStopEventId = 0x45;
public const int AdapterMultiTestRunsFinalizationStopEventId = 0x45;

/// <summary>
/// Events fired on session finalization start of translation layer.
/// </summary>
public const int TranslationLayerSessionFinalizationStartEventId = 0x46;
public const int TranslationLayerMultiTestRunsFinalizationStartEventId = 0x46;

/// <summary>
/// Events fired on session finalization complete in translation layer.
/// </summary>
public const int TranslationLayerSessionFinalizationStopEventId = 0x47;
public const int TranslationLayerMultiTestRunsFinalizationStopEventId = 0x47;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ namespace Microsoft.VisualStudio.TestPlatform.ObjectModel.Client
using System.Collections.Generic;

/// <summary>
/// Interface contract for handling test session complete events
/// Interface contract for handling multi test runs finalization complete events
/// </summary>
public interface ITestSessionEventsHandler : ITestMessageEventHandler
public interface IMultiTestRunsFinalizationCompleteEventsHandler : ITestMessageEventHandler
{
/// <summary>
/// Dispatch SessionComplete event to listeners.
/// </summary>
/// <param name="attachments">Attachments reprocessed.</param>
void HandleTestSessionComplete(IEnumerable<AttachmentSet> attachments);
void HandleMultiTestRunsFinalizationComplete(IEnumerable<AttachmentSet> attachments);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ namespace Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.Payloads
using System.Runtime.Serialization;

/// <summary>
/// Class used to define the OnTestSessionEndPayload sent by the Vstest.console translation layers into design mode
/// Class used to define the MultiTestRunsFinalizationPayload sent by the Vstest.console translation layers into design mode
/// </summary>
public class OnTestSessionEndPayload
public class MultiTestRunsFinalizationPayload
{
/// <summary>
/// Settings used for the discovery request.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ internal interface ITranslationLayerRequestSender : IDisposable
/// Provides back all attachements to TestPlatform for additional processing (for example merging)
/// </summary>
/// <param name="attachments">List of attachements</param>
/// <param name="testSessionEventsHandler"></param>
void OnTestSessionEnd(IEnumerable<AttachmentSet> attachments, ITestSessionEventsHandler testSessionEventsHandler);
/// <param name="multiTestRunsFinalizationCompleteEventsHandler"></param>
void FinalizeMultiTestRuns(IEnumerable<AttachmentSet> attachments, IMultiTestRunsFinalizationCompleteEventsHandler multiTestRunsFinalizationCompleteEventsHandler);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ public interface IVsTestConsoleWrapper2 : IVsTestConsoleWrapper
/// Provides back all attachements to TestPlatform for additional processing (for example merging)
/// </summary>
/// <param name="attachments">List of attachements</param>
/// <param name="testSessionEventsHandler">EventHandler to receive session complete event</param>
void FinalizeMultiTestRuns(IEnumerable<AttachmentSet> attachments, ITestSessionEventsHandler testSessionEventsHandler);
// void FinalizeTests(IEnumerable<AttachmentSet> attachments, ITestSessionEventsHandler testSessionEventsHandler);
/// <param name="multiTestRunsFinalizationCompleteEventsHandler">EventHandler to receive session complete event</param>
void FinalizeMultiTestRuns(IEnumerable<AttachmentSet> attachments, IMultiTestRunsFinalizationCompleteEventsHandler multiTestRunsFinalizationCompleteEventsHandler);
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="AbortedSessionFinalization" xml:space="preserve">
<value>The active Session Finalization was aborted.</value>
<data name="AbortedMultiTestRunsFinalization" xml:space="preserve">
<value>The active Multi Test Runs Finalization was aborted.</value>
</data>
<data name="AbortedTestsDiscovery" xml:space="preserve">
<value>The active Tests Discovery was aborted.</value>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ public void EndSession()
}

/// <inheritdoc/>
public void OnTestSessionEnd(IEnumerable<AttachmentSet> attachments, ITestSessionEventsHandler testSessionEventsHandler)
public void FinalizeMultiTestRuns(IEnumerable<AttachmentSet> attachments, IMultiTestRunsFinalizationCompleteEventsHandler testSessionEventsHandler)
{
this.SendMessageAndListenAndReportAttachements(attachments, testSessionEventsHandler);
}
Expand Down Expand Up @@ -732,35 +732,35 @@ private async Task SendMessageAndListenAndReportTestResultsAsync(string messageT
this.testPlatformEventSource.TranslationLayerExecutionStop();
}

private void SendMessageAndListenAndReportAttachements(IEnumerable<AttachmentSet> attachments, ITestSessionEventsHandler eventHandler)
private void SendMessageAndListenAndReportAttachements(IEnumerable<AttachmentSet> attachments, IMultiTestRunsFinalizationCompleteEventsHandler eventHandler)
{
try
{
var payload = new OnTestSessionEndPayload
var payload = new MultiTestRunsFinalizationPayload
{
Attachments = attachments
};
this.communicationManager.SendMessage(MessageType.OnTestSessionEnd, payload);
var isSessionComplete = false;
this.communicationManager.SendMessage(MessageType.MultiTestRunsFinalization, payload);
var isMultiTestRunsFinalizationComplete = false;

// 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 (!isSessionComplete)
while (!isMultiTestRunsFinalizationComplete)
{
var message = this.TryReceiveMessage();

if (string.Equals(MessageType.OnTestSessionEndCallback, message.MessageType))
if (string.Equals(MessageType.MultiTestRunsFinalizationCallback, message.MessageType))
{
if (EqtTrace.IsInfoEnabled)
{
EqtTrace.Info("VsTestConsoleRequestSender.SendMessageAndListenAndReportAttachements: Process complete.");
}

var testSessionCompletePayload = this.dataSerializer.DeserializePayload<TestSessionCompletePayload>(message);
var multiTestRunsFinalizationCompletePayload = this.dataSerializer.DeserializePayload<MultiTestRunsFinalizationCompletePayload>(message);

eventHandler.HandleTestSessionComplete(testSessionCompletePayload.Attachments);
isSessionComplete = true;
eventHandler.HandleMultiTestRunsFinalizationComplete(multiTestRunsFinalizationCompletePayload.Attachments);
isMultiTestRunsFinalizationComplete = true;
}
else if (string.Equals(MessageType.TestMessage, message.MessageType))
{
Expand All @@ -772,8 +772,8 @@ private void SendMessageAndListenAndReportAttachements(IEnumerable<AttachmentSet
catch (Exception exception)
{
EqtTrace.Error("Aborting Test Session End Operation: {0}", exception);
eventHandler.HandleLogMessage(TestMessageLevel.Error, TranslationLayerResources.AbortedSessionFinalization);
eventHandler.HandleTestSessionComplete(null);
eventHandler.HandleLogMessage(TestMessageLevel.Error, TranslationLayerResources.AbortedMultiTestRunsFinalization);
eventHandler.HandleMultiTestRunsFinalizationComplete(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
Expand All @@ -782,7 +782,7 @@ private void SendMessageAndListenAndReportAttachements(IEnumerable<AttachmentSet
}

// TODO: do we need events?
this.testPlatformEventSource.TranslationLayerSessionFinalizationStop();
this.testPlatformEventSource.TranslationLayerMultiTestRunsFinalizationStop();
}

private Message TryReceiveMessage()
Expand Down
Loading

0 comments on commit 1cae4c5

Please sign in to comment.