diff --git a/src/Microsoft.TestPlatform.Common/DataCollection/DataCollectionManager.cs b/src/Microsoft.TestPlatform.Common/DataCollection/DataCollectionManager.cs
index cc4c18c914..055d3d0e39 100644
--- a/src/Microsoft.TestPlatform.Common/DataCollection/DataCollectionManager.cs
+++ b/src/Microsoft.TestPlatform.Common/DataCollection/DataCollectionManager.cs
@@ -53,6 +53,11 @@ internal class DataCollectionManager : IDataCollectionManager
///
private readonly TestPlatformDataCollectionEvents _events;
+ ///
+ /// Telemetry reporter
+ ///
+ private readonly ITelemetryReporter _telemetryReporter;
+
///
/// Specifies whether the object is disposed or not.
///
@@ -74,7 +79,7 @@ internal class DataCollectionManager : IDataCollectionManager
///
/// The message Sink.
///
- internal DataCollectionManager(IMessageSink messageSink, IRequestData requestData) : this(new DataCollectionAttachmentManager(), messageSink, new DataCollectionTelemetryManager(requestData))
+ internal DataCollectionManager(IMessageSink messageSink, IRequestData requestData, ITelemetryReporter telemetryReporter) : this(new DataCollectionAttachmentManager(), messageSink, new DataCollectionTelemetryManager(requestData), telemetryReporter)
{
}
@@ -90,7 +95,7 @@ internal DataCollectionManager(IMessageSink messageSink, IRequestData requestDat
///
/// The constructor is not public because the factory method should be used to get instances of this class.
///
- protected DataCollectionManager(IDataCollectionAttachmentManager datacollectionAttachmentManager, IMessageSink messageSink, IDataCollectionTelemetryManager dataCollectionTelemetryManager)
+ protected DataCollectionManager(IDataCollectionAttachmentManager datacollectionAttachmentManager, IMessageSink messageSink, IDataCollectionTelemetryManager dataCollectionTelemetryManager, ITelemetryReporter telemetryReporter)
{
_attachmentManager = datacollectionAttachmentManager;
_messageSink = messageSink;
@@ -98,6 +103,7 @@ protected DataCollectionManager(IDataCollectionAttachmentManager datacollectionA
_dataCollectorExtensionManager = null;
RunDataCollectors = new Dictionary();
_dataCollectionTelemetryManager = dataCollectionTelemetryManager;
+ _telemetryReporter = telemetryReporter;
}
///
@@ -133,13 +139,13 @@ private DataCollectorExtensionManager DataCollectorExtensionManager
///
/// The .
///
- public static DataCollectionManager Create(IMessageSink messageSink, IRequestData requestData)
+ public static DataCollectionManager Create(IMessageSink messageSink, IRequestData requestData, ITelemetryReporter telemetryReporter)
{
if (Instance == null)
{
lock (SyncObject)
{
- Instance ??= new DataCollectionManager(messageSink, requestData);
+ Instance ??= new DataCollectionManager(messageSink, requestData, telemetryReporter);
}
}
@@ -528,7 +534,7 @@ private void LoadAndInitialize(DataCollectorSettings dataCollectorSettings, stri
try
{
- dataCollectorInfo.InitializeDataCollector();
+ dataCollectorInfo.InitializeDataCollector(_telemetryReporter);
TPDebug.Assert(dataCollectorConfig is not null, "dataCollectorConfig is null");
lock (RunDataCollectors)
{
diff --git a/src/Microsoft.TestPlatform.Common/DataCollection/DataCollectorInformation.cs b/src/Microsoft.TestPlatform.Common/DataCollection/DataCollectorInformation.cs
index b1a185e41a..f14c0e5c1e 100644
--- a/src/Microsoft.TestPlatform.Common/DataCollection/DataCollectorInformation.cs
+++ b/src/Microsoft.TestPlatform.Common/DataCollection/DataCollectorInformation.cs
@@ -110,11 +110,16 @@ internal DataCollectorInformation(ObjectModel.DataCollection.DataCollector dataC
///
/// Initializes datacollectors.
///
- internal void InitializeDataCollector()
+ internal void InitializeDataCollector(ITelemetryReporter telemetryReporter)
{
UpdateConfigurationElement();
DataCollector.Initialize(ConfigurationElement, Events, DataCollectionSink, Logger, EnvironmentContext);
+
+ if (DataCollector is ITelemetryInitializer telemetryInitializer)
+ {
+ telemetryInitializer.Initialize(telemetryReporter);
+ }
}
private void UpdateConfigurationElement()
diff --git a/src/Microsoft.TestPlatform.CommunicationUtilities/DataCollectionRequestHandler.cs b/src/Microsoft.TestPlatform.CommunicationUtilities/DataCollectionRequestHandler.cs
index d977e00f0f..5dbd569619 100644
--- a/src/Microsoft.TestPlatform.CommunicationUtilities/DataCollectionRequestHandler.cs
+++ b/src/Microsoft.TestPlatform.CommunicationUtilities/DataCollectionRequestHandler.cs
@@ -55,28 +55,6 @@ internal class DataCollectionRequestHandler : IDataCollectionRequestHandler, IDi
///
private readonly CancellationTokenSource _cancellationTokenSource;
- ///
- /// Initializes a new instance of the class.
- ///
- ///
- /// The message sink.
- ///
- ///
- /// The request data.
- ///
- protected DataCollectionRequestHandler(IMessageSink messageSink, IRequestData requestData)
- : this(
- new SocketCommunicationManager(),
- messageSink,
- DataCollectionManager.Create(messageSink, requestData),
- new DataCollectionTestCaseEventHandler(messageSink),
- JsonDataSerializer.Instance,
- new FileHelper(),
- requestData)
- {
- _messageSink = messageSink;
- }
-
///
/// Initializes a new instance of the class.
///
@@ -159,11 +137,12 @@ protected DataCollectionRequestHandler(IMessageSink messageSink, IRequestData re
if (Instance == null)
{
var requestData = new RequestData();
+ var telemetryReporter = new TelemetryReporter(requestData, communicationManager, JsonDataSerializer.Instance);
Instance = new DataCollectionRequestHandler(
communicationManager,
messageSink,
- DataCollectionManager.Create(messageSink, requestData),
+ DataCollectionManager.Create(messageSink, requestData, telemetryReporter),
new DataCollectionTestCaseEventHandler(messageSink),
JsonDataSerializer.Instance,
new FileHelper(),
diff --git a/src/Microsoft.TestPlatform.CommunicationUtilities/DataCollectionRequestSender.cs b/src/Microsoft.TestPlatform.CommunicationUtilities/DataCollectionRequestSender.cs
index 8f1a95c004..92c56960d6 100644
--- a/src/Microsoft.TestPlatform.CommunicationUtilities/DataCollectionRequestSender.cs
+++ b/src/Microsoft.TestPlatform.CommunicationUtilities/DataCollectionRequestSender.cs
@@ -116,7 +116,10 @@ public void SendTestHostLaunched(TestHostLaunchedPayload testHostLaunchedPayload
while (!isDataCollectionStarted)
{
- var message = _communicationManager.ReceiveMessage();
+ var rawMessage = _communicationManager.ReceiveRawMessage();
+ TPDebug.Assert(rawMessage is not null, "rawMessage is null");
+
+ var message = !rawMessage.IsNullOrEmpty() ? _dataSerializer.DeserializeMessage(rawMessage) : null;
TPDebug.Assert(message is not null, "message is null");
EqtTrace.Verbose("DataCollectionRequestSender.SendBeforeTestRunStartAndGetResult: Received message: {0}", message);
@@ -132,6 +135,10 @@ public void SendTestHostLaunched(TestHostLaunchedPayload testHostLaunchedPayload
isDataCollectionStarted = true;
result = _dataSerializer.DeserializePayload(message);
}
+ else if (message.MessageType == MessageType.TelemetryEventMessage)
+ {
+ runEventsHandler?.HandleRawMessage(rawMessage);
+ }
}
return result;
@@ -151,7 +158,10 @@ public void SendTestHostLaunched(TestHostLaunchedPayload testHostLaunchedPayload
// Currently each of the operations are not separate tasks since they should not each take much time. This is just a notification.
while (!isDataCollectionComplete && !isCancelled)
{
- var message = _communicationManager.ReceiveMessage();
+ var rawMessage = _communicationManager.ReceiveRawMessage();
+ TPDebug.Assert(rawMessage is not null, "rawMessage is null");
+
+ var message = !rawMessage.IsNullOrEmpty() ? _dataSerializer.DeserializeMessage(rawMessage) : null;
TPDebug.Assert(message is not null, "message is null");
EqtTrace.Verbose("DataCollectionRequestSender.SendAfterTestRunStartAndGetResult: Received message: {0}", message);
@@ -167,6 +177,10 @@ public void SendTestHostLaunched(TestHostLaunchedPayload testHostLaunchedPayload
result = _dataSerializer.DeserializePayload(message);
isDataCollectionComplete = true;
}
+ else if (message.MessageType == MessageType.TelemetryEventMessage)
+ {
+ runEventsHandler?.HandleRawMessage(rawMessage);
+ }
}
return result;
diff --git a/src/Microsoft.TestPlatform.CommunicationUtilities/Messages/MessageType.cs b/src/Microsoft.TestPlatform.CommunicationUtilities/Messages/MessageType.cs
index e4907fde23..29381d0f07 100644
--- a/src/Microsoft.TestPlatform.CommunicationUtilities/Messages/MessageType.cs
+++ b/src/Microsoft.TestPlatform.CommunicationUtilities/Messages/MessageType.cs
@@ -281,4 +281,8 @@ public static class MessageType
[ProtocolVersion(Version7, typeof(EditorAttachDebuggerPayload))]
public const string EditorAttachDebugger2 = "TestExecution.EditorAttachDebugger2";
+ ///
+ /// Telemetry event.
+ ///
+ public const string TelemetryEventMessage = "TestPlatform.TelemetryEvent";
}
diff --git a/src/Microsoft.TestPlatform.CommunicationUtilities/PublicAPI/PublicAPI.Unshipped.txt b/src/Microsoft.TestPlatform.CommunicationUtilities/PublicAPI/PublicAPI.Unshipped.txt
index 7dc5c58110..6505a7e4c2 100644
--- a/src/Microsoft.TestPlatform.CommunicationUtilities/PublicAPI/PublicAPI.Unshipped.txt
+++ b/src/Microsoft.TestPlatform.CommunicationUtilities/PublicAPI/PublicAPI.Unshipped.txt
@@ -1 +1,2 @@
#nullable enable
+const Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.ObjectModel.MessageType.TelemetryEventMessage = "TestPlatform.TelemetryEvent" -> string!
diff --git a/src/Microsoft.TestPlatform.CommunicationUtilities/TelemetryReporter.cs b/src/Microsoft.TestPlatform.CommunicationUtilities/TelemetryReporter.cs
new file mode 100644
index 0000000000..7c31dab285
--- /dev/null
+++ b/src/Microsoft.TestPlatform.CommunicationUtilities/TelemetryReporter.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 Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.Interfaces;
+using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.ObjectModel;
+using Microsoft.VisualStudio.TestPlatform.ObjectModel;
+using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client;
+
+namespace Microsoft.VisualStudio.TestPlatform.CommunicationUtilities;
+
+internal class TelemetryReporter : ITelemetryReporter
+{
+ private readonly IRequestData _requestData;
+ private readonly ICommunicationManager _communicationManager;
+ private readonly IDataSerializer _dataSerializer;
+
+ public TelemetryReporter(IRequestData requestData, ICommunicationManager communicationManager, IDataSerializer dataSerializer)
+ {
+ _requestData = requestData;
+ _communicationManager = communicationManager;
+ _dataSerializer = dataSerializer;
+ }
+
+ public void Report(TelemetryEvent telemetryEvent)
+ {
+ if (_requestData.IsTelemetryOptedIn)
+ {
+ string message = _dataSerializer.SerializePayload(MessageType.TelemetryEventMessage, telemetryEvent);
+ _communicationManager.SendRawMessage(message);
+ }
+ }
+}
diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyExecutionManagerWithDataCollection.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyExecutionManagerWithDataCollection.cs
index fbd58ce5bf..31cfbc1c20 100644
--- a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyExecutionManagerWithDataCollection.cs
+++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyExecutionManagerWithDataCollection.cs
@@ -141,6 +141,17 @@ public override int StartTestRun(TestRunCriteria testRunCriteria, IInternalTestR
DataCollectionRunEventsHandler.Messages.Clear();
}
+ // Push all raw messages
+ if (DataCollectionRunEventsHandler.RawMessages.Count > 0)
+ {
+ foreach (var message in DataCollectionRunEventsHandler.RawMessages)
+ {
+ currentEventHandler.HandleRawMessage(message);
+ }
+
+ DataCollectionRunEventsHandler.RawMessages.Clear();
+ }
+
return base.StartTestRun(testRunCriteria, currentEventHandler);
}
@@ -190,7 +201,7 @@ public override TestProcessStartInfo UpdateTestProcessStartInfo(TestProcessStart
}
///
-/// Handles Log events and stores them in list. Messages in the list will be logged after test execution begins.
+/// Handles Log and raw messages and stores them in list. Messages in the list will be logged after test execution begins.
///
internal class DataCollectionRunEventsHandler : ITestMessageEventHandler
{
@@ -200,6 +211,7 @@ internal class DataCollectionRunEventsHandler : ITestMessageEventHandler
public DataCollectionRunEventsHandler()
{
Messages = new List>();
+ RawMessages = new List();
}
///
@@ -207,6 +219,11 @@ public DataCollectionRunEventsHandler()
///
public List> Messages { get; private set; }
+ ///
+ /// Gets the cached raw messages.
+ ///
+ public List RawMessages { get; private set; }
+
///
public void HandleLogMessage(TestMessageLevel level, string? message)
{
@@ -216,6 +233,6 @@ public void HandleLogMessage(TestMessageLevel level, string? message)
///
public void HandleRawMessage(string rawMessage)
{
- throw new NotImplementedException();
+ RawMessages.Add(rawMessage);
}
}
diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyOperationManagerWithDataCollection.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyOperationManagerWithDataCollection.cs
index 3edacd86b9..1eac8f3d94 100644
--- a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyOperationManagerWithDataCollection.cs
+++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyOperationManagerWithDataCollection.cs
@@ -120,6 +120,17 @@ public override TestProcessStartInfo UpdateTestProcessStartInfo(TestProcessStart
DataCollectionRunEventsHandler.Messages.Clear();
}
+ // Push all raw messages
+ if (DataCollectionRunEventsHandler.RawMessages.Count > 0)
+ {
+ foreach (var message in DataCollectionRunEventsHandler.RawMessages)
+ {
+ eventHandler.HandleRawMessage(message);
+ }
+
+ DataCollectionRunEventsHandler.RawMessages.Clear();
+ }
+
return base.SetupChannel(sources, runSettings);
}
diff --git a/src/Microsoft.TestPlatform.ObjectModel/Client/Interfaces/IInternalTestRunEventsHandler.cs b/src/Microsoft.TestPlatform.ObjectModel/Client/Interfaces/IInternalTestRunEventsHandler.cs
index bd709960e7..b35e59c2cc 100644
--- a/src/Microsoft.TestPlatform.ObjectModel/Client/Interfaces/IInternalTestRunEventsHandler.cs
+++ b/src/Microsoft.TestPlatform.ObjectModel/Client/Interfaces/IInternalTestRunEventsHandler.cs
@@ -8,7 +8,7 @@
namespace Microsoft.VisualStudio.TestPlatform.ObjectModel.Client;
///
-/// Interface contract for handling internal test run events during run. This interface should have methods similar to ,
+/// Interface contract for handling internal test run events during run. This interface should have methods similar to ,
/// but only the newest (most broad) version of each method, so that we only operate on the latest interface in the internals, and adapt on the edges.
///
public interface IInternalTestRunEventsHandler : ITestMessageEventHandler
diff --git a/src/Microsoft.TestPlatform.ObjectModel/Client/Interfaces/ITelemetryEventsHandler.cs b/src/Microsoft.TestPlatform.ObjectModel/Client/Interfaces/ITelemetryEventsHandler.cs
new file mode 100644
index 0000000000..59786d5002
--- /dev/null
+++ b/src/Microsoft.TestPlatform.ObjectModel/Client/Interfaces/ITelemetryEventsHandler.cs
@@ -0,0 +1,9 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+namespace Microsoft.VisualStudio.TestPlatform.ObjectModel.Client;
+
+public interface ITelemetryEventsHandler
+{
+ void HandleTelemetryEvent(TelemetryEvent telemetryEvent);
+}
diff --git a/src/Microsoft.TestPlatform.ObjectModel/ITelemetryInitializer.cs b/src/Microsoft.TestPlatform.ObjectModel/ITelemetryInitializer.cs
new file mode 100644
index 0000000000..d32b6b6dca
--- /dev/null
+++ b/src/Microsoft.TestPlatform.ObjectModel/ITelemetryInitializer.cs
@@ -0,0 +1,15 @@
+// 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.ObjectModel;
+
+///
+/// Interface for extensions that choose to send telemetry events
+///
+public interface ITelemetryInitializer
+{
+ ///
+ /// Initializes telemetry reporter
+ ///
+ void Initialize(ITelemetryReporter telemetryReporter);
+}
diff --git a/src/Microsoft.TestPlatform.ObjectModel/ITelemetryReporter.cs b/src/Microsoft.TestPlatform.ObjectModel/ITelemetryReporter.cs
new file mode 100644
index 0000000000..afd3f78c18
--- /dev/null
+++ b/src/Microsoft.TestPlatform.ObjectModel/ITelemetryReporter.cs
@@ -0,0 +1,15 @@
+// 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.ObjectModel;
+
+///
+/// Interface for extensions that choose to send telemetry events
+///
+public interface ITelemetryReporter
+{
+ ///
+ /// Pushes telemetry event into TP
+ ///
+ void Report(TelemetryEvent telemetryEvent);
+}
diff --git a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/PublicAPI.Unshipped.txt b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/PublicAPI.Unshipped.txt
index ab058de62d..343eac0f8d 100644
--- a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/PublicAPI.Unshipped.txt
+++ b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/PublicAPI.Unshipped.txt
@@ -1 +1,11 @@
#nullable enable
+Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITelemetryEventsHandler
+Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITelemetryEventsHandler.HandleTelemetryEvent(Microsoft.VisualStudio.TestPlatform.ObjectModel.TelemetryEvent! telemetryEvent) -> void
+Microsoft.VisualStudio.TestPlatform.ObjectModel.ITelemetryInitializer
+Microsoft.VisualStudio.TestPlatform.ObjectModel.ITelemetryInitializer.Initialize(Microsoft.VisualStudio.TestPlatform.ObjectModel.ITelemetryReporter! telemetryReporter) -> void
+Microsoft.VisualStudio.TestPlatform.ObjectModel.ITelemetryReporter
+Microsoft.VisualStudio.TestPlatform.ObjectModel.ITelemetryReporter.Report(Microsoft.VisualStudio.TestPlatform.ObjectModel.TelemetryEvent! telemetryEvent) -> void
+Microsoft.VisualStudio.TestPlatform.ObjectModel.TelemetryEvent
+Microsoft.VisualStudio.TestPlatform.ObjectModel.TelemetryEvent.Name.get -> string!
+Microsoft.VisualStudio.TestPlatform.ObjectModel.TelemetryEvent.Properties.get -> System.Collections.Generic.IDictionary!
+Microsoft.VisualStudio.TestPlatform.ObjectModel.TelemetryEvent.TelemetryEvent(string! name, System.Collections.Generic.IDictionary! properties) -> void
diff --git a/src/Microsoft.TestPlatform.ObjectModel/TelemetryEvent.cs b/src/Microsoft.TestPlatform.ObjectModel/TelemetryEvent.cs
new file mode 100644
index 0000000000..9b99d23384
--- /dev/null
+++ b/src/Microsoft.TestPlatform.ObjectModel/TelemetryEvent.cs
@@ -0,0 +1,33 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+using System.Collections.Generic;
+using System.Runtime.Serialization;
+
+namespace Microsoft.VisualStudio.TestPlatform.ObjectModel;
+
+public sealed class TelemetryEvent
+{
+ ///
+ /// Initialize an TelemetryEvent
+ ///
+ /// Telemetry event name
+ /// Telemetry event properties
+ public TelemetryEvent(string name, IDictionary properties)
+ {
+ Name = name;
+ Properties = properties;
+ }
+
+ ///
+ /// Telemetry event name.
+ ///
+ [DataMember]
+ public string Name { get; private set; }
+
+ ///
+ /// Telemetry event properties.
+ ///
+ [DataMember]
+ public IDictionary Properties { get; private set; }
+}
diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSession.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSession.cs
index aa1d868fbe..c57b8761d2 100644
--- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSession.cs
+++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSession.cs
@@ -85,6 +85,23 @@ public interface ITestSession : IDisposable, ITestSessionAsync
TestPlatformOptions options,
ITestRunEventsHandler testRunEventsHandler);
+ ///
+ /// Starts a test run.
+ ///
+ ///
+ /// The list of source assemblies for the test run.
+ /// The run settings for the run.
+ /// The test platform options.
+ /// The run event handler.
+ /// The telemetry event handler.
+ [Obsolete("This API is not final yet and is subject to changes.", false)]
+ void RunTests(
+ IEnumerable sources,
+ string runSettings,
+ TestPlatformOptions options,
+ ITestRunEventsHandler testRunEventsHandler,
+ ITelemetryEventsHandler telemetryEventsHandler);
+
///
/// Starts a test run.
///
@@ -113,18 +130,52 @@ public interface ITestSession : IDisposable, ITestSessionAsync
TestPlatformOptions options,
ITestRunEventsHandler testRunEventsHandler);
+ ///
+ /// Starts a test run.
+ ///
+ ///
+ /// The list of test cases for the test run.
+ /// The run settings for the run.
+ /// The test platform options.
+ /// The run event handler.
+ /// The telemetry event handler.
+ [Obsolete("This API is not final yet and is subject to changes.", false)]
+ void RunTests(
+ IEnumerable testCases,
+ string runSettings,
+ TestPlatformOptions options,
+ ITestRunEventsHandler testRunEventsHandler,
+ ITelemetryEventsHandler telemetryEventsHandler);
+
+ ///
+ /// Starts a test run.
+ ///
+ ///
+ /// The list of source assemblies for the test run.
+ /// The run settings for the run.
+ /// The run event handler.
+ /// The custom host launcher.
+ [Obsolete("This API is not final yet and is subject to changes.", false)]
+ void RunTestsWithCustomTestHost(
+ IEnumerable sources,
+ string runSettings,
+ ITestRunEventsHandler testRunEventsHandler,
+ ITestHostLauncher customTestHostLauncher);
+
///
/// Starts a test run.
///
///
/// The list of source assemblies for the test run.
/// The run settings for the run.
+ /// The test platform options.
/// The run event handler.
/// The custom host launcher.
[Obsolete("This API is not final yet and is subject to changes.", false)]
void RunTestsWithCustomTestHost(
IEnumerable sources,
string runSettings,
+ TestPlatformOptions options,
ITestRunEventsHandler testRunEventsHandler,
ITestHostLauncher customTestHostLauncher);
@@ -136,6 +187,7 @@ public interface ITestSession : IDisposable, ITestSessionAsync
/// The run settings for the run.
/// The test platform options.
/// The run event handler.
+ /// The telemetry event handler.
/// The custom host launcher.
[Obsolete("This API is not final yet and is subject to changes.", false)]
void RunTestsWithCustomTestHost(
@@ -143,6 +195,22 @@ public interface ITestSession : IDisposable, ITestSessionAsync
string runSettings,
TestPlatformOptions options,
ITestRunEventsHandler testRunEventsHandler,
+ ITelemetryEventsHandler telemetryEventsHandler,
+ ITestHostLauncher customTestHostLauncher);
+
+ ///
+ /// Starts a test run.
+ ///
+ ///
+ /// The list of test cases for the test run.
+ /// The run settings for the run.
+ /// The run event handler.
+ /// The custom host launcher.
+ [Obsolete("This API is not final yet and is subject to changes.", false)]
+ void RunTestsWithCustomTestHost(
+ IEnumerable testCases,
+ string runSettings,
+ ITestRunEventsHandler testRunEventsHandler,
ITestHostLauncher customTestHostLauncher);
///
@@ -151,12 +219,14 @@ public interface ITestSession : IDisposable, ITestSessionAsync
///
/// The list of test cases for the test run.
/// The run settings for the run.
+ /// The test platform options.
/// The run event handler.
/// The custom host launcher.
[Obsolete("This API is not final yet and is subject to changes.", false)]
void RunTestsWithCustomTestHost(
IEnumerable testCases,
string runSettings,
+ TestPlatformOptions options,
ITestRunEventsHandler testRunEventsHandler,
ITestHostLauncher customTestHostLauncher);
@@ -168,6 +238,7 @@ public interface ITestSession : IDisposable, ITestSessionAsync
/// The run settings for the run.
/// The test platform options.
/// The run event handler.
+ /// The telemetry event handler.
/// The custom host launcher.
[Obsolete("This API is not final yet and is subject to changes.", false)]
void RunTestsWithCustomTestHost(
@@ -175,6 +246,7 @@ public interface ITestSession : IDisposable, ITestSessionAsync
string runSettings,
TestPlatformOptions options,
ITestRunEventsHandler testRunEventsHandler,
+ ITelemetryEventsHandler telemetryEventsHandler,
ITestHostLauncher customTestHostLauncher);
///
diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSessionAsync.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSessionAsync.cs
index d06c311981..b97ed5fe21 100644
--- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSessionAsync.cs
+++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSessionAsync.cs
@@ -81,6 +81,23 @@ public interface ITestSessionAsync : IDisposable
TestPlatformOptions options,
ITestRunEventsHandler testRunEventsHandler);
+ ///
+ /// Starts a test run.
+ ///
+ ///
+ /// The list of source assemblies for the test run.
+ /// The run settings for the run.
+ /// The test platform options.
+ /// The run event handler.
+ /// The telemetry event handler.
+ [Obsolete("This API is not final yet and is subject to changes.", false)]
+ Task RunTestsAsync(
+ IEnumerable sources,
+ string runSettings,
+ TestPlatformOptions options,
+ ITestRunEventsHandler testRunEventsHandler,
+ ITelemetryEventsHandler telemetryEventsHandler);
+
///
/// Starts a test run.
///
@@ -109,18 +126,52 @@ public interface ITestSessionAsync : IDisposable
TestPlatformOptions options,
ITestRunEventsHandler testRunEventsHandler);
+ ///
+ /// Starts a test run.
+ ///
+ ///
+ /// The list of test cases for the test run.
+ /// The run settings for the run.
+ /// The test platform options.
+ /// The run event handler.
+ /// The telemetry event handler.
+ [Obsolete("This API is not final yet and is subject to changes.", false)]
+ Task RunTestsAsync(
+ IEnumerable testCases,
+ string runSettings,
+ TestPlatformOptions options,
+ ITestRunEventsHandler testRunEventsHandler,
+ ITelemetryEventsHandler telemetryEventsHandler);
+
+ ///
+ /// Starts a test run.
+ ///
+ ///
+ /// The list of source assemblies for the test run.
+ /// The run settings for the run.
+ /// The run event handler.
+ /// The custom host launcher.
+ [Obsolete("This API is not final yet and is subject to changes.", false)]
+ Task RunTestsWithCustomTestHostAsync(
+ IEnumerable sources,
+ string runSettings,
+ ITestRunEventsHandler testRunEventsHandler,
+ ITestHostLauncher customTestHostLauncher);
+
///
/// Starts a test run.
///
///
/// The list of source assemblies for the test run.
/// The run settings for the run.
+ /// The test platform options.
/// The run event handler.
/// The custom host launcher.
[Obsolete("This API is not final yet and is subject to changes.", false)]
Task RunTestsWithCustomTestHostAsync(
IEnumerable sources,
string runSettings,
+ TestPlatformOptions options,
ITestRunEventsHandler testRunEventsHandler,
ITestHostLauncher customTestHostLauncher);
@@ -132,6 +183,7 @@ public interface ITestSessionAsync : IDisposable
/// The run settings for the run.
/// The test platform options.
/// The run event handler.
+ /// The telemetry event handler.
/// The custom host launcher.
[Obsolete("This API is not final yet and is subject to changes.", false)]
Task RunTestsWithCustomTestHostAsync(
@@ -139,6 +191,22 @@ public interface ITestSessionAsync : IDisposable
string runSettings,
TestPlatformOptions options,
ITestRunEventsHandler testRunEventsHandler,
+ ITelemetryEventsHandler telemetryEventsHandler,
+ ITestHostLauncher customTestHostLauncher);
+
+ ///
+ /// Starts a test run.
+ ///
+ ///
+ /// The list of test cases for the test run.
+ /// The run settings for the run.
+ /// The run event handler.
+ /// The custom host launcher.
+ [Obsolete("This API is not final yet and is subject to changes.", false)]
+ Task RunTestsWithCustomTestHostAsync(
+ IEnumerable testCases,
+ string runSettings,
+ ITestRunEventsHandler testRunEventsHandler,
ITestHostLauncher customTestHostLauncher);
///
@@ -147,12 +215,14 @@ public interface ITestSessionAsync : IDisposable
///
/// The list of test cases for the test run.
/// The run settings for the run.
+ /// The test platform options.
/// The run event handler.
/// The custom host launcher.
[Obsolete("This API is not final yet and is subject to changes.", false)]
Task RunTestsWithCustomTestHostAsync(
IEnumerable testCases,
string runSettings,
+ TestPlatformOptions options,
ITestRunEventsHandler testRunEventsHandler,
ITestHostLauncher customTestHostLauncher);
@@ -164,6 +234,7 @@ public interface ITestSessionAsync : IDisposable
/// The run settings for the run.
/// The test platform options.
/// The run event handler.
+ /// The telemetry event handler.
/// The custom host launcher.
[Obsolete("This API is not final yet and is subject to changes.", false)]
Task RunTestsWithCustomTestHostAsync(
@@ -171,6 +242,7 @@ public interface ITestSessionAsync : IDisposable
string runSettings,
TestPlatformOptions options,
ITestRunEventsHandler testRunEventsHandler,
+ ITelemetryEventsHandler telemetryEventsHandler,
ITestHostLauncher customTestHostLauncher);
///
diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITranslationLayerRequestSender.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITranslationLayerRequestSender.cs
index 924458d746..2a606f21e6 100644
--- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITranslationLayerRequestSender.cs
+++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITranslationLayerRequestSender.cs
@@ -69,12 +69,14 @@ internal interface ITranslationLayerRequestSender : IDisposable, ITranslationLay
/// Options to be passed into the platform.
/// Test session info.
/// Event handler for test run events.
+ /// Event handler for telemetry events.
void StartTestRun(
IEnumerable sources,
string? runSettings,
TestPlatformOptions? options,
TestSessionInfo? testSessionInfo,
- ITestRunEventsHandler runEventsHandler);
+ ITestRunEventsHandler runEventsHandler,
+ ITelemetryEventsHandler telemetryEventsHandler);
///
/// Starts the test run with given sources and criteria.
@@ -85,12 +87,14 @@ internal interface ITranslationLayerRequestSender : IDisposable, ITranslationLay
/// Options to be passed into the platform.
/// Test session info.
/// Event handler for test run events.
+ /// Event handler for telemetry events.
void StartTestRun(
IEnumerable testCases,
string? runSettings,
TestPlatformOptions? options,
TestSessionInfo? testSessionInfo,
- ITestRunEventsHandler runEventsHandler);
+ ITestRunEventsHandler runEventsHandler,
+ ITelemetryEventsHandler telemetryEventsHandler);
///
/// Starts the test run with given sources and criteria and a custom launcher.
@@ -101,6 +105,7 @@ internal interface ITranslationLayerRequestSender : IDisposable, ITranslationLay
/// Options to be passed into the platform.
/// Test session info.
/// Event handler for test run events.
+ /// Event handler for telemetry events.
/// Custom test host launcher.
void StartTestRunWithCustomHost(
IEnumerable sources,
@@ -108,6 +113,7 @@ internal interface ITranslationLayerRequestSender : IDisposable, ITranslationLay
TestPlatformOptions? options,
TestSessionInfo? testSessionInfo,
ITestRunEventsHandler runEventsHandler,
+ ITelemetryEventsHandler telemetryEventsHandler,
ITestHostLauncher customTestHostLauncher);
///
@@ -119,6 +125,7 @@ internal interface ITranslationLayerRequestSender : IDisposable, ITranslationLay
/// Options to be passed into the platform.
/// Test session info.
/// Event handler for test run events.
+ /// Event handler for telemetry events.
/// Custom test host launcher.
void StartTestRunWithCustomHost(
IEnumerable testCases,
@@ -126,6 +133,7 @@ internal interface ITranslationLayerRequestSender : IDisposable, ITranslationLay
TestPlatformOptions? options,
TestSessionInfo? testSessionInfo,
ITestRunEventsHandler runEventsHandler,
+ ITelemetryEventsHandler telemetryEventsHandler,
ITestHostLauncher customTestHostLauncher);
///
diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITranslationLayerRequestSenderAsync.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITranslationLayerRequestSenderAsync.cs
index 6b56d2b05f..161ecb31bb 100644
--- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITranslationLayerRequestSenderAsync.cs
+++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITranslationLayerRequestSenderAsync.cs
@@ -43,14 +43,16 @@ internal interface ITranslationLayerRequestSenderAsync : IDisposable
/// string,
/// TestPlatformOptions,
/// TestSessionInfo,
- /// ITestRunEventsHandler)"/>.
+ /// ITestRunEventsHandler,
+ /// ITelemetryEventsHandler)"/>.
///
Task StartTestRunAsync(
IEnumerable sources,
string? runSettings,
TestPlatformOptions? options,
TestSessionInfo? testSessionInfo,
- ITestRunEventsHandler runEventsHandler);
+ ITestRunEventsHandler runEventsHandler,
+ ITelemetryEventsHandler telemetryEventsHandler);
///
/// Asynchronous equivalent of .
+ /// ITestRunEventsHandler,
+ /// ITelemetryEventsHandler)"/>.
///
Task StartTestRunAsync(
IEnumerable testCases,
string? runSettings,
TestPlatformOptions? options,
TestSessionInfo? testSessionInfo,
- ITestRunEventsHandler runEventsHandler);
+ ITestRunEventsHandler runEventsHandler,
+ ITelemetryEventsHandler telemetryEventsHandler);
///
/// Asynchronous equivalent of .
///
Task StartTestRunWithCustomHostAsync(
@@ -84,6 +89,7 @@ internal interface ITranslationLayerRequestSenderAsync : IDisposable
TestPlatformOptions? options,
TestSessionInfo? testSessionInfo,
ITestRunEventsHandler runEventsHandler,
+ ITelemetryEventsHandler telemetryEventsHandler,
ITestHostLauncher customTestHostLauncher);
///
@@ -94,6 +100,7 @@ internal interface ITranslationLayerRequestSenderAsync : IDisposable
/// TestPlatformOptions,
/// TestSessionInfo,
/// ITestRunEventsHandler,
+ /// ITelemetryEventsHandler,
/// ITestHostLauncher)"/>.
///
Task StartTestRunWithCustomHostAsync(
@@ -102,6 +109,7 @@ internal interface ITranslationLayerRequestSenderAsync : IDisposable
TestPlatformOptions? options,
TestSessionInfo? testSessionInfo,
ITestRunEventsHandler runEventsHandler,
+ ITelemetryEventsHandler telemetryEventsHandler,
ITestHostLauncher customTestHostLauncher);
///
diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/IVsTestConsoleWrapper.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/IVsTestConsoleWrapper.cs
index 4a1243b390..ed4754b130 100644
--- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/IVsTestConsoleWrapper.cs
+++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/IVsTestConsoleWrapper.cs
@@ -197,6 +197,24 @@ public interface IVsTestConsoleWrapper : IVsTestConsoleWrapperAsync
TestSessionInfo? testSessionInfo,
ITestRunEventsHandler testRunEventsHandler);
+ ///
+ /// Starts a test run.
+ ///
+ ///
+ /// The list of source assemblies for the test run.
+ /// The run settings for the run.
+ /// The test platform options.
+ /// The test session info object.
+ /// The run event handler.
+ /// The telemetry events handler.
+ void RunTests(
+ IEnumerable sources,
+ string? runSettings,
+ TestPlatformOptions? options,
+ TestSessionInfo? testSessionInfo,
+ ITestRunEventsHandler testRunEventsHandler,
+ ITelemetryEventsHandler telemetryEventsHandler);
+
///
/// Starts a test run.
///
@@ -239,17 +257,51 @@ public interface IVsTestConsoleWrapper : IVsTestConsoleWrapperAsync
TestSessionInfo? testSessionInfo,
ITestRunEventsHandler testRunEventsHandler);
+ ///
+ /// Starts a test run.
+ ///
+ ///
+ /// The list of test cases for the test run.
+ /// The run settings for the run.
+ /// The test platform options.
+ /// The test session info object.
+ /// The run event handler.
+ /// The telemetry events handler.
+ void RunTests(
+ IEnumerable testCases,
+ string? runSettings,
+ TestPlatformOptions? options,
+ TestSessionInfo? testSessionInfo,
+ ITestRunEventsHandler testRunEventsHandler,
+ ITelemetryEventsHandler telemetryEventsHandler);
+
+ ///
+ /// Starts a test run.
+ ///
+ ///
+ /// The list of source assemblies for the test run.
+ /// The run settings for the run.
+ /// The run event handler.
+ /// The custom host launcher.
+ void RunTestsWithCustomTestHost(
+ IEnumerable sources,
+ string? runSettings,
+ ITestRunEventsHandler testRunEventsHandler,
+ ITestHostLauncher customTestHostLauncher);
+
///
/// Starts a test run.
///
///
/// The list of source assemblies for the test run.
/// The run settings for the run.
+ /// The test platform options.
/// The run event handler.
/// The custom host launcher.
void RunTestsWithCustomTestHost(
IEnumerable sources,
string? runSettings,
+ TestPlatformOptions? options,
ITestRunEventsHandler testRunEventsHandler,
ITestHostLauncher customTestHostLauncher);
@@ -260,12 +312,14 @@ public interface IVsTestConsoleWrapper : IVsTestConsoleWrapperAsync
/// The list of source assemblies for the test run.
/// The run settings for the run.
/// The test platform options.
+ /// The test session info object.
/// The run event handler.
/// The custom host launcher.
void RunTestsWithCustomTestHost(
IEnumerable sources,
string? runSettings,
TestPlatformOptions? options,
+ TestSessionInfo? testSessionInfo,
ITestRunEventsHandler testRunEventsHandler,
ITestHostLauncher customTestHostLauncher);
@@ -278,6 +332,7 @@ public interface IVsTestConsoleWrapper : IVsTestConsoleWrapperAsync
/// The test platform options.
/// The test session info object.
/// The run event handler.
+ /// The telemetry events handler.
/// The custom host launcher.
void RunTestsWithCustomTestHost(
IEnumerable sources,
@@ -285,6 +340,21 @@ public interface IVsTestConsoleWrapper : IVsTestConsoleWrapperAsync
TestPlatformOptions? options,
TestSessionInfo? testSessionInfo,
ITestRunEventsHandler testRunEventsHandler,
+ ITelemetryEventsHandler telemetryEventsHandler,
+ ITestHostLauncher customTestHostLauncher);
+
+ ///
+ /// Starts a test run.
+ ///
+ ///
+ /// The list of test cases for the test run.
+ /// The run settings for the run.
+ /// The run event handler.
+ /// The custom host launcher.
+ void RunTestsWithCustomTestHost(
+ IEnumerable testCases,
+ string? runSettings,
+ ITestRunEventsHandler testRunEventsHandler,
ITestHostLauncher customTestHostLauncher);
///
@@ -293,11 +363,13 @@ public interface IVsTestConsoleWrapper : IVsTestConsoleWrapperAsync
///
/// The list of test cases for the test run.
/// The run settings for the run.
+ /// The test platform options.
/// The run event handler.
/// The custom host launcher.
void RunTestsWithCustomTestHost(
IEnumerable testCases,
string? runSettings,
+ TestPlatformOptions? options,
ITestRunEventsHandler testRunEventsHandler,
ITestHostLauncher customTestHostLauncher);
@@ -308,12 +380,14 @@ public interface IVsTestConsoleWrapper : IVsTestConsoleWrapperAsync
/// The list of test cases for the test run.
/// The run settings for the run.
/// The test platform options.
+ /// The test session info object.
/// The run event handler.
/// The custom host launcher.
void RunTestsWithCustomTestHost(
IEnumerable testCases,
string? runSettings,
TestPlatformOptions? options,
+ TestSessionInfo? testSessionInfo,
ITestRunEventsHandler testRunEventsHandler,
ITestHostLauncher customTestHostLauncher);
@@ -326,6 +400,7 @@ public interface IVsTestConsoleWrapper : IVsTestConsoleWrapperAsync
/// The test platform options.
/// The test session info object.
/// The run event handler.
+ /// The telemetry events handler.
/// The custom host launcher.
void RunTestsWithCustomTestHost(
IEnumerable testCases,
@@ -333,6 +408,7 @@ public interface IVsTestConsoleWrapper : IVsTestConsoleWrapperAsync
TestPlatformOptions? options,
TestSessionInfo? testSessionInfo,
ITestRunEventsHandler testRunEventsHandler,
+ ITelemetryEventsHandler telemetryEventsHandler,
ITestHostLauncher customTestHostLauncher);
///
diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/IVsTestConsoleWrapperAsync.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/IVsTestConsoleWrapperAsync.cs
index c8163b35de..92e1ab87b3 100644
--- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/IVsTestConsoleWrapperAsync.cs
+++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/IVsTestConsoleWrapperAsync.cs
@@ -188,6 +188,24 @@ public interface IVsTestConsoleWrapperAsync
TestSessionInfo? testSessionInfo,
ITestRunEventsHandler testRunEventsHandler);
+ ///
+ /// Asynchronous equivalent of .
+ ///
+ Task RunTestsAsync(
+ IEnumerable sources,
+ string? runSettings,
+ TestPlatformOptions? options,
+ TestSessionInfo? testSessionInfo,
+ ITestRunEventsHandler testRunEventsHandler,
+ ITelemetryEventsHandler telemetryEventsHandler);
+
///
/// Asynchronous equivalent of .
+ ///
+ Task RunTestsAsync(
+ IEnumerable testCases,
+ string? runSettings,
+ TestPlatformOptions? options,
+ TestSessionInfo? testSessionInfo,
+ ITestRunEventsHandler testRunEventsHandler,
+ ITelemetryEventsHandler telemetryEventsHandler);
+
+ ///
+ /// Asynchronous equivalent of .
+ ///
+ Task RunTestsWithCustomTestHostAsync(
+ IEnumerable sources,
+ string? runSettings,
+ ITestRunEventsHandler testRunEventsHandler,
+ ITestHostLauncher customTestHostLauncher);
+
///
/// Asynchronous equivalent of .
///
Task RunTestsWithCustomTestHostAsync(
IEnumerable sources,
string? runSettings,
+ TestPlatformOptions? options,
ITestRunEventsHandler testRunEventsHandler,
ITestHostLauncher customTestHostLauncher);
@@ -250,6 +302,7 @@ public interface IVsTestConsoleWrapperAsync
/// IEnumerable{string},
/// string,
/// TestPlatformOptions,
+ /// TestSessionInfo,
/// ITestRunEventsHandler,
/// ITestHostLauncher)"/>.
///
@@ -257,6 +310,7 @@ public interface IVsTestConsoleWrapperAsync
IEnumerable sources,
string? runSettings,
TestPlatformOptions? options,
+ TestSessionInfo? testSessionInfo,
ITestRunEventsHandler testRunEventsHandler,
ITestHostLauncher customTestHostLauncher);
@@ -268,6 +322,7 @@ public interface IVsTestConsoleWrapperAsync
/// TestPlatformOptions,
/// TestSessionInfo,
/// ITestRunEventsHandler,
+ /// ITelemetryEventsHandler,
/// ITestHostLauncher)"/>.
///
Task RunTestsWithCustomTestHostAsync(
@@ -276,6 +331,21 @@ public interface IVsTestConsoleWrapperAsync
TestPlatformOptions? options,
TestSessionInfo? testSessionInfo,
ITestRunEventsHandler testRunEventsHandler,
+ ITelemetryEventsHandler telemetryEventsHandler,
+ ITestHostLauncher customTestHostLauncher);
+
+ ///
+ /// Asynchronous equivalent of .
+ ///
+ Task RunTestsWithCustomTestHostAsync(
+ IEnumerable testCases,
+ string? runSettings,
+ ITestRunEventsHandler testRunEventsHandler,
ITestHostLauncher customTestHostLauncher);
///
@@ -283,12 +353,14 @@ public interface IVsTestConsoleWrapperAsync
/// IVsTestConsoleWrapper.RunTestsWithCustomTestHost(
/// IEnumerable{TestCase},
/// string,
+ /// TestPlatformOptions,
/// ITestRunEventsHandler,
/// ITestHostLauncher)"/>.
///
Task RunTestsWithCustomTestHostAsync(
IEnumerable testCases,
string? runSettings,
+ TestPlatformOptions? options,
ITestRunEventsHandler testRunEventsHandler,
ITestHostLauncher customTestHostLauncher);
@@ -298,6 +370,7 @@ public interface IVsTestConsoleWrapperAsync
/// IEnumerable{TestCase},
/// string,
/// TestPlatformOptions,
+ /// TestSessionInfo,
/// ITestRunEventsHandler,
/// ITestHostLauncher)"/>.
///
@@ -305,6 +378,7 @@ public interface IVsTestConsoleWrapperAsync
IEnumerable testCases,
string? runSettings,
TestPlatformOptions? options,
+ TestSessionInfo? testSessionInfo,
ITestRunEventsHandler testRunEventsHandler,
ITestHostLauncher customTestHostLauncher);
@@ -316,6 +390,7 @@ public interface IVsTestConsoleWrapperAsync
/// TestPlatformOptions,
/// TestSessionInfo,
/// ITestRunEventsHandler,
+ /// ITelemetryEventsHandler,
/// ITestHostLauncher)"/>.
///
Task RunTestsWithCustomTestHostAsync(
@@ -324,6 +399,7 @@ public interface IVsTestConsoleWrapperAsync
TestPlatformOptions? options,
TestSessionInfo? testSessionInfo,
ITestRunEventsHandler testRunEventsHandler,
+ ITelemetryEventsHandler telemetryEventsHandler,
ITestHostLauncher customTestHostLauncher);
///
diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/NoOpTelemetryEventsHandler.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/NoOpTelemetryEventsHandler.cs
new file mode 100644
index 0000000000..e0fb418ee2
--- /dev/null
+++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/NoOpTelemetryEventsHandler.cs
@@ -0,0 +1,15 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+using Microsoft.VisualStudio.TestPlatform.ObjectModel;
+using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client;
+
+namespace Microsoft.VisualStudio.TestPlatform.VsTestConsole.TranslationLayer;
+
+internal class NoOpTelemetryEventsHandler : ITelemetryEventsHandler
+{
+ public void HandleTelemetryEvent(TelemetryEvent telemetryEvent)
+ {
+ // no op
+ }
+}
diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/PublicAPI/PublicAPI.Unshipped.txt b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/PublicAPI/PublicAPI.Unshipped.txt
index 7dc5c58110..4e39cac22a 100644
--- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/PublicAPI/PublicAPI.Unshipped.txt
+++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/PublicAPI/PublicAPI.Unshipped.txt
@@ -1 +1,33 @@
#nullable enable
+Microsoft.TestPlatform.VsTestConsole.TranslationLayer.Interfaces.IVsTestConsoleWrapper.RunTests(System.Collections.Generic.IEnumerable! testCases, string? runSettings, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestPlatformOptions? options, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo? testSessionInfo, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestRunEventsHandler! testRunEventsHandler, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITelemetryEventsHandler! telemetryEventsHandler) -> void
+Microsoft.TestPlatform.VsTestConsole.TranslationLayer.Interfaces.IVsTestConsoleWrapper.RunTests(System.Collections.Generic.IEnumerable! sources, string? runSettings, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestPlatformOptions? options, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo? testSessionInfo, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestRunEventsHandler! testRunEventsHandler, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITelemetryEventsHandler! telemetryEventsHandler) -> void
+Microsoft.TestPlatform.VsTestConsole.TranslationLayer.Interfaces.IVsTestConsoleWrapper.RunTestsWithCustomTestHost(System.Collections.Generic.IEnumerable! testCases, string? runSettings, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestPlatformOptions? options, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo? testSessionInfo, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestRunEventsHandler! testRunEventsHandler, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITelemetryEventsHandler! telemetryEventsHandler, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.Interfaces.ITestHostLauncher! customTestHostLauncher) -> void
+Microsoft.TestPlatform.VsTestConsole.TranslationLayer.Interfaces.IVsTestConsoleWrapper.RunTestsWithCustomTestHost(System.Collections.Generic.IEnumerable! sources, string? runSettings, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestPlatformOptions? options, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo? testSessionInfo, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestRunEventsHandler! testRunEventsHandler, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITelemetryEventsHandler! telemetryEventsHandler, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.Interfaces.ITestHostLauncher! customTestHostLauncher) -> void
+Microsoft.TestPlatform.VsTestConsole.TranslationLayer.Interfaces.IVsTestConsoleWrapperAsync.RunTestsAsync(System.Collections.Generic.IEnumerable! testCases, string? runSettings, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestPlatformOptions? options, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo? testSessionInfo, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestRunEventsHandler! testRunEventsHandler, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITelemetryEventsHandler! telemetryEventsHandler) -> System.Threading.Tasks.Task!
+Microsoft.TestPlatform.VsTestConsole.TranslationLayer.Interfaces.IVsTestConsoleWrapperAsync.RunTestsAsync(System.Collections.Generic.IEnumerable! sources, string? runSettings, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestPlatformOptions? options, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo? testSessionInfo, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestRunEventsHandler! testRunEventsHandler, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITelemetryEventsHandler! telemetryEventsHandler) -> System.Threading.Tasks.Task!
+Microsoft.TestPlatform.VsTestConsole.TranslationLayer.Interfaces.IVsTestConsoleWrapperAsync.RunTestsWithCustomTestHostAsync(System.Collections.Generic.IEnumerable! testCases, string? runSettings, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestPlatformOptions? options, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo? testSessionInfo, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestRunEventsHandler! testRunEventsHandler, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITelemetryEventsHandler! telemetryEventsHandler, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.Interfaces.ITestHostLauncher! customTestHostLauncher) -> System.Threading.Tasks.Task!
+Microsoft.TestPlatform.VsTestConsole.TranslationLayer.Interfaces.IVsTestConsoleWrapperAsync.RunTestsWithCustomTestHostAsync(System.Collections.Generic.IEnumerable! sources, string? runSettings, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestPlatformOptions? options, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo? testSessionInfo, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestRunEventsHandler! testRunEventsHandler, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITelemetryEventsHandler! telemetryEventsHandler, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.Interfaces.ITestHostLauncher! customTestHostLauncher) -> System.Threading.Tasks.Task!
+Microsoft.TestPlatform.VsTestConsole.TranslationLayer.VsTestConsoleWrapper.RunTests(System.Collections.Generic.IEnumerable! testCases, string? runSettings, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestPlatformOptions? options, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo? testSessionInfo, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestRunEventsHandler! testRunEventsHandler, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITelemetryEventsHandler! telemetryEventsHandler) -> void
+Microsoft.TestPlatform.VsTestConsole.TranslationLayer.VsTestConsoleWrapper.RunTests(System.Collections.Generic.IEnumerable! sources, string? runSettings, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestPlatformOptions? options, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo? testSessionInfo, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestRunEventsHandler! testRunEventsHandler, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITelemetryEventsHandler! telemetryEventsHandler) -> void
+Microsoft.TestPlatform.VsTestConsole.TranslationLayer.VsTestConsoleWrapper.RunTestsAsync(System.Collections.Generic.IEnumerable! testCases, string? runSettings, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestPlatformOptions? options, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo? testSessionInfo, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestRunEventsHandler! testRunEventsHandler, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITelemetryEventsHandler! telemetryEventsHandler) -> System.Threading.Tasks.Task!
+Microsoft.TestPlatform.VsTestConsole.TranslationLayer.VsTestConsoleWrapper.RunTestsAsync(System.Collections.Generic.IEnumerable! sources, string? runSettings, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestPlatformOptions? options, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo? testSessionInfo, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestRunEventsHandler! testRunEventsHandler, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITelemetryEventsHandler! telemetryEventsHandler) -> System.Threading.Tasks.Task!
+Microsoft.TestPlatform.VsTestConsole.TranslationLayer.VsTestConsoleWrapper.RunTestsWithCustomTestHost(System.Collections.Generic.IEnumerable! testCases, string? runSettings, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestPlatformOptions? options, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo? testSessionInfo, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestRunEventsHandler! testRunEventsHandler, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITelemetryEventsHandler! telemetryEventsHandler, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.Interfaces.ITestHostLauncher! customTestHostLauncher) -> void
+Microsoft.TestPlatform.VsTestConsole.TranslationLayer.VsTestConsoleWrapper.RunTestsWithCustomTestHost(System.Collections.Generic.IEnumerable! sources, string? runSettings, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestPlatformOptions? options, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo? testSessionInfo, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestRunEventsHandler! testRunEventsHandler, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITelemetryEventsHandler! telemetryEventsHandler, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.Interfaces.ITestHostLauncher! customTestHostLauncher) -> void
+Microsoft.TestPlatform.VsTestConsole.TranslationLayer.VsTestConsoleWrapper.RunTestsWithCustomTestHostAsync(System.Collections.Generic.IEnumerable! testCases, string? runSettings, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestPlatformOptions? options, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo? testSessionInfo, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestRunEventsHandler! testRunEventsHandler, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITelemetryEventsHandler! telemetryEventsHandler, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.Interfaces.ITestHostLauncher! customTestHostLauncher) -> System.Threading.Tasks.Task!
+Microsoft.TestPlatform.VsTestConsole.TranslationLayer.VsTestConsoleWrapper.RunTestsWithCustomTestHostAsync(System.Collections.Generic.IEnumerable! sources, string? runSettings, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestPlatformOptions? options, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo? testSessionInfo, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestRunEventsHandler! testRunEventsHandler, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITelemetryEventsHandler! telemetryEventsHandler, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.Interfaces.ITestHostLauncher! customTestHostLauncher) -> System.Threading.Tasks.Task!
+Microsoft.TestPlatform.VsTestConsole.TranslationLayer.TestSession.RunTests(System.Collections.Generic.IEnumerable! testCases, string! runSettings, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestPlatformOptions? options, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestRunEventsHandler! testRunEventsHandler, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITelemetryEventsHandler! telemetryEventsHandler) -> void
+Microsoft.TestPlatform.VsTestConsole.TranslationLayer.TestSession.RunTests(System.Collections.Generic.IEnumerable! sources, string! runSettings, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestPlatformOptions? options, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestRunEventsHandler! testRunEventsHandler, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITelemetryEventsHandler! telemetryEventsHandler) -> void
+Microsoft.TestPlatform.VsTestConsole.TranslationLayer.TestSession.RunTestsAsync(System.Collections.Generic.IEnumerable! testCases, string! runSettings, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestPlatformOptions? options, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestRunEventsHandler! testRunEventsHandler, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITelemetryEventsHandler! telemetryEventsHandler) -> System.Threading.Tasks.Task!
+Microsoft.TestPlatform.VsTestConsole.TranslationLayer.TestSession.RunTestsAsync(System.Collections.Generic.IEnumerable! sources, string! runSettings, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestPlatformOptions? options, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestRunEventsHandler! testRunEventsHandler, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITelemetryEventsHandler! telemetryEventsHandler) -> System.Threading.Tasks.Task!
+Microsoft.TestPlatform.VsTestConsole.TranslationLayer.TestSession.RunTestsWithCustomTestHost(System.Collections.Generic.IEnumerable! testCases, string! runSettings, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestPlatformOptions? options, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestRunEventsHandler! testRunEventsHandler, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITelemetryEventsHandler! telemetryEventsHandler, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.Interfaces.ITestHostLauncher! customTestHostLauncher) -> void
+Microsoft.TestPlatform.VsTestConsole.TranslationLayer.TestSession.RunTestsWithCustomTestHost(System.Collections.Generic.IEnumerable! sources, string! runSettings, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestPlatformOptions? options, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestRunEventsHandler! testRunEventsHandler, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITelemetryEventsHandler! telemetryEventsHandler, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.Interfaces.ITestHostLauncher! customTestHostLauncher) -> void
+Microsoft.TestPlatform.VsTestConsole.TranslationLayer.TestSession.RunTestsWithCustomTestHostAsync(System.Collections.Generic.IEnumerable! testCases, string! runSettings, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestPlatformOptions? options, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestRunEventsHandler! testRunEventsHandler, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITelemetryEventsHandler! telemetryEventsHandler, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.Interfaces.ITestHostLauncher! customTestHostLauncher) -> System.Threading.Tasks.Task!
+Microsoft.TestPlatform.VsTestConsole.TranslationLayer.TestSession.RunTestsWithCustomTestHostAsync(System.Collections.Generic.IEnumerable! sources, string! runSettings, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestPlatformOptions? options, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestRunEventsHandler! testRunEventsHandler, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITelemetryEventsHandler! telemetryEventsHandler, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.Interfaces.ITestHostLauncher! customTestHostLauncher) -> System.Threading.Tasks.Task!
+Microsoft.VisualStudio.TestPlatform.VsTestConsole.TranslationLayer.Interfaces.ITestSession.RunTests(System.Collections.Generic.IEnumerable! testCases, string! runSettings, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestPlatformOptions! options, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestRunEventsHandler! testRunEventsHandler, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITelemetryEventsHandler! telemetryEventsHandler) -> void
+Microsoft.VisualStudio.TestPlatform.VsTestConsole.TranslationLayer.Interfaces.ITestSession.RunTests(System.Collections.Generic.IEnumerable! sources, string! runSettings, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestPlatformOptions! options, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestRunEventsHandler! testRunEventsHandler, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITelemetryEventsHandler! telemetryEventsHandler) -> void
+Microsoft.VisualStudio.TestPlatform.VsTestConsole.TranslationLayer.Interfaces.ITestSession.RunTestsWithCustomTestHost(System.Collections.Generic.IEnumerable! testCases, string! runSettings, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestPlatformOptions! options, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestRunEventsHandler! testRunEventsHandler, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITelemetryEventsHandler! telemetryEventsHandler, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.Interfaces.ITestHostLauncher! customTestHostLauncher) -> void
+Microsoft.VisualStudio.TestPlatform.VsTestConsole.TranslationLayer.Interfaces.ITestSession.RunTestsWithCustomTestHost(System.Collections.Generic.IEnumerable! sources, string! runSettings, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestPlatformOptions! options, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestRunEventsHandler! testRunEventsHandler, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITelemetryEventsHandler! telemetryEventsHandler, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.Interfaces.ITestHostLauncher! customTestHostLauncher) -> void
+Microsoft.VisualStudio.TestPlatform.VsTestConsole.TranslationLayer.Interfaces.ITestSessionAsync.RunTestsAsync(System.Collections.Generic.IEnumerable! testCases, string! runSettings, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestPlatformOptions! options, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestRunEventsHandler! testRunEventsHandler, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITelemetryEventsHandler! telemetryEventsHandler) -> System.Threading.Tasks.Task!
+Microsoft.VisualStudio.TestPlatform.VsTestConsole.TranslationLayer.Interfaces.ITestSessionAsync.RunTestsAsync(System.Collections.Generic.IEnumerable! sources, string! runSettings, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestPlatformOptions! options, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestRunEventsHandler! testRunEventsHandler, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITelemetryEventsHandler! telemetryEventsHandler) -> System.Threading.Tasks.Task!
+Microsoft.VisualStudio.TestPlatform.VsTestConsole.TranslationLayer.Interfaces.ITestSessionAsync.RunTestsWithCustomTestHostAsync(System.Collections.Generic.IEnumerable! testCases, string! runSettings, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestPlatformOptions! options, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestRunEventsHandler! testRunEventsHandler, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITelemetryEventsHandler! telemetryEventsHandler, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.Interfaces.ITestHostLauncher! customTestHostLauncher) -> System.Threading.Tasks.Task!
+Microsoft.VisualStudio.TestPlatform.VsTestConsole.TranslationLayer.Interfaces.ITestSessionAsync.RunTestsWithCustomTestHostAsync(System.Collections.Generic.IEnumerable! sources, string! runSettings, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestPlatformOptions! options, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestRunEventsHandler! testRunEventsHandler, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITelemetryEventsHandler! telemetryEventsHandler, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.Interfaces.ITestHostLauncher! customTestHostLauncher) -> System.Threading.Tasks.Task!
diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/TestSession.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/TestSession.cs
index fddba74a8f..5c0c0c1602 100644
--- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/TestSession.cs
+++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/TestSession.cs
@@ -10,6 +10,7 @@
using Microsoft.VisualStudio.TestPlatform.ObjectModel;
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client;
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.Interfaces;
+using Microsoft.VisualStudio.TestPlatform.VsTestConsole.TranslationLayer;
using Microsoft.VisualStudio.TestPlatform.VsTestConsole.TranslationLayer.Interfaces;
namespace Microsoft.TestPlatform.VsTestConsole.TranslationLayer;
@@ -154,13 +155,31 @@ public void CancelTestRun()
string runSettings,
TestPlatformOptions? options,
ITestRunEventsHandler testRunEventsHandler)
+ {
+ RunTests(
+ sources,
+ runSettings,
+ options,
+ testRunEventsHandler,
+ new NoOpTelemetryEventsHandler());
+ }
+
+ ///
+ [Obsolete("This API is not final yet and is subject to changes.", false)]
+ public void RunTests(
+ IEnumerable sources,
+ string runSettings,
+ TestPlatformOptions? options,
+ ITestRunEventsHandler testRunEventsHandler,
+ ITelemetryEventsHandler telemetryEventsHandler)
{
_consoleWrapper.RunTests(
sources,
runSettings,
options,
TestSessionInfo,
- testRunEventsHandler);
+ testRunEventsHandler,
+ telemetryEventsHandler);
}
///
@@ -184,13 +203,30 @@ public void CancelTestRun()
string runSettings,
TestPlatformOptions? options,
ITestRunEventsHandler testRunEventsHandler)
+ {
+ RunTests(
+ testCases,
+ runSettings,
+ options,
+ testRunEventsHandler,
+ new NoOpTelemetryEventsHandler());
+ }
+
+ [Obsolete("This API is not final yet and is subject to changes.", false)]
+ public void RunTests(
+ IEnumerable testCases,
+ string runSettings,
+ TestPlatformOptions? options,
+ ITestRunEventsHandler testRunEventsHandler,
+ ITelemetryEventsHandler telemetryEventsHandler)
{
_consoleWrapper.RunTests(
testCases,
runSettings,
options,
TestSessionInfo,
- testRunEventsHandler);
+ testRunEventsHandler,
+ telemetryEventsHandler);
}
///
@@ -217,6 +253,25 @@ public void CancelTestRun()
TestPlatformOptions? options,
ITestRunEventsHandler testRunEventsHandler,
ITestHostLauncher customTestHostLauncher)
+ {
+ RunTestsWithCustomTestHost(
+ sources,
+ runSettings,
+ options,
+ testRunEventsHandler,
+ new NoOpTelemetryEventsHandler(),
+ customTestHostLauncher);
+ }
+
+ ///
+ [Obsolete("This API is not final yet and is subject to changes.", false)]
+ public void RunTestsWithCustomTestHost(
+ IEnumerable sources,
+ string runSettings,
+ TestPlatformOptions? options,
+ ITestRunEventsHandler testRunEventsHandler,
+ ITelemetryEventsHandler telemetryEventsHandler,
+ ITestHostLauncher customTestHostLauncher)
{
_consoleWrapper.RunTestsWithCustomTestHost(
sources,
@@ -224,6 +279,7 @@ public void CancelTestRun()
options,
TestSessionInfo,
testRunEventsHandler,
+ telemetryEventsHandler,
customTestHostLauncher);
}
@@ -251,6 +307,25 @@ public void CancelTestRun()
TestPlatformOptions? options,
ITestRunEventsHandler testRunEventsHandler,
ITestHostLauncher customTestHostLauncher)
+ {
+ RunTestsWithCustomTestHost(
+ testCases,
+ runSettings,
+ options,
+ testRunEventsHandler,
+ new NoOpTelemetryEventsHandler(),
+ customTestHostLauncher);
+ }
+
+ ///
+ [Obsolete("This API is not final yet and is subject to changes.", false)]
+ public void RunTestsWithCustomTestHost(
+ IEnumerable testCases,
+ string runSettings,
+ TestPlatformOptions? options,
+ ITestRunEventsHandler testRunEventsHandler,
+ ITelemetryEventsHandler telemetryEventsHandler,
+ ITestHostLauncher customTestHostLauncher)
{
_consoleWrapper.RunTestsWithCustomTestHost(
testCases,
@@ -258,6 +333,7 @@ public void CancelTestRun()
options,
TestSessionInfo,
testRunEventsHandler,
+ telemetryEventsHandler,
customTestHostLauncher);
}
@@ -354,13 +430,31 @@ public bool StopTestSession(ITestSessionEventsHandler eventsHandler)
string runSettings,
TestPlatformOptions? options,
ITestRunEventsHandler testRunEventsHandler)
+ {
+ await RunTestsAsync(
+ sources,
+ runSettings,
+ options,
+ testRunEventsHandler,
+ new NoOpTelemetryEventsHandler()).ConfigureAwait(false);
+ }
+
+ ///
+ [Obsolete("This API is not final yet and is subject to changes.", false)]
+ public async Task RunTestsAsync(
+ IEnumerable sources,
+ string runSettings,
+ TestPlatformOptions? options,
+ ITestRunEventsHandler testRunEventsHandler,
+ ITelemetryEventsHandler telemetryEventsHandler)
{
await _consoleWrapper.RunTestsAsync(
sources,
runSettings,
options,
TestSessionInfo,
- testRunEventsHandler).ConfigureAwait(false);
+ testRunEventsHandler,
+ telemetryEventsHandler).ConfigureAwait(false);
}
///
@@ -384,13 +478,31 @@ public bool StopTestSession(ITestSessionEventsHandler eventsHandler)
string runSettings,
TestPlatformOptions? options,
ITestRunEventsHandler testRunEventsHandler)
+ {
+ await RunTestsAsync(
+ testCases,
+ runSettings,
+ options,
+ testRunEventsHandler,
+ new NoOpTelemetryEventsHandler()).ConfigureAwait(false);
+ }
+
+ ///
+ [Obsolete("This API is not final yet and is subject to changes.", false)]
+ public async Task RunTestsAsync(
+ IEnumerable testCases,
+ string runSettings,
+ TestPlatformOptions? options,
+ ITestRunEventsHandler testRunEventsHandler,
+ ITelemetryEventsHandler telemetryEventsHandler)
{
await _consoleWrapper.RunTestsAsync(
testCases,
runSettings,
options,
TestSessionInfo,
- testRunEventsHandler).ConfigureAwait(false);
+ testRunEventsHandler,
+ telemetryEventsHandler).ConfigureAwait(false);
}
///
@@ -417,6 +529,25 @@ public bool StopTestSession(ITestSessionEventsHandler eventsHandler)
TestPlatformOptions? options,
ITestRunEventsHandler testRunEventsHandler,
ITestHostLauncher customTestHostLauncher)
+ {
+ await RunTestsWithCustomTestHostAsync(
+ sources,
+ runSettings,
+ options,
+ testRunEventsHandler,
+ new NoOpTelemetryEventsHandler(),
+ customTestHostLauncher).ConfigureAwait(false);
+ }
+
+ ///
+ [Obsolete("This API is not final yet and is subject to changes.", false)]
+ public async Task RunTestsWithCustomTestHostAsync(
+ IEnumerable sources,
+ string runSettings,
+ TestPlatformOptions? options,
+ ITestRunEventsHandler testRunEventsHandler,
+ ITelemetryEventsHandler telemetryEventsHandler,
+ ITestHostLauncher customTestHostLauncher)
{
await _consoleWrapper.RunTestsWithCustomTestHostAsync(
sources,
@@ -424,6 +555,7 @@ public bool StopTestSession(ITestSessionEventsHandler eventsHandler)
options,
TestSessionInfo,
testRunEventsHandler,
+ telemetryEventsHandler,
customTestHostLauncher).ConfigureAwait(false);
}
@@ -451,6 +583,25 @@ public bool StopTestSession(ITestSessionEventsHandler eventsHandler)
TestPlatformOptions? options,
ITestRunEventsHandler testRunEventsHandler,
ITestHostLauncher customTestHostLauncher)
+ {
+ await RunTestsWithCustomTestHostAsync(
+ testCases,
+ runSettings,
+ options,
+ testRunEventsHandler,
+ new NoOpTelemetryEventsHandler(),
+ customTestHostLauncher).ConfigureAwait(false);
+ }
+
+ ///
+ [Obsolete("This API is not final yet and is subject to changes.", false)]
+ public async Task RunTestsWithCustomTestHostAsync(
+ IEnumerable testCases,
+ string runSettings,
+ TestPlatformOptions? options,
+ ITestRunEventsHandler testRunEventsHandler,
+ ITelemetryEventsHandler telemetryEventsHandler,
+ ITestHostLauncher customTestHostLauncher)
{
await _consoleWrapper.RunTestsWithCustomTestHostAsync(
testCases,
@@ -458,6 +609,7 @@ public bool StopTestSession(ITestSessionEventsHandler eventsHandler)
options,
TestSessionInfo,
testRunEventsHandler,
+ telemetryEventsHandler,
customTestHostLauncher).ConfigureAwait(false);
}
diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleRequestSender.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleRequestSender.cs
index d63225ebb9..dfe25767e6 100644
--- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleRequestSender.cs
+++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleRequestSender.cs
@@ -205,7 +205,8 @@ public void InitializeExtensions(IEnumerable pathToAdditionalExtensions)
string? runSettings,
TestPlatformOptions? options,
TestSessionInfo? testSessionInfo,
- ITestRunEventsHandler runEventsHandler)
+ ITestRunEventsHandler runEventsHandler,
+ ITelemetryEventsHandler telemetryEventsHandler)
{
EqtTrace.Info("VsTestConsoleRequestSender.StartTestRun: Starting test run.");
@@ -219,6 +220,7 @@ public void InitializeExtensions(IEnumerable pathToAdditionalExtensions)
TestSessionInfo = testSessionInfo
},
runEventsHandler,
+ telemetryEventsHandler,
null);
}
@@ -228,7 +230,8 @@ public void InitializeExtensions(IEnumerable pathToAdditionalExtensions)
string? runSettings,
TestPlatformOptions? options,
TestSessionInfo? testSessionInfo,
- ITestRunEventsHandler runEventsHandler)
+ ITestRunEventsHandler runEventsHandler,
+ ITelemetryEventsHandler telemetryEventsHandler)
{
EqtTrace.Info("VsTestConsoleRequestSender.StartTestRunAsync: Starting test run.");
@@ -242,6 +245,7 @@ public void InitializeExtensions(IEnumerable pathToAdditionalExtensions)
TestSessionInfo = testSessionInfo
},
runEventsHandler,
+ telemetryEventsHandler,
null).ConfigureAwait(false);
}
@@ -251,7 +255,8 @@ public void InitializeExtensions(IEnumerable pathToAdditionalExtensions)
string? runSettings,
TestPlatformOptions? options,
TestSessionInfo? testSessionInfo,
- ITestRunEventsHandler runEventsHandler)
+ ITestRunEventsHandler runEventsHandler,
+ ITelemetryEventsHandler telemetryEventsHandler)
{
EqtTrace.Info("VsTestConsoleRequestSender.StartTestRun: Starting test run.");
@@ -265,6 +270,7 @@ public void InitializeExtensions(IEnumerable pathToAdditionalExtensions)
TestSessionInfo = testSessionInfo
},
runEventsHandler,
+ telemetryEventsHandler,
null);
}
@@ -274,7 +280,8 @@ public void InitializeExtensions(IEnumerable pathToAdditionalExtensions)
string? runSettings,
TestPlatformOptions? options,
TestSessionInfo? testSessionInfo,
- ITestRunEventsHandler runEventsHandler)
+ ITestRunEventsHandler runEventsHandler,
+ ITelemetryEventsHandler telemetryEventsHandler)
{
EqtTrace.Info("VsTestConsoleRequestSender.StartTestRunAsync: Starting test run.");
@@ -288,6 +295,7 @@ public void InitializeExtensions(IEnumerable pathToAdditionalExtensions)
TestSessionInfo = testSessionInfo
},
runEventsHandler,
+ telemetryEventsHandler,
null).ConfigureAwait(false);
}
@@ -298,6 +306,7 @@ public void InitializeExtensions(IEnumerable pathToAdditionalExtensions)
TestPlatformOptions? options,
TestSessionInfo? testSessionInfo,
ITestRunEventsHandler runEventsHandler,
+ ITelemetryEventsHandler telemetryEventsHandler,
ITestHostLauncher customHostLauncher)
{
EqtTrace.Info("VsTestConsoleRequestSender.StartTestRunWithCustomHost: Starting test run.");
@@ -313,6 +322,7 @@ public void InitializeExtensions(IEnumerable pathToAdditionalExtensions)
TestSessionInfo = testSessionInfo
},
runEventsHandler,
+ telemetryEventsHandler,
customHostLauncher);
}
@@ -323,6 +333,7 @@ public void InitializeExtensions(IEnumerable pathToAdditionalExtensions)
TestPlatformOptions? options,
TestSessionInfo? testSessionInfo,
ITestRunEventsHandler runEventsHandler,
+ ITelemetryEventsHandler telemetryEventsHandler,
ITestHostLauncher customHostLauncher)
{
EqtTrace.Info("VsTestConsoleRequestSender.StartTestRunWithCustomHostAsync: Starting test run.");
@@ -338,6 +349,7 @@ public void InitializeExtensions(IEnumerable pathToAdditionalExtensions)
TestSessionInfo = testSessionInfo
},
runEventsHandler,
+ telemetryEventsHandler,
customHostLauncher).ConfigureAwait(false);
}
@@ -348,6 +360,7 @@ public void InitializeExtensions(IEnumerable pathToAdditionalExtensions)
TestPlatformOptions? options,
TestSessionInfo? testSessionInfo,
ITestRunEventsHandler runEventsHandler,
+ ITelemetryEventsHandler telemetryEventsHandler,
ITestHostLauncher customHostLauncher)
{
EqtTrace.Info("VsTestConsoleRequestSender.StartTestRunWithCustomHost: Starting test run.");
@@ -363,6 +376,7 @@ public void InitializeExtensions(IEnumerable pathToAdditionalExtensions)
TestSessionInfo = testSessionInfo
},
runEventsHandler,
+ telemetryEventsHandler,
customHostLauncher);
}
@@ -373,6 +387,7 @@ public void InitializeExtensions(IEnumerable pathToAdditionalExtensions)
TestPlatformOptions? options,
TestSessionInfo? testSessionInfo,
ITestRunEventsHandler runEventsHandler,
+ ITelemetryEventsHandler telemetryEventsHandler,
ITestHostLauncher customHostLauncher)
{
EqtTrace.Info("VsTestConsoleRequestSender.StartTestRunWithCustomHostAsync: Starting test run.");
@@ -388,6 +403,7 @@ public void InitializeExtensions(IEnumerable pathToAdditionalExtensions)
TestSessionInfo = testSessionInfo
},
runEventsHandler,
+ telemetryEventsHandler,
customHostLauncher).ConfigureAwait(false);
}
@@ -1114,6 +1130,7 @@ private async Task HandShakeWithVsTestConsoleAsync()
string messageType,
object payload,
ITestRunEventsHandler eventHandler,
+ ITelemetryEventsHandler telemetryEventsHandler,
ITestHostLauncher? customHostLauncher)
{
try
@@ -1169,6 +1186,10 @@ private async Task HandShakeWithVsTestConsoleAsync()
{
AttachDebuggerToProcess(customHostLauncher, message);
}
+ else if (string.Equals(MessageType.TelemetryEventMessage, message.MessageType))
+ {
+ HandleTelemetryEvent(telemetryEventsHandler, message);
+ }
}
}
catch (Exception exception)
@@ -1196,6 +1217,7 @@ private async Task HandShakeWithVsTestConsoleAsync()
string messageType,
object payload,
ITestRunEventsHandler eventHandler,
+ ITelemetryEventsHandler telemetryEventsHandler,
ITestHostLauncher? customHostLauncher)
{
try
@@ -1249,6 +1271,10 @@ private async Task HandShakeWithVsTestConsoleAsync()
{
AttachDebuggerToProcess(customHostLauncher, message);
}
+ else if (string.Equals(MessageType.TelemetryEventMessage, message.MessageType))
+ {
+ HandleTelemetryEvent(telemetryEventsHandler, message);
+ }
}
}
catch (Exception exception)
@@ -1499,4 +1525,20 @@ private void AttachDebuggerToProcess(ITestHostLauncher? customHostLauncher, Mess
_protocolVersion);
}
}
+
+ private void HandleTelemetryEvent(ITelemetryEventsHandler telemetryEventsHandler, Message message)
+ {
+ try
+ {
+ TelemetryEvent? telemetryEvent = _dataSerializer.DeserializePayload(message);
+ if (telemetryEvent is not null)
+ {
+ telemetryEventsHandler.HandleTelemetryEvent(telemetryEvent);
+ }
+ }
+ catch (Exception ex)
+ {
+ EqtTrace.Error("VsTestConsoleRequestSender.HandleTelemetryEvent: Error while handling telemetry event: {0}", ex);
+ }
+ }
}
diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleWrapper.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleWrapper.cs
index 7d02ce54a8..ea17ec6555 100644
--- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleWrapper.cs
+++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleWrapper.cs
@@ -21,6 +21,7 @@
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.Interfaces;
using Microsoft.VisualStudio.TestPlatform.PlatformAbstractions;
using Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces;
+using Microsoft.VisualStudio.TestPlatform.VsTestConsole.TranslationLayer;
using Microsoft.VisualStudio.TestPlatform.VsTestConsole.TranslationLayer.Interfaces;
using CommunicationUtilitiesResources = Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.Resources.Resources;
@@ -354,6 +355,24 @@ public void CancelDiscovery()
TestPlatformOptions? options,
TestSessionInfo? testSessionInfo,
ITestRunEventsHandler testRunEventsHandler)
+ {
+ RunTests(
+ sources,
+ runSettings,
+ options,
+ testSessionInfo,
+ testRunEventsHandler,
+ new NoOpTelemetryEventsHandler());
+ }
+
+ ///
+ public void RunTests(
+ IEnumerable sources,
+ string? runSettings,
+ TestPlatformOptions? options,
+ TestSessionInfo? testSessionInfo,
+ ITestRunEventsHandler testRunEventsHandler,
+ ITelemetryEventsHandler telemetryEventsHandler)
{
var sourceList = sources.ToList();
_testPlatformEventSource.TranslationLayerExecutionStart(
@@ -368,7 +387,8 @@ public void CancelDiscovery()
runSettings,
options,
testSessionInfo,
- testRunEventsHandler);
+ testRunEventsHandler,
+ telemetryEventsHandler);
}
///
@@ -406,6 +426,24 @@ public void CancelDiscovery()
TestPlatformOptions? options,
TestSessionInfo? testSessionInfo,
ITestRunEventsHandler testRunEventsHandler)
+ {
+ RunTests(
+ testCases,
+ runSettings,
+ options,
+ testSessionInfo,
+ testRunEventsHandler,
+ new NoOpTelemetryEventsHandler());
+ }
+
+ ///
+ public void RunTests(
+ IEnumerable testCases,
+ string? runSettings,
+ TestPlatformOptions? options,
+ TestSessionInfo? testSessionInfo,
+ ITestRunEventsHandler testRunEventsHandler,
+ ITelemetryEventsHandler telemetryEventsHandler)
{
var testCaseList = testCases.ToList();
_testPlatformEventSource.TranslationLayerExecutionStart(
@@ -420,7 +458,8 @@ public void CancelDiscovery()
runSettings,
options,
testSessionInfo,
- testRunEventsHandler);
+ testRunEventsHandler,
+ telemetryEventsHandler);
}
///
@@ -463,6 +502,26 @@ public void CancelDiscovery()
TestSessionInfo? testSessionInfo,
ITestRunEventsHandler testRunEventsHandler,
ITestHostLauncher customTestHostLauncher)
+ {
+ RunTestsWithCustomTestHost(
+ sources,
+ runSettings,
+ options,
+ testSessionInfo,
+ testRunEventsHandler,
+ new NoOpTelemetryEventsHandler(),
+ customTestHostLauncher);
+ }
+
+ ///
+ public void RunTestsWithCustomTestHost(
+ IEnumerable sources,
+ string? runSettings,
+ TestPlatformOptions? options,
+ TestSessionInfo? testSessionInfo,
+ ITestRunEventsHandler testRunEventsHandler,
+ ITelemetryEventsHandler telemetryEventsHandler,
+ ITestHostLauncher customTestHostLauncher)
{
var sourceList = sources.ToList();
_testPlatformEventSource.TranslationLayerExecutionStart(
@@ -478,6 +537,7 @@ public void CancelDiscovery()
options,
testSessionInfo,
testRunEventsHandler,
+ telemetryEventsHandler,
customTestHostLauncher);
}
@@ -521,6 +581,26 @@ public void CancelDiscovery()
TestSessionInfo? testSessionInfo,
ITestRunEventsHandler testRunEventsHandler,
ITestHostLauncher customTestHostLauncher)
+ {
+ RunTestsWithCustomTestHost(
+ testCases,
+ runSettings,
+ options,
+ testSessionInfo,
+ testRunEventsHandler,
+ new NoOpTelemetryEventsHandler(),
+ customTestHostLauncher);
+ }
+
+ ///
+ public void RunTestsWithCustomTestHost(
+ IEnumerable testCases,
+ string? runSettings,
+ TestPlatformOptions? options,
+ TestSessionInfo? testSessionInfo,
+ ITestRunEventsHandler testRunEventsHandler,
+ ITelemetryEventsHandler telemetryEventsHandler,
+ ITestHostLauncher customTestHostLauncher)
{
var testCaseList = testCases.ToList();
_testPlatformEventSource.TranslationLayerExecutionStart(
@@ -536,6 +616,7 @@ public void CancelDiscovery()
options,
testSessionInfo,
testRunEventsHandler,
+ telemetryEventsHandler,
customTestHostLauncher);
}
@@ -779,6 +860,24 @@ public async Task InitializeExtensionsAsync(IEnumerable pathToAdditional
TestPlatformOptions? options,
TestSessionInfo? testSessionInfo,
ITestRunEventsHandler testRunEventsHandler)
+ {
+ await RunTestsAsync(
+ sources,
+ runSettings,
+ options,
+ testSessionInfo,
+ testRunEventsHandler,
+ new NoOpTelemetryEventsHandler()).ConfigureAwait(false);
+ }
+
+ ///
+ public async Task RunTestsAsync(
+ IEnumerable sources,
+ string? runSettings,
+ TestPlatformOptions? options,
+ TestSessionInfo? testSessionInfo,
+ ITestRunEventsHandler testRunEventsHandler,
+ ITelemetryEventsHandler telemetryEventsHandler)
{
var sourceList = sources.ToList();
_testPlatformEventSource.TranslationLayerExecutionStart(
@@ -793,7 +892,8 @@ public async Task InitializeExtensionsAsync(IEnumerable pathToAdditional
runSettings,
options,
testSessionInfo,
- testRunEventsHandler).ConfigureAwait(false);
+ testRunEventsHandler,
+ telemetryEventsHandler).ConfigureAwait(false);
}
///
@@ -831,6 +931,24 @@ public async Task InitializeExtensionsAsync(IEnumerable pathToAdditional
TestPlatformOptions? options,
TestSessionInfo? testSessionInfo,
ITestRunEventsHandler testRunEventsHandler)
+ {
+ await RunTestsAsync(
+ testCases,
+ runSettings,
+ options,
+ testSessionInfo,
+ testRunEventsHandler,
+ new NoOpTelemetryEventsHandler()).ConfigureAwait(false);
+ }
+
+ ///
+ public async Task RunTestsAsync(
+ IEnumerable testCases,
+ string? runSettings,
+ TestPlatformOptions? options,
+ TestSessionInfo? testSessionInfo,
+ ITestRunEventsHandler testRunEventsHandler,
+ ITelemetryEventsHandler telemetryEventsHandler)
{
var testCaseList = testCases.ToList();
_testPlatformEventSource.TranslationLayerExecutionStart(
@@ -845,7 +963,8 @@ public async Task InitializeExtensionsAsync(IEnumerable pathToAdditional
runSettings,
options,
testSessionInfo,
- testRunEventsHandler).ConfigureAwait(false);
+ testRunEventsHandler,
+ telemetryEventsHandler).ConfigureAwait(false);
}
///
@@ -888,6 +1007,26 @@ public async Task InitializeExtensionsAsync(IEnumerable pathToAdditional
TestSessionInfo? testSessionInfo,
ITestRunEventsHandler testRunEventsHandler,
ITestHostLauncher customTestHostLauncher)
+ {
+ await RunTestsWithCustomTestHostAsync(
+ sources,
+ runSettings,
+ options,
+ testSessionInfo,
+ testRunEventsHandler,
+ new NoOpTelemetryEventsHandler(),
+ customTestHostLauncher).ConfigureAwait(false);
+ }
+
+ ///
+ public async Task RunTestsWithCustomTestHostAsync(
+ IEnumerable sources,
+ string? runSettings,
+ TestPlatformOptions? options,
+ TestSessionInfo? testSessionInfo,
+ ITestRunEventsHandler testRunEventsHandler,
+ ITelemetryEventsHandler telemetryEventsHandler,
+ ITestHostLauncher customTestHostLauncher)
{
var sourceList = sources.ToList();
_testPlatformEventSource.TranslationLayerExecutionStart(
@@ -903,6 +1042,7 @@ public async Task InitializeExtensionsAsync(IEnumerable pathToAdditional
options,
testSessionInfo,
testRunEventsHandler,
+ telemetryEventsHandler,
customTestHostLauncher).ConfigureAwait(false);
}
@@ -946,6 +1086,26 @@ public async Task InitializeExtensionsAsync(IEnumerable pathToAdditional
TestSessionInfo? testSessionInfo,
ITestRunEventsHandler testRunEventsHandler,
ITestHostLauncher customTestHostLauncher)
+ {
+ await RunTestsWithCustomTestHostAsync(
+ testCases,
+ runSettings,
+ options,
+ testSessionInfo,
+ testRunEventsHandler,
+ new NoOpTelemetryEventsHandler(),
+ customTestHostLauncher).ConfigureAwait(false);
+ }
+
+ ///
+ public async Task RunTestsWithCustomTestHostAsync(
+ IEnumerable testCases,
+ string? runSettings,
+ TestPlatformOptions? options,
+ TestSessionInfo? testSessionInfo,
+ ITestRunEventsHandler testRunEventsHandler,
+ ITelemetryEventsHandler telemetryEventsHandler,
+ ITestHostLauncher customTestHostLauncher)
{
var testCaseList = testCases.ToList();
_testPlatformEventSource.TranslationLayerExecutionStart(
@@ -961,6 +1121,7 @@ public async Task InitializeExtensionsAsync(IEnumerable pathToAdditional
options,
testSessionInfo,
testRunEventsHandler,
+ telemetryEventsHandler,
customTestHostLauncher).ConfigureAwait(false);
}
diff --git a/src/vstest.console/InProcessVsTestConsoleWrapper.cs b/src/vstest.console/InProcessVsTestConsoleWrapper.cs
index dc066cf9b9..8ba865f64c 100644
--- a/src/vstest.console/InProcessVsTestConsoleWrapper.cs
+++ b/src/vstest.console/InProcessVsTestConsoleWrapper.cs
@@ -11,6 +11,8 @@
using System.Threading;
using System.Threading.Tasks;
+using Abstraction::Microsoft.VisualStudio.TestPlatform.PlatformAbstractions;
+
using Microsoft.TestPlatform.VsTestConsole.TranslationLayer;
using Microsoft.TestPlatform.VsTestConsole.TranslationLayer.Interfaces;
using Microsoft.VisualStudio.TestPlatform.Client;
@@ -25,7 +27,6 @@
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.Interfaces;
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.Payloads;
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging;
-using Abstraction::Microsoft.VisualStudio.TestPlatform.PlatformAbstractions;
using Microsoft.VisualStudio.TestPlatform.Utilities;
using Microsoft.VisualStudio.TestPlatform.Utilities.Helpers.Interfaces;
using Microsoft.VisualStudio.TestPlatform.VsTestConsole.TranslationLayer.Interfaces;
@@ -526,6 +527,23 @@ public void InitializeExtensions(IEnumerable pathToAdditionalExtensions)
_testPlatformEventSource.TranslationLayerExecutionStop();
}
+ ///
+ public void RunTests(
+ IEnumerable sources,
+ string? runSettings,
+ TestPlatformOptions? options,
+ TestSessionInfo? testSessionInfo,
+ ITestRunEventsHandler testRunEventsHandler,
+ ITelemetryEventsHandler telemetryEventsHandler)
+ {
+ RunTests(
+ sources,
+ runSettings,
+ options,
+ testSessionInfo,
+ testRunEventsHandler);
+ }
+
///
public void RunTests(
IEnumerable testCases,
@@ -599,6 +617,23 @@ public void InitializeExtensions(IEnumerable pathToAdditionalExtensions)
_testPlatformEventSource.TranslationLayerExecutionStop();
}
+ ///
+ public void RunTests(
+ IEnumerable testCases,
+ string? runSettings,
+ TestPlatformOptions? options,
+ TestSessionInfo? testSessionInfo,
+ ITestRunEventsHandler testRunEventsHandler,
+ ITelemetryEventsHandler telemetryEventsHandler)
+ {
+ RunTests(
+ testCases,
+ runSettings,
+ options,
+ testSessionInfo,
+ testRunEventsHandler);
+ }
+
///
public void RunTestsWithCustomTestHost(
IEnumerable sources,
@@ -691,6 +726,25 @@ public void InitializeExtensions(IEnumerable pathToAdditionalExtensions)
_testPlatformEventSource.TranslationLayerExecutionStop();
}
+ ///
+ public void RunTestsWithCustomTestHost(
+ IEnumerable sources,
+ string? runSettings,
+ TestPlatformOptions? options,
+ TestSessionInfo? testSessionInfo,
+ ITestRunEventsHandler testRunEventsHandler,
+ ITelemetryEventsHandler telemetryEventsHandler,
+ ITestHostLauncher? customTestHostLauncher)
+ {
+ RunTestsWithCustomTestHost(
+ sources,
+ runSettings,
+ options,
+ testSessionInfo,
+ testRunEventsHandler,
+ customTestHostLauncher);
+ }
+
///
public void RunTestsWithCustomTestHost(
IEnumerable testCases,
@@ -783,6 +837,25 @@ public void InitializeExtensions(IEnumerable pathToAdditionalExtensions)
_testPlatformEventSource.TranslationLayerExecutionStop();
}
+ ///
+ public void RunTestsWithCustomTestHost(
+ IEnumerable testCases,
+ string? runSettings,
+ TestPlatformOptions? options,
+ TestSessionInfo? testSessionInfo,
+ ITestRunEventsHandler testRunEventsHandler,
+ ITelemetryEventsHandler telemetryEventsHandler,
+ ITestHostLauncher? customTestHostLauncher)
+ {
+ RunTestsWithCustomTestHost(
+ testCases,
+ runSettings,
+ options,
+ testSessionInfo,
+ testRunEventsHandler,
+ customTestHostLauncher);
+ }
+
#region Async, not implemented
///
public async Task DiscoverTestsAsync(
@@ -953,6 +1026,18 @@ public Task InitializeExtensionsAsync(IEnumerable pathToAdditionalExtens
throw new NotImplementedException();
}
+ ///
+ public Task RunTestsAsync(
+ IEnumerable sources,
+ string? runSettings,
+ TestPlatformOptions? options,
+ TestSessionInfo? testSessionInfo,
+ ITestRunEventsHandler testRunEventsHandler,
+ ITelemetryEventsHandler telemetryEventsHandler)
+ {
+ throw new NotImplementedException();
+ }
+
///
public async Task RunTestsAsync(
IEnumerable testCases,
@@ -994,6 +1079,18 @@ public Task InitializeExtensionsAsync(IEnumerable pathToAdditionalExtens
throw new NotImplementedException();
}
+ ///
+ public Task RunTestsAsync(
+ IEnumerable testCases,
+ string? runSettings,
+ TestPlatformOptions? options,
+ TestSessionInfo? testSessionInfo,
+ ITestRunEventsHandler testRunEventsHandler,
+ ITelemetryEventsHandler telemetryEventsHandler)
+ {
+ throw new NotImplementedException();
+ }
+
///
public async Task RunTestsWithCustomTestHostAsync(
IEnumerable sources,
@@ -1040,6 +1137,19 @@ public Task InitializeExtensionsAsync(IEnumerable pathToAdditionalExtens
throw new NotImplementedException();
}
+ ///
+ public Task RunTestsWithCustomTestHostAsync(
+ IEnumerable sources,
+ string? runSettings,
+ TestPlatformOptions? options,
+ TestSessionInfo? testSessionInfo,
+ ITestRunEventsHandler testRunEventsHandler,
+ ITelemetryEventsHandler telemetryEventsHandler,
+ ITestHostLauncher customTestHostLauncher)
+ {
+ throw new NotImplementedException();
+ }
+
///
public async Task RunTestsWithCustomTestHostAsync(
IEnumerable testCases,
@@ -1086,6 +1196,19 @@ public Task InitializeExtensionsAsync(IEnumerable pathToAdditionalExtens
throw new NotImplementedException();
}
+ ///
+ public Task RunTestsWithCustomTestHostAsync(
+ IEnumerable testCases,
+ string? runSettings,
+ TestPlatformOptions? options,
+ TestSessionInfo? testSessionInfo,
+ ITestRunEventsHandler testRunEventsHandler,
+ ITelemetryEventsHandler telemetryEventsHandler,
+ ITestHostLauncher customTestHostLauncher)
+ {
+ throw new NotImplementedException();
+ }
+
///
public Task StartSessionAsync()
{
diff --git a/test/Microsoft.TestPlatform.CommunicationUtilities.UnitTests/DataCollectionRequestSenderTests.cs b/test/Microsoft.TestPlatform.CommunicationUtilities.UnitTests/DataCollectionRequestSenderTests.cs
index bd581840d7..81245148c2 100644
--- a/test/Microsoft.TestPlatform.CommunicationUtilities.UnitTests/DataCollectionRequestSenderTests.cs
+++ b/test/Microsoft.TestPlatform.CommunicationUtilities.UnitTests/DataCollectionRequestSenderTests.cs
@@ -11,6 +11,7 @@
using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.Interfaces;
using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.ObjectModel;
using Microsoft.VisualStudio.TestPlatform.ObjectModel;
+using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
@@ -37,12 +38,16 @@ public void SendAfterTestRunEndAndGetResultShouldReturnAttachments()
var datacollectorUri = new Uri("my://custom/datacollector");
var attachmentUri = new Uri("my://filename.txt");
var displayName = "CustomDataCollector";
+ var rawMessage1 = "rawMessage1";
+ var rawMessage2 = "rawMessage2";
var attachment = new AttachmentSet(datacollectorUri, displayName);
attachment.Attachments.Add(new UriDataAttachment(attachmentUri, "filename.txt"));
var invokedDataCollector = new InvokedDataCollector(datacollectorUri, displayName, typeof(string).AssemblyQualifiedName!, typeof(string).Assembly.Location, false);
_mockDataSerializer.Setup(x => x.DeserializePayload(It.IsAny())).Returns(
new AfterTestRunEndResult(new Collection() { attachment }, new Collection() { invokedDataCollector }, new Dictionary()));
- _mockCommunicationManager.Setup(x => x.ReceiveMessage()).Returns(new Message() { MessageType = MessageType.AfterTestRunEndResult, Payload = null });
+ _mockCommunicationManager.SetupSequence(x => x.ReceiveRawMessage()).Returns(rawMessage1).Returns(rawMessage2);
+ _mockDataSerializer.Setup(x => x.DeserializeMessage(rawMessage1)).Returns(new Message() { MessageType = MessageType.TelemetryEventMessage, Payload = null });
+ _mockDataSerializer.Setup(x => x.DeserializeMessage(rawMessage2)).Returns(new Message() { MessageType = MessageType.AfterTestRunEndResult, Payload = null });
var result = _requestSender.SendAfterTestRunEndAndGetResult(null, false);
@@ -63,6 +68,45 @@ public void SendAfterTestRunEndAndGetResultShouldReturnAttachments()
Assert.AreEqual(invokedDataCollector.AssemblyQualifiedName, result.InvokedDataCollectors[0].AssemblyQualifiedName);
}
+ [TestMethod]
+ public void SendAfterTestRunEndAndGetResultShouldReturnAttachmentsAndPropagateTelemetry()
+ {
+ var datacollectorUri = new Uri("my://custom/datacollector");
+ var attachmentUri = new Uri("my://filename.txt");
+ var displayName = "CustomDataCollector";
+ var rawMessage1 = "rawMessage1";
+ var rawMessage2 = "rawMessage2";
+ var attachment = new AttachmentSet(datacollectorUri, displayName);
+ attachment.Attachments.Add(new UriDataAttachment(attachmentUri, "filename.txt"));
+ var invokedDataCollector = new InvokedDataCollector(datacollectorUri, displayName, typeof(string).AssemblyQualifiedName!, typeof(string).Assembly.Location, false);
+ _mockDataSerializer.Setup(x => x.DeserializePayload(It.IsAny())).Returns(
+ new AfterTestRunEndResult(new Collection() { attachment }, new Collection() { invokedDataCollector }, new Dictionary()));
+ _mockCommunicationManager.SetupSequence(x => x.ReceiveRawMessage()).Returns(rawMessage1).Returns(rawMessage2);
+ _mockDataSerializer.Setup(x => x.DeserializeMessage(rawMessage1)).Returns(new Message() { MessageType = MessageType.TelemetryEventMessage, Payload = null });
+ _mockDataSerializer.Setup(x => x.DeserializeMessage(rawMessage2)).Returns(new Message() { MessageType = MessageType.AfterTestRunEndResult, Payload = null });
+ var handlerMock = new Mock();
+
+ var result = _requestSender.SendAfterTestRunEndAndGetResult(handlerMock.Object, false);
+
+ Assert.IsNotNull(result);
+ Assert.IsNotNull(result.AttachmentSets);
+ Assert.IsNotNull(result.AttachmentSets);
+ Assert.IsNotNull(result.Metrics);
+ Assert.AreEqual(1, result.AttachmentSets.Count);
+ Assert.AreEqual(1, result.InvokedDataCollectors!.Count);
+ Assert.AreEqual(0, result.Metrics.Count);
+ Assert.IsNotNull(result.AttachmentSets[0]);
+ Assert.AreEqual(displayName, result.AttachmentSets[0].DisplayName);
+ Assert.AreEqual(datacollectorUri, result.AttachmentSets[0].Uri);
+ Assert.AreEqual(attachmentUri, result.AttachmentSets[0].Attachments[0].Uri);
+ Assert.IsNotNull(result.InvokedDataCollectors[0]);
+ Assert.AreEqual(datacollectorUri, result.InvokedDataCollectors[0].Uri);
+ Assert.AreEqual(invokedDataCollector.FilePath, result.InvokedDataCollectors[0].FilePath);
+ Assert.AreEqual(invokedDataCollector.AssemblyQualifiedName, result.InvokedDataCollectors[0].AssemblyQualifiedName);
+
+ handlerMock.Verify(h => h.HandleRawMessage(rawMessage1));
+ }
+
[TestMethod]
public void SendAfterTestRunEndAndGetResultShouldNotReturnAttachmentsWhenRequestCancelled()
{
@@ -74,8 +118,40 @@ public void SendAfterTestRunEndAndGetResultShouldNotReturnAttachmentsWhenRequest
[TestMethod]
public void SendBeforeTestRunStartAndGetResultShouldSendBeforeTestRunStartMessageAndPayload()
{
+ var rawMessage = "rawMessage";
+ var testSources = new List() { "test1.dll" };
+ _mockCommunicationManager.Setup(x => x.ReceiveRawMessage()).Returns(rawMessage);
+ _mockDataSerializer.Setup(x => x.DeserializeMessage(rawMessage)).Returns(new Message() { MessageType = MessageType.BeforeTestRunStartResult, Payload = null });
+ _requestSender.SendBeforeTestRunStartAndGetResult(string.Empty, testSources, true, null);
+
+ _mockCommunicationManager.Verify(x => x.SendMessage(MessageType.BeforeTestRunStart, It.Is(p => p.SettingsXml == string.Empty && p.IsTelemetryOptedIn)));
+ }
+
+ [TestMethod]
+ public void SendBeforeTestRunStartAndGetResultShouldSendRawMessageIfTelemetry()
+ {
+ var rawMessage1 = "rawMessage1";
+ var rawMessage2 = "rawMessage2";
+ var testSources = new List() { "test1.dll" };
+ var handlerMock = new Mock();
+ _mockCommunicationManager.SetupSequence(x => x.ReceiveRawMessage()).Returns(rawMessage1).Returns(rawMessage2);
+ _mockDataSerializer.Setup(x => x.DeserializeMessage(rawMessage1)).Returns(new Message() { MessageType = MessageType.TelemetryEventMessage, Payload = null });
+ _mockDataSerializer.Setup(x => x.DeserializeMessage(rawMessage2)).Returns(new Message() { MessageType = MessageType.BeforeTestRunStartResult, Payload = null });
+ _requestSender.SendBeforeTestRunStartAndGetResult(string.Empty, testSources, true, handlerMock.Object);
+
+ handlerMock.Verify(x => x.HandleRawMessage(rawMessage1));
+ _mockCommunicationManager.Verify(x => x.SendMessage(MessageType.BeforeTestRunStart, It.Is(p => p.SettingsXml == string.Empty && p.IsTelemetryOptedIn)));
+ }
+
+ [TestMethod]
+ public void SendBeforeTestRunStartAndGetResultShouldNotSendRawMessageIfTelemetryAndNoHandler()
+ {
+ var rawMessage1 = "rawMessage1";
+ var rawMessage2 = "rawMessage2";
var testSources = new List() { "test1.dll" };
- _mockCommunicationManager.Setup(x => x.ReceiveMessage()).Returns(new Message() { MessageType = MessageType.BeforeTestRunStartResult, Payload = null });
+ _mockCommunicationManager.SetupSequence(x => x.ReceiveRawMessage()).Returns(rawMessage1).Returns(rawMessage2);
+ _mockDataSerializer.Setup(x => x.DeserializeMessage(rawMessage1)).Returns(new Message() { MessageType = MessageType.TelemetryEventMessage, Payload = null });
+ _mockDataSerializer.Setup(x => x.DeserializeMessage(rawMessage2)).Returns(new Message() { MessageType = MessageType.BeforeTestRunStartResult, Payload = null });
_requestSender.SendBeforeTestRunStartAndGetResult(string.Empty, testSources, true, null);
_mockCommunicationManager.Verify(x => x.SendMessage(MessageType.BeforeTestRunStart, It.Is(p => p.SettingsXml == string.Empty && p.IsTelemetryOptedIn)));
diff --git a/test/Microsoft.TestPlatform.CommunicationUtilities.UnitTests/TelemetryReporterTests.cs b/test/Microsoft.TestPlatform.CommunicationUtilities.UnitTests/TelemetryReporterTests.cs
new file mode 100644
index 0000000000..4ed30047ee
--- /dev/null
+++ b/test/Microsoft.TestPlatform.CommunicationUtilities.UnitTests/TelemetryReporterTests.cs
@@ -0,0 +1,67 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+using System.Collections.Generic;
+
+using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities;
+using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.Interfaces;
+using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.ObjectModel;
+using Microsoft.VisualStudio.TestPlatform.ObjectModel;
+using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+using Moq;
+
+namespace Microsoft.TestPlatform.CommunicationUtilities.UnitTests;
+
+[TestClass]
+public class TelemetryReporterTests
+{
+ private readonly Mock _requestData;
+ private readonly Mock _communicationManager;
+ private readonly Mock _dataSerializer;
+ private readonly ITelemetryReporter _telemetryReporter;
+
+ public TelemetryReporterTests()
+ {
+ _requestData = new();
+ _communicationManager = new();
+ _dataSerializer = new();
+ _telemetryReporter = new TelemetryReporter(_requestData.Object, _communicationManager.Object, _dataSerializer.Object);
+ }
+
+ [TestMethod]
+ public void Report_ShouldDoNothing_IfTelemetryDisabled()
+ {
+ _requestData.Setup(r => r.IsTelemetryOptedIn).Returns(false);
+ TelemetryEvent telemetryEvent = new("name", new Dictionary());
+
+ _telemetryReporter.Report(telemetryEvent);
+
+ _requestData.VerifyAll();
+ _requestData.VerifyNoOtherCalls();
+ _dataSerializer.VerifyAll();
+ _dataSerializer.VerifyNoOtherCalls();
+ _communicationManager.VerifyAll();
+ _communicationManager.VerifyNoOtherCalls();
+ }
+
+ [TestMethod]
+ public void Report_ShouldSendMessage_IfTelemetryEnabled()
+ {
+ _requestData.Setup(r => r.IsTelemetryOptedIn).Returns(true);
+ TelemetryEvent telemetryEvent = new("name", new Dictionary());
+ var rawMessage = "rawMessage";
+ _dataSerializer.Setup(d => d.SerializePayload(MessageType.TelemetryEventMessage, telemetryEvent)).Returns(rawMessage);
+
+ _telemetryReporter.Report(telemetryEvent);
+
+ _communicationManager.Verify(c => c.SendRawMessage(rawMessage));
+ _requestData.VerifyAll();
+ _requestData.VerifyNoOtherCalls();
+ _dataSerializer.VerifyAll();
+ _dataSerializer.VerifyNoOtherCalls();
+ _communicationManager.VerifyAll();
+ _communicationManager.VerifyNoOtherCalls();
+ }
+}
diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyExecutionManagerWithDataCollectionTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyExecutionManagerWithDataCollectionTests.cs
index 7f9a084eec..eaf3784085 100644
--- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyExecutionManagerWithDataCollectionTests.cs
+++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyExecutionManagerWithDataCollectionTests.cs
@@ -6,8 +6,10 @@
using Microsoft.VisualStudio.TestPlatform.Common;
using Microsoft.VisualStudio.TestPlatform.Common.Telemetry;
+using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities;
using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.DataCollection.Interfaces;
using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.Interfaces;
+using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.ObjectModel;
using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client;
using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.DataCollection;
using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.DataCollection.Interfaces;
@@ -171,6 +173,12 @@ public void LaunchProcessWithDebuggerAttachedShouldUpdateEnvironmentVariables()
}
};
+ string raw1 = JsonDataSerializer.Instance.SerializePayload(MessageType.TelemetryEventMessage, new TelemetryEvent("aaa", new Dictionary()));
+ string raw2 = JsonDataSerializer.Instance.SerializePayload(MessageType.TelemetryEventMessage, new TelemetryEvent("aaa", new Dictionary()));
+
+ proxyExecutionManager.DataCollectionRunEventsHandler.HandleRawMessage(raw1);
+ proxyExecutionManager.DataCollectionRunEventsHandler.HandleRawMessage(raw2);
+
// Act.
proxyExecutionManager.StartTestRun(mockTestRunCriteria.Object, mockRunEventsHandler.Object);
proxyExecutionManager.LaunchProcessWithDebuggerAttached(testProcessStartInfo);
@@ -181,6 +189,10 @@ public void LaunchProcessWithDebuggerAttachedShouldUpdateEnvironmentVariables()
{
Assert.AreEqual(envVaribale.Value, launchedStartInfo.EnvironmentVariables![envVaribale.Key], $"Expected environment variable {envVaribale.Key} : {envVaribale.Value} not found");
}
+
+ mockRunEventsHandler.Verify(r => r.HandleRawMessage(raw1));
+ mockRunEventsHandler.Verify(r => r.HandleRawMessage(raw2));
+ Assert.AreEqual(0, proxyExecutionManager.DataCollectionRunEventsHandler.RawMessages.Count);
}
[TestMethod]
diff --git a/test/TranslationLayer.UnitTests/TestSessionTests.cs b/test/TranslationLayer.UnitTests/TestSessionTests.cs
index e5491db725..f6eb5fac6a 100644
--- a/test/TranslationLayer.UnitTests/TestSessionTests.cs
+++ b/test/TranslationLayer.UnitTests/TestSessionTests.cs
@@ -9,6 +9,7 @@
using Microsoft.VisualStudio.TestPlatform.ObjectModel;
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client;
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.Interfaces;
+using Microsoft.VisualStudio.TestPlatform.VsTestConsole.TranslationLayer;
using Microsoft.VisualStudio.TestPlatform.VsTestConsole.TranslationLayer.Interfaces;
using Microsoft.VisualStudio.TestTools.UnitTesting;
@@ -132,7 +133,8 @@ public void RunTestsWithSourcesShouldCallConsoleWrapperRunTestsWithCorrectArgume
_testSettings,
null,
_testSessionInfo,
- mockTestRunEventsHandler.Object),
+ mockTestRunEventsHandler.Object,
+ It.IsAny()),
Times.Once);
}
@@ -154,7 +156,8 @@ public void RunTestsWithSourcesShouldCallConsoleWrapperRunTestsWithCorrectArgume
_testSettings,
testPlatformOptions,
_testSessionInfo,
- mockTestRunEventsHandler.Object),
+ mockTestRunEventsHandler.Object,
+ It.IsAny()),
Times.Once);
}
@@ -174,7 +177,8 @@ public void RunTestsWithTestCasesShouldCallConsoleWrapperRunTestsWithCorrectArgu
_testSettings,
null,
_testSessionInfo,
- mockTestRunEventsHandler.Object),
+ mockTestRunEventsHandler.Object,
+ It.IsAny()),
Times.Once);
}
@@ -196,7 +200,33 @@ public void RunTestsWithTestCasesShouldCallConsoleWrapperRunTestsWithCorrectArgu
_testSettings,
testPlatformOptions,
_testSessionInfo,
- mockTestRunEventsHandler.Object),
+ mockTestRunEventsHandler.Object,
+ It.IsAny()),
+ Times.Once);
+ }
+
+ [TestMethod]
+ public void RunTestsWithTestCasesShouldCallConsoleWrapperRunTestsWithCorrectArgumentsAndTelemetryHandler()
+ {
+ var testPlatformOptions = new TestPlatformOptions();
+ var mockTestRunEventsHandler = new Mock();
+ var telemetryEventsHandler = new Mock();
+
+ _testSession.RunTests(
+ _testCases,
+ _testSettings,
+ testPlatformOptions,
+ mockTestRunEventsHandler.Object,
+ telemetryEventsHandler.Object);
+
+ _mockVsTestConsoleWrapper.Verify(
+ vtcw => vtcw.RunTests(
+ _testCases,
+ _testSettings,
+ testPlatformOptions,
+ _testSessionInfo,
+ mockTestRunEventsHandler.Object,
+ telemetryEventsHandler.Object),
Times.Once);
}
@@ -219,6 +249,7 @@ public void RunTestsWithSourcesAndCustomTesthostShouldCallConsoleWrapperRunTests
null,
_testSessionInfo,
mockTestRunEventsHandler.Object,
+ It.IsAny(),
mockTestHostLauncher.Object),
Times.Once);
}
@@ -244,6 +275,7 @@ public void RunTestsWithSourcesAndCustomTesthostShouldCallConsoleWrapperRunTests
testPlatformOptions,
_testSessionInfo,
mockTestRunEventsHandler.Object,
+ It.IsAny(),
mockTestHostLauncher.Object),
Times.Once);
}
@@ -267,6 +299,7 @@ public void RunTestsWithTestCasesAndCustomTesthostShouldCallConsoleWrapperRunTes
null,
_testSessionInfo,
mockTestRunEventsHandler.Object,
+ It.IsAny(),
mockTestHostLauncher.Object),
Times.Once);
}
@@ -292,6 +325,35 @@ public void RunTestsWithTestCasesAndCustomTesthostShouldCallConsoleWrapperRunTes
testPlatformOptions,
_testSessionInfo,
mockTestRunEventsHandler.Object,
+ It.IsAny(),
+ mockTestHostLauncher.Object),
+ Times.Once);
+ }
+
+ [TestMethod]
+ public void RunTestsWithTestCasesAndCustomTesthostShouldCallConsoleWrapperRunTestsWithCorrectArgumentsAndTelemetryHandler()
+ {
+ var testPlatformOptions = new TestPlatformOptions();
+ var mockTestRunEventsHandler = new Mock();
+ var mockTestHostLauncher = new Mock();
+ var telemetryEventsHandler = new Mock();
+
+ _testSession.RunTestsWithCustomTestHost(
+ _testCases,
+ _testSettings,
+ testPlatformOptions,
+ mockTestRunEventsHandler.Object,
+ telemetryEventsHandler.Object,
+ mockTestHostLauncher.Object);
+
+ _mockVsTestConsoleWrapper.Verify(
+ vtcw => vtcw.RunTestsWithCustomTestHost(
+ _testCases,
+ _testSettings,
+ testPlatformOptions,
+ _testSessionInfo,
+ mockTestRunEventsHandler.Object,
+ telemetryEventsHandler.Object,
mockTestHostLauncher.Object),
Times.Once);
}
@@ -401,7 +463,8 @@ public async Task RunTestsAsyncWithSourcesShouldCallConsoleWrapperRunTestsWithCo
_testSettings,
null,
_testSessionInfo,
- mockTestRunEventsHandler.Object),
+ mockTestRunEventsHandler.Object,
+ It.IsAny()),
Times.Once);
}
@@ -424,7 +487,8 @@ public async Task RunTestsAsyncWithSourcesShouldCallConsoleWrapperRunTestsWithCo
_testSettings,
testPlatformOptions,
_testSessionInfo,
- mockTestRunEventsHandler.Object),
+ mockTestRunEventsHandler.Object,
+ It.IsAny()),
Times.Once);
}
@@ -445,7 +509,8 @@ public async Task RunTestsAsyncWithTestCasesShouldCallConsoleWrapperRunTestsWith
_testSettings,
null,
_testSessionInfo,
- mockTestRunEventsHandler.Object),
+ mockTestRunEventsHandler.Object,
+ It.IsAny()),
Times.Once);
}
@@ -468,7 +533,34 @@ public async Task RunTestsAsyncWithTestCasesShouldCallConsoleWrapperRunTestsWith
_testSettings,
testPlatformOptions,
_testSessionInfo,
- mockTestRunEventsHandler.Object),
+ mockTestRunEventsHandler.Object,
+ It.IsAny()),
+ Times.Once);
+ }
+
+ [TestMethod]
+ public async Task RunTestsAsyncWithTestCasesShouldCallConsoleWrapperRunTestsWithCorrectArgumentsWithTelemetryHandler()
+ {
+ var testPlatformOptions = new TestPlatformOptions();
+ var mockTestRunEventsHandler = new Mock();
+ var telemetryEventsHandler = new Mock();
+
+ await _testSession.RunTestsAsync(
+ _testCases,
+ _testSettings,
+ testPlatformOptions,
+ mockTestRunEventsHandler.Object,
+ telemetryEventsHandler.Object)
+ .ConfigureAwait(false); ;
+
+ _mockVsTestConsoleWrapper.Verify(
+ vtcw => vtcw.RunTestsAsync(
+ _testCases,
+ _testSettings,
+ testPlatformOptions,
+ _testSessionInfo,
+ mockTestRunEventsHandler.Object,
+ telemetryEventsHandler.Object),
Times.Once);
}
@@ -492,6 +584,7 @@ public async Task RunTestsAsyncWithSourcesAndCustomTesthostShouldCallConsoleWrap
null,
_testSessionInfo,
mockTestRunEventsHandler.Object,
+ It.IsAny(),
mockTestHostLauncher.Object),
Times.Once);
}
@@ -518,6 +611,7 @@ public async Task RunTestsAsyncWithSourcesAndCustomTesthostShouldCallConsoleWrap
testPlatformOptions,
_testSessionInfo,
mockTestRunEventsHandler.Object,
+ It.IsAny(),
mockTestHostLauncher.Object),
Times.Once);
}
@@ -542,6 +636,7 @@ public async Task RunTestsAsyncWithTestCasesAndCustomTesthostShouldCallConsoleWr
null,
_testSessionInfo,
mockTestRunEventsHandler.Object,
+ It.IsAny(),
mockTestHostLauncher.Object),
Times.Once);
}
@@ -568,6 +663,36 @@ public async Task RunTestsAsyncWithTestCasesAndCustomTesthostShouldCallConsoleWr
testPlatformOptions,
_testSessionInfo,
mockTestRunEventsHandler.Object,
+ It.IsAny(),
+ mockTestHostLauncher.Object),
+ Times.Once);
+ }
+
+ [TestMethod]
+ public async Task RunTestsAsyncWithTestCasesAndCustomTesthostShouldCallConsoleWrapperRunTestsWithCorrectArgumentsWithTelemetryHandler()
+ {
+ var testPlatformOptions = new TestPlatformOptions();
+ var mockTestRunEventsHandler = new Mock();
+ var mockTestHostLauncher = new Mock();
+ var telemetryEventsHandler = new Mock();
+
+ await _testSession.RunTestsWithCustomTestHostAsync(
+ _testCases,
+ _testSettings,
+ testPlatformOptions,
+ mockTestRunEventsHandler.Object,
+ telemetryEventsHandler.Object,
+ mockTestHostLauncher.Object)
+ .ConfigureAwait(false);
+
+ _mockVsTestConsoleWrapper.Verify(
+ vtcw => vtcw.RunTestsWithCustomTestHostAsync(
+ _testCases,
+ _testSettings,
+ testPlatformOptions,
+ _testSessionInfo,
+ mockTestRunEventsHandler.Object,
+ telemetryEventsHandler.Object,
mockTestHostLauncher.Object),
Times.Once);
}
diff --git a/test/TranslationLayer.UnitTests/VsTestConsoleRequestSenderTests.cs b/test/TranslationLayer.UnitTests/VsTestConsoleRequestSenderTests.cs
index 14e2f05775..67c8596f0b 100644
--- a/test/TranslationLayer.UnitTests/VsTestConsoleRequestSenderTests.cs
+++ b/test/TranslationLayer.UnitTests/VsTestConsoleRequestSenderTests.cs
@@ -38,6 +38,7 @@ public class VsTestConsoleRequestSenderTests
private readonly int _waitTimeout = 2000;
private readonly int _protocolVersion = 7;
private readonly IDataSerializer _serializer = JsonDataSerializer.Instance;
+ private readonly Mock _telemetryHandler;
public VsTestConsoleRequestSenderTests()
{
@@ -46,6 +47,7 @@ public VsTestConsoleRequestSenderTests()
_mockCommunicationManager.Object,
JsonDataSerializer.Instance,
new Mock().Object);
+ _telemetryHandler = new Mock();
}
#region Communication Tests
@@ -805,6 +807,7 @@ public void StartTestRunShouldCompleteWithZeroTests()
InitializeCommunication();
var mockHandler = new Mock();
+ var telemetryMockHandler = new Mock();
var dummyCompleteArgs = new TestRunCompleteEventArgs(null, false, false, null, null, null, TimeSpan.FromMilliseconds(1));
var dummyLastRunArgs = new TestRunChangedEventArgs(null, null, null);
@@ -820,7 +823,7 @@ public void StartTestRunShouldCompleteWithZeroTests()
var runComplete = CreateMessage(MessageType.ExecutionComplete, payload);
_mockCommunicationManager.Setup(cm => cm.ReceiveMessageAsync(It.IsAny())).Returns(Task.FromResult(runComplete));
- _requestSender.StartTestRun(new List() { "1.dll" }, null, new TestPlatformOptions(), null, mockHandler.Object);
+ _requestSender.StartTestRun(new List() { "1.dll" }, null, new TestPlatformOptions(), null, mockHandler.Object, telemetryMockHandler.Object);
mockHandler.Verify(mh => mh.HandleTestRunComplete(It.IsAny(),
It.IsAny(), null, null), Times.Once, "Run Complete must be called");
@@ -834,6 +837,7 @@ public async Task StartTestRunAsyncShouldCompleteWithZeroTests()
await InitializeCommunicationAsync();
var mockHandler = new Mock();
+ var telemetryMockHandler = new Mock();
var dummyCompleteArgs = new TestRunCompleteEventArgs(null, false, false, null, null, null, TimeSpan.FromMilliseconds(1));
var dummyLastRunArgs = new TestRunChangedEventArgs(null, null, null);
@@ -849,7 +853,7 @@ public async Task StartTestRunAsyncShouldCompleteWithZeroTests()
var runComplete = CreateMessage(MessageType.ExecutionComplete, payload);
_mockCommunicationManager.Setup(cm => cm.ReceiveMessageAsync(It.IsAny())).Returns(Task.FromResult(runComplete));
- await _requestSender.StartTestRunAsync(new List() { "1.dll" }, null, null, null, mockHandler.Object);
+ await _requestSender.StartTestRunAsync(new List() { "1.dll" }, null, null, null, mockHandler.Object, telemetryMockHandler.Object);
mockHandler.Verify(mh => mh.HandleTestRunComplete(It.IsAny(),
It.IsAny(), null, null), Times.Once, "Run Complete must be called");
@@ -863,6 +867,7 @@ public void StartTestRunShouldCompleteWithSingleTestAndMessage()
InitializeCommunication();
var mockHandler = new Mock();
+ var telemetryMockHandler = new Mock();
var testCase = new TestCase("hello", new Uri("world://how"), "1.dll");
var testResult = new TestResult(testCase);
@@ -901,7 +906,7 @@ public void StartTestRunShouldCompleteWithSingleTestAndMessage()
mockHandler.Setup(mh => mh.HandleLogMessage(It.IsAny(), It.IsAny())).Callback(
() => _mockCommunicationManager.Setup(cm => cm.ReceiveMessageAsync(It.IsAny())).Returns(Task.FromResult(runComplete)));
- _requestSender.StartTestRun(new List() { "1.dll" }, null, new TestPlatformOptions(), null, mockHandler.Object);
+ _requestSender.StartTestRun(new List() { "1.dll" }, null, new TestPlatformOptions(), null, mockHandler.Object, telemetryMockHandler.Object);
mockHandler.Verify(mh => mh.HandleTestRunComplete(It.IsAny(),
It.IsAny(), null, null), Times.Once, "Run Complete must be called");
@@ -909,6 +914,59 @@ public void StartTestRunShouldCompleteWithSingleTestAndMessage()
mockHandler.Verify(mh => mh.HandleLogMessage(It.IsAny(), It.IsAny()), Times.Once, "TestMessage event must be called");
}
+ [TestMethod]
+ public void StartTestRunShouldCompleteWithSingleTestAndTelemetryMessage()
+ {
+ InitializeCommunication();
+
+ var mockHandler = new Mock();
+ var telemetryMockHandler = new Mock();
+
+ var testCase = new TestCase("hello", new Uri("world://how"), "1.dll");
+ var testResult = new TestResult(testCase);
+ testResult.Outcome = TestOutcome.Passed;
+
+ var dummyCompleteArgs = new TestRunCompleteEventArgs(null, false, false, null, null, null, TimeSpan.FromMilliseconds(1));
+ var dummyLastRunArgs = new TestRunChangedEventArgs(null, null, null);
+
+ var testsChangedArgs = new TestRunChangedEventArgs(null,
+ new List() { testResult }, null);
+
+ var testsPayload = CreateMessage(MessageType.TestRunStatsChange, testsChangedArgs);
+
+ var payload = new TestRunCompletePayload()
+ {
+ ExecutorUris = null,
+ LastRunTests = dummyLastRunArgs,
+ RunAttachments = null,
+ TestRunCompleteArgs = dummyCompleteArgs
+ };
+
+ var runComplete = CreateMessage(MessageType.ExecutionComplete, payload);
+
+ var mpayload = new TelemetryEvent("aaa", new Dictionary());
+ var message = CreateMessage(MessageType.TelemetryEventMessage, mpayload);
+
+ _mockCommunicationManager.Setup(cm => cm.ReceiveMessageAsync(It.IsAny())).Returns(Task.FromResult(testsPayload));
+
+ mockHandler.Setup(mh => mh.HandleTestRunStatsChange(It.IsAny())).Callback(
+ (testRunChangedArgs) =>
+ {
+ Assert.IsTrue(testRunChangedArgs.NewTestResults != null && testsChangedArgs.NewTestResults!.Any(), "TestResults must be passed properly");
+ _mockCommunicationManager.Setup(cm => cm.ReceiveMessageAsync(It.IsAny())).Returns(Task.FromResult(message));
+ });
+
+ telemetryMockHandler.Setup(mh => mh.HandleTelemetryEvent(It.IsAny())).Callback(
+ () => _mockCommunicationManager.Setup(cm => cm.ReceiveMessageAsync(It.IsAny())).Returns(Task.FromResult(runComplete)));
+
+ _requestSender.StartTestRun(new List() { "1.dll" }, null, new TestPlatformOptions(), null, mockHandler.Object, telemetryMockHandler.Object);
+
+ mockHandler.Verify(mh => mh.HandleTestRunComplete(It.IsAny(),
+ It.IsAny(), null, null), Times.Once, "Run Complete must be called");
+ mockHandler.Verify(mh => mh.HandleTestRunStatsChange(It.IsAny()), Times.Once, "RunChangedArgs must be called");
+ telemetryMockHandler.Verify(mh => mh.HandleTelemetryEvent(It.IsAny()), Times.Once, "TestMessage event must be called");
+ }
+
[TestMethod]
public async Task StartTestRunAsyncShouldCompleteWithSingleTestAndMessage()
{
@@ -953,7 +1011,7 @@ public async Task StartTestRunAsyncShouldCompleteWithSingleTestAndMessage()
mockHandler.Setup(mh => mh.HandleLogMessage(It.IsAny(), It.IsAny())).Callback(
() => _mockCommunicationManager.Setup(cm => cm.ReceiveMessageAsync(It.IsAny())).Returns(Task.FromResult(runComplete)));
- await _requestSender.StartTestRunAsync(new List() { "1.dll" }, null, null, null, mockHandler.Object);
+ await _requestSender.StartTestRunAsync(new List() { "1.dll" }, null, null, null, mockHandler.Object, _telemetryHandler.Object);
mockHandler.Verify(mh => mh.HandleTestRunComplete(It.IsAny(),
It.IsAny(), null, null), Times.Once, "Run Complete must be called");
@@ -961,6 +1019,58 @@ public async Task StartTestRunAsyncShouldCompleteWithSingleTestAndMessage()
mockHandler.Verify(mh => mh.HandleLogMessage(It.IsAny(), It.IsAny()), Times.Once, "TestMessage event must be called");
}
+ [TestMethod]
+ public async Task StartTestRunAsyncShouldCompleteWithSingleTestAndTelemetryMessage()
+ {
+ await InitializeCommunicationAsync();
+
+ var mockHandler = new Mock();
+
+ var testCase = new TestCase("hello", new Uri("world://how"), "1.dll");
+ var testResult = new TestResult(testCase);
+ testResult.Outcome = TestOutcome.Passed;
+
+ var dummyCompleteArgs = new TestRunCompleteEventArgs(null, false, false, null, null, null, TimeSpan.FromMilliseconds(1));
+ var dummyLastRunArgs = new TestRunChangedEventArgs(null, null, null);
+
+ var testsChangedArgs = new TestRunChangedEventArgs(null,
+ new List() { testResult }, null);
+
+ var testsPayload = CreateMessage(MessageType.TestRunStatsChange, testsChangedArgs);
+
+ var payload = new TestRunCompletePayload()
+ {
+ ExecutorUris = null,
+ LastRunTests = dummyLastRunArgs,
+ RunAttachments = null,
+ TestRunCompleteArgs = dummyCompleteArgs
+ };
+
+ var runComplete = CreateMessage(MessageType.ExecutionComplete, payload);
+
+ var mpayload = new TelemetryEvent("aaa", new Dictionary());
+ var message = CreateMessage(MessageType.TelemetryEventMessage, mpayload);
+
+ _mockCommunicationManager.Setup(cm => cm.ReceiveMessageAsync(It.IsAny())).Returns(Task.FromResult(testsPayload));
+
+ mockHandler.Setup(mh => mh.HandleTestRunStatsChange(It.IsAny())).Callback(
+ (testRunChangedArgs) =>
+ {
+ Assert.IsTrue(testRunChangedArgs.NewTestResults != null && testsChangedArgs.NewTestResults!.Any(), "TestResults must be passed properly");
+ _mockCommunicationManager.Setup(cm => cm.ReceiveMessageAsync(It.IsAny())).Returns(Task.FromResult(message));
+ });
+
+ _telemetryHandler.Setup(mh => mh.HandleTelemetryEvent(It.IsAny())).Callback(
+ () => _mockCommunicationManager.Setup(cm => cm.ReceiveMessageAsync(It.IsAny())).Returns(Task.FromResult(runComplete)));
+
+ await _requestSender.StartTestRunAsync(new List