From bdb370132e79d55a53fd0a37c02dd09c0fd4ab79 Mon Sep 17 00:00:00 2001 From: Vagisha Nidhi Date: Wed, 11 Sep 2019 18:15:54 +0530 Subject: [PATCH 1/3] Adding Translation layer logs --- .../VsTestConsoleRequestSender.cs | 34 +++++++++++++++++++ .../VsTestConsoleWrapper.cs | 7 +++- .../VsTestConsoleWrapperAsync.cs | 2 ++ 3 files changed, 42 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleRequestSender.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleRequestSender.cs index 1f4222fea3..5f138af261 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleRequestSender.cs +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleRequestSender.cs @@ -68,6 +68,8 @@ internal VsTestConsoleRequestSender(ICommunicationManager communicationManager, /// Port Number of hosted server on this side public int InitializeCommunication() { + EqtTrace.Info("VsTestConsoleRequestSender.InitializeCommunication: Initializing Communication with vstest.console.exe."); + this.processExitCancellationTokenSource = new CancellationTokenSource(); this.handShakeSuccessful = false; this.handShakeComplete.Reset(); @@ -107,6 +109,8 @@ public bool WaitForRequestHandlerConnection(int clientConnectionTimeout) /// public async Task InitializeCommunicationAsync(int clientConnectionTimeout) { + EqtTrace.Info("VsTestConsoleRequestSender.InitializeCommunicationAsync: Initializing Communication with vstest.console.exe."); + this.processExitCancellationTokenSource = new CancellationTokenSource(); this.handShakeSuccessful = false; this.handShakeComplete.Reset(); @@ -132,12 +136,14 @@ public async Task InitializeCommunicationAsync(int clientConnectionTimeout) /// public void InitializeExtensions(IEnumerable pathToAdditionalExtensions) { + EqtTrace.Info("VsTestConsoleRequestSender.InitializeExtensions: Initializing extensions."); this.communicationManager.SendMessage(MessageType.ExtensionsInitialize, pathToAdditionalExtensions, this.protocolVersion); } /// public void DiscoverTests(IEnumerable sources, string runSettings, TestPlatformOptions options, ITestDiscoveryEventsHandler2 eventHandler) { + EqtTrace.Info("VsTestConsoleRequestSender.DiscoverTests: Starting test discovery."); this.SendMessageAndListenAndReportTestCases(sources, runSettings, options, eventHandler); } @@ -146,12 +152,15 @@ public void DiscoverTests(IEnumerable sources, string runSettings, TestP /// public async Task DiscoverTestsAsync(IEnumerable sources, string runSettings, TestPlatformOptions options, ITestDiscoveryEventsHandler2 eventHandler) { + EqtTrace.Info("VsTestConsoleRequestSender.DiscoverTestsAsync: Starting test discovery."); await this.SendMessageAndListenAndReportTestCasesAsync(sources, runSettings, options, eventHandler); } /// public void StartTestRun(IEnumerable sources, string runSettings, TestPlatformOptions options, ITestRunEventsHandler runEventsHandler) { + EqtTrace.Info("VsTestConsoleRequestSender.StartTestRun: Starting test run."); + this.SendMessageAndListenAndReportTestResults( MessageType.TestRunAllSourcesWithDefaultHost, new TestRunRequestPayload() { Sources = sources.ToList(), RunSettings = runSettings, TestPlatformOptions = options }, @@ -162,6 +171,8 @@ public void StartTestRun(IEnumerable sources, string runSettings, TestPl /// public async Task StartTestRunAsync(IEnumerable sources, string runSettings, TestPlatformOptions options, ITestRunEventsHandler runEventsHandler) { + EqtTrace.Info("VsTestConsoleRequestSender.StartTestRunAsync: Starting test run."); + await this.SendMessageAndListenAndReportTestResultsAsync( MessageType.TestRunAllSourcesWithDefaultHost, new TestRunRequestPayload() { Sources = sources.ToList(), RunSettings = runSettings, TestPlatformOptions = options }, @@ -172,6 +183,8 @@ await this.SendMessageAndListenAndReportTestResultsAsync( /// public void StartTestRun(IEnumerable testCases, string runSettings, TestPlatformOptions options, ITestRunEventsHandler runEventsHandler) { + EqtTrace.Info("VsTestConsoleRequestSender.StartTestRun: Starting test run."); + this.SendMessageAndListenAndReportTestResults( MessageType.TestRunAllSourcesWithDefaultHost, new TestRunRequestPayload() { TestCases = testCases.ToList(), RunSettings = runSettings, TestPlatformOptions = options }, @@ -182,6 +195,8 @@ public void StartTestRun(IEnumerable testCases, string runSettings, Te /// public async Task StartTestRunAsync(IEnumerable testCases, string runSettings, TestPlatformOptions options, ITestRunEventsHandler runEventsHandler) { + EqtTrace.Info("VsTestConsoleRequestSender.StartTestRunAsync: Starting test run."); + await this.SendMessageAndListenAndReportTestResultsAsync( MessageType.TestRunAllSourcesWithDefaultHost, new TestRunRequestPayload() { TestCases = testCases.ToList(), RunSettings = runSettings, TestPlatformOptions = options }, @@ -197,6 +212,8 @@ public void StartTestRunWithCustomHost( ITestRunEventsHandler runEventsHandler, ITestHostLauncher customHostLauncher) { + EqtTrace.Info("VsTestConsoleRequestSender.StartTestRunWithCustomHost: Starting test run."); + this.SendMessageAndListenAndReportTestResults( MessageType.GetTestRunnerProcessStartInfoForRunAll, new TestRunRequestPayload() @@ -218,6 +235,8 @@ public async Task StartTestRunWithCustomHostAsync( ITestRunEventsHandler runEventsHandler, ITestHostLauncher customHostLauncher) { + EqtTrace.Info("VsTestConsoleRequestSender.StartTestRunWithCustomHostAsync: Starting test run."); + await this.SendMessageAndListenAndReportTestResultsAsync( MessageType.GetTestRunnerProcessStartInfoForRunAll, new TestRunRequestPayload() @@ -234,6 +253,8 @@ await this.SendMessageAndListenAndReportTestResultsAsync( /// public void StartTestRunWithCustomHost(IEnumerable testCases, string runSettings, TestPlatformOptions options, ITestRunEventsHandler runEventsHandler, ITestHostLauncher customHostLauncher) { + EqtTrace.Info("VsTestConsoleRequestSender.StartTestRunWithCustomHost: Starting test run."); + this.SendMessageAndListenAndReportTestResults( MessageType.GetTestRunnerProcessStartInfoForRunSelected, new TestRunRequestPayload @@ -250,6 +271,8 @@ public void StartTestRunWithCustomHost(IEnumerable testCases, string r /// public async Task StartTestRunWithCustomHostAsync(IEnumerable testCases, string runSettings, TestPlatformOptions options, ITestRunEventsHandler runEventsHandler, ITestHostLauncher customHostLauncher) { + EqtTrace.Info("VsTestConsoleRequestSender.StartTestRunWithCustomHostAsync: Starting test run."); + await this.SendMessageAndListenAndReportTestResultsAsync( MessageType.GetTestRunnerProcessStartInfoForRunSelected, new TestRunRequestPayload() @@ -266,18 +289,21 @@ await this.SendMessageAndListenAndReportTestResultsAsync( /// public void CancelTestRun() { + EqtTrace.Info("VsTestConsoleRequestSender.CancelTestRun: Cancelling test run."); this.communicationManager.SendMessage(MessageType.CancelTestRun); } /// public void AbortTestRun() { + EqtTrace.Info("VsTestConsoleRequestSender.AbortTestRun: Aborting test run."); this.communicationManager.SendMessage(MessageType.AbortTestRun); } /// public void CancelDiscovery() { + EqtTrace.Info("VsTestConsoleRequestSender.CancelDiscovery: Cancelling test discovery."); this.communicationManager.SendMessage(MessageType.CancelDiscovery); } @@ -400,6 +426,8 @@ private void SendMessageAndListenAndReportTestCases(IEnumerable sources, } else if (string.Equals(MessageType.DiscoveryComplete, message.MessageType)) { + EqtTrace.Info("VsTestConsoleRequestSender.SendMessageAndListenAndReportTestCases: Discovery complete."); + var discoveryCompletePayload = this.dataSerializer.DeserializePayload(message); @@ -461,6 +489,8 @@ private async Task SendMessageAndListenAndReportTestCasesAsync(IEnumerable(message); @@ -520,6 +550,8 @@ private void SendMessageAndListenAndReportTestResults(string messageType, object } else if (string.Equals(MessageType.ExecutionComplete, message.MessageType)) { + EqtTrace.Info("VsTestConsoleRequestSender.SendMessageAndListenAndReportTestResults: Execution complete."); + var testRunCompletePayload = this.dataSerializer.DeserializePayload(message); @@ -578,6 +610,8 @@ private async Task SendMessageAndListenAndReportTestResultsAsync(string messageT } else if (string.Equals(MessageType.ExecutionComplete, message.MessageType)) { + EqtTrace.Info("VsTestConsoleRequestSender.SendMessageAndListenAndReportTestResultsAsync: Execution complete."); + var testRunCompletePayload = this.dataSerializer.DeserializePayload(message); diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleWrapper.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleWrapper.cs index e947ea8617..2ed6ad41d0 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleWrapper.cs +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleWrapper.cs @@ -114,6 +114,8 @@ internal VsTestConsoleWrapper(ITranslationLayerRequestSender requestSender, IPro /// public void StartSession() { + EqtTrace.Info("VsTestConsoleWrapper.StartSession: Starting VsTestConsoleWrapper session."); + this.testPlatformEventSource.TranslationLayerInitializeStart(); // Start communication @@ -138,8 +140,9 @@ public void StartSession() /// public void InitializeExtensions(IEnumerable pathToAdditionalExtensions) - { + { this.EnsureInitialized(); + this.pathToAdditionalExtensions = pathToAdditionalExtensions.ToList(); this.requestSender.InitializeExtensions(this.pathToAdditionalExtensions); } @@ -256,6 +259,8 @@ public void AbortTestRun() /// public void EndSession() { + EqtTrace.Info("VsTestConsoleWrapper.EndSession: Endinhg VsTestConsoleWrapper session"); + this.requestSender.EndSession(); this.requestSender.Close(); diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleWrapperAsync.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleWrapperAsync.cs index 67f6a8471e..ca0a357c75 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleWrapperAsync.cs +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleWrapperAsync.cs @@ -90,6 +90,8 @@ internal VsTestConsoleWrapperAsync(ITranslationLayerRequestSenderAsync requestSe /// public async Task StartSessionAsync() { + EqtTrace.Info("VsTestConsoleWrapperAsync.StartSessionAsync: Starting VsTestConsoleWrapper session"); + this.testPlatformEventSource.TranslationLayerInitializeStart(); var timeout = EnvironmentHelper.GetConnectionTimeout(); From 35d2e8bfa611bcd5a7f1c14bbd5dbbdef5560031 Mon Sep 17 00:00:00 2001 From: Vagisha Nidhi Date: Wed, 11 Sep 2019 18:49:38 +0530 Subject: [PATCH 2/3] Review comments addressed --- .../VsTestConsoleRequestSender.cs | 12 ++++++++---- .../VsTestConsoleWrapper.cs | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleRequestSender.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleRequestSender.cs index 5f138af261..c4f943d4d9 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleRequestSender.cs +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleRequestSender.cs @@ -68,7 +68,7 @@ internal VsTestConsoleRequestSender(ICommunicationManager communicationManager, /// Port Number of hosted server on this side public int InitializeCommunication() { - EqtTrace.Info("VsTestConsoleRequestSender.InitializeCommunication: Initializing Communication with vstest.console.exe."); + EqtTrace.Info("VsTestConsoleRequestSender.InitializeCommunication: Started."); this.processExitCancellationTokenSource = new CancellationTokenSource(); this.handShakeSuccessful = false; @@ -92,6 +92,8 @@ public int InitializeCommunication() this.handShakeComplete.Set(); } + EqtTrace.Info("VsTestConsoleRequestSender.InitializeCommunication: Ended."); + return port; } @@ -109,7 +111,7 @@ public bool WaitForRequestHandlerConnection(int clientConnectionTimeout) /// public async Task InitializeCommunicationAsync(int clientConnectionTimeout) { - EqtTrace.Info("VsTestConsoleRequestSender.InitializeCommunicationAsync: Initializing Communication with vstest.console.exe."); + EqtTrace.Info($"VsTestConsoleRequestSender.InitializeCommunicationAsync: Started with client connection timeout {clientConnectionTimeout} milliseconds."); this.processExitCancellationTokenSource = new CancellationTokenSource(); this.handShakeSuccessful = false; @@ -130,13 +132,15 @@ public async Task InitializeCommunicationAsync(int clientConnectionTimeout) this.handShakeComplete.Set(); } + EqtTrace.Info("VsTestConsoleRequestSender.InitializeCommunicationAsync: Ended."); + return this.handShakeSuccessful ? port : -1; } /// public void InitializeExtensions(IEnumerable pathToAdditionalExtensions) { - EqtTrace.Info("VsTestConsoleRequestSender.InitializeExtensions: Initializing extensions."); + EqtTrace.Info($"VsTestConsoleRequestSender.InitializeExtensions: Initializing extensions with additional extensions path {string.Join(",", pathToAdditionalExtensions.ToArray())}."); this.communicationManager.SendMessage(MessageType.ExtensionsInitialize, pathToAdditionalExtensions, this.protocolVersion); } @@ -354,7 +358,7 @@ private bool HandShakeWithVsTestConsole() else if (message.MessageType == MessageType.ProtocolError) { // TODO : Payload for ProtocolError needs to finalized. - EqtTrace.Error("VsTestConsoleRequestSender.HandShakeWithVsTestConsole: Version Check failed. ProtolError was revceived from the runner"); + EqtTrace.Error("VsTestConsoleRequestSender.HandShakeWithVsTestConsole: Version Check failed. ProtolError was received from the runner"); } else { diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleWrapper.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleWrapper.cs index 2ed6ad41d0..52e8457d5e 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleWrapper.cs +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleWrapper.cs @@ -140,7 +140,7 @@ public void StartSession() /// public void InitializeExtensions(IEnumerable pathToAdditionalExtensions) - { + { this.EnsureInitialized(); this.pathToAdditionalExtensions = pathToAdditionalExtensions.ToList(); From fe5d461fec391854628fe39f966a86d869282365 Mon Sep 17 00:00:00 2001 From: Vagisha Nidhi Date: Thu, 12 Sep 2019 11:29:43 +0530 Subject: [PATCH 3/3] Added eqttrace.isinfo enabled --- .../VsTestConsoleRequestSender.cs | 112 ++++++++++++++---- .../VsTestConsoleWrapper.cs | 5 +- 2 files changed, 92 insertions(+), 25 deletions(-) diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleRequestSender.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleRequestSender.cs index c4f943d4d9..9067b03042 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleRequestSender.cs +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleRequestSender.cs @@ -68,7 +68,10 @@ internal VsTestConsoleRequestSender(ICommunicationManager communicationManager, /// Port Number of hosted server on this side public int InitializeCommunication() { - EqtTrace.Info("VsTestConsoleRequestSender.InitializeCommunication: Started."); + if (EqtTrace.IsInfoEnabled) + { + EqtTrace.Info("VsTestConsoleRequestSender.InitializeCommunication: Started."); + } this.processExitCancellationTokenSource = new CancellationTokenSource(); this.handShakeSuccessful = false; @@ -92,7 +95,10 @@ public int InitializeCommunication() this.handShakeComplete.Set(); } - EqtTrace.Info("VsTestConsoleRequestSender.InitializeCommunication: Ended."); + if (EqtTrace.IsInfoEnabled) + { + EqtTrace.Info("VsTestConsoleRequestSender.InitializeCommunication: Ended."); + } return port; } @@ -111,7 +117,10 @@ public bool WaitForRequestHandlerConnection(int clientConnectionTimeout) /// public async Task InitializeCommunicationAsync(int clientConnectionTimeout) { - EqtTrace.Info($"VsTestConsoleRequestSender.InitializeCommunicationAsync: Started with client connection timeout {clientConnectionTimeout} milliseconds."); + if (EqtTrace.IsInfoEnabled) + { + EqtTrace.Info($"VsTestConsoleRequestSender.InitializeCommunicationAsync: Started with client connection timeout {clientConnectionTimeout} milliseconds."); + } this.processExitCancellationTokenSource = new CancellationTokenSource(); this.handShakeSuccessful = false; @@ -132,7 +141,10 @@ public async Task InitializeCommunicationAsync(int clientConnectionTimeout) this.handShakeComplete.Set(); } - EqtTrace.Info("VsTestConsoleRequestSender.InitializeCommunicationAsync: Ended."); + if (EqtTrace.IsInfoEnabled) + { + EqtTrace.Info("VsTestConsoleRequestSender.InitializeCommunicationAsync: Ended."); + } return this.handShakeSuccessful ? port : -1; } @@ -140,14 +152,20 @@ public async Task InitializeCommunicationAsync(int clientConnectionTimeout) /// public void InitializeExtensions(IEnumerable pathToAdditionalExtensions) { - EqtTrace.Info($"VsTestConsoleRequestSender.InitializeExtensions: Initializing extensions with additional extensions path {string.Join(",", pathToAdditionalExtensions.ToArray())}."); + if (EqtTrace.IsInfoEnabled) + { + EqtTrace.Info($"VsTestConsoleRequestSender.InitializeExtensions: Initializing extensions with additional extensions path {string.Join(",", pathToAdditionalExtensions.ToList())}."); + } this.communicationManager.SendMessage(MessageType.ExtensionsInitialize, pathToAdditionalExtensions, this.protocolVersion); } /// public void DiscoverTests(IEnumerable sources, string runSettings, TestPlatformOptions options, ITestDiscoveryEventsHandler2 eventHandler) { - EqtTrace.Info("VsTestConsoleRequestSender.DiscoverTests: Starting test discovery."); + if (EqtTrace.IsInfoEnabled) + { + EqtTrace.Info("VsTestConsoleRequestSender.DiscoverTests: Starting test discovery."); + } this.SendMessageAndListenAndReportTestCases(sources, runSettings, options, eventHandler); } @@ -156,14 +174,20 @@ public void DiscoverTests(IEnumerable sources, string runSettings, TestP /// public async Task DiscoverTestsAsync(IEnumerable sources, string runSettings, TestPlatformOptions options, ITestDiscoveryEventsHandler2 eventHandler) { - EqtTrace.Info("VsTestConsoleRequestSender.DiscoverTestsAsync: Starting test discovery."); + if (EqtTrace.IsInfoEnabled) + { + EqtTrace.Info("VsTestConsoleRequestSender.DiscoverTestsAsync: Starting test discovery."); + } await this.SendMessageAndListenAndReportTestCasesAsync(sources, runSettings, options, eventHandler); } /// public void StartTestRun(IEnumerable sources, string runSettings, TestPlatformOptions options, ITestRunEventsHandler runEventsHandler) { - EqtTrace.Info("VsTestConsoleRequestSender.StartTestRun: Starting test run."); + if (EqtTrace.IsInfoEnabled) + { + EqtTrace.Info("VsTestConsoleRequestSender.StartTestRun: Starting test run."); + } this.SendMessageAndListenAndReportTestResults( MessageType.TestRunAllSourcesWithDefaultHost, @@ -175,8 +199,10 @@ public void StartTestRun(IEnumerable sources, string runSettings, TestPl /// public async Task StartTestRunAsync(IEnumerable sources, string runSettings, TestPlatformOptions options, ITestRunEventsHandler runEventsHandler) { - EqtTrace.Info("VsTestConsoleRequestSender.StartTestRunAsync: Starting test run."); - + if (EqtTrace.IsInfoEnabled) + { + EqtTrace.Info("VsTestConsoleRequestSender.StartTestRunAsync: Starting test run."); + } await this.SendMessageAndListenAndReportTestResultsAsync( MessageType.TestRunAllSourcesWithDefaultHost, new TestRunRequestPayload() { Sources = sources.ToList(), RunSettings = runSettings, TestPlatformOptions = options }, @@ -187,8 +213,10 @@ await this.SendMessageAndListenAndReportTestResultsAsync( /// public void StartTestRun(IEnumerable testCases, string runSettings, TestPlatformOptions options, ITestRunEventsHandler runEventsHandler) { - EqtTrace.Info("VsTestConsoleRequestSender.StartTestRun: Starting test run."); - + if (EqtTrace.IsInfoEnabled) + { + EqtTrace.Info("VsTestConsoleRequestSender.StartTestRun: Starting test run."); + } this.SendMessageAndListenAndReportTestResults( MessageType.TestRunAllSourcesWithDefaultHost, new TestRunRequestPayload() { TestCases = testCases.ToList(), RunSettings = runSettings, TestPlatformOptions = options }, @@ -199,7 +227,10 @@ public void StartTestRun(IEnumerable testCases, string runSettings, Te /// public async Task StartTestRunAsync(IEnumerable testCases, string runSettings, TestPlatformOptions options, ITestRunEventsHandler runEventsHandler) { - EqtTrace.Info("VsTestConsoleRequestSender.StartTestRunAsync: Starting test run."); + if (EqtTrace.IsInfoEnabled) + { + EqtTrace.Info("VsTestConsoleRequestSender.StartTestRunAsync: Starting test run."); + } await this.SendMessageAndListenAndReportTestResultsAsync( MessageType.TestRunAllSourcesWithDefaultHost, @@ -216,7 +247,10 @@ public void StartTestRunWithCustomHost( ITestRunEventsHandler runEventsHandler, ITestHostLauncher customHostLauncher) { - EqtTrace.Info("VsTestConsoleRequestSender.StartTestRunWithCustomHost: Starting test run."); + if (EqtTrace.IsInfoEnabled) + { + EqtTrace.Info("VsTestConsoleRequestSender.StartTestRunWithCustomHost: Starting test run."); + } this.SendMessageAndListenAndReportTestResults( MessageType.GetTestRunnerProcessStartInfoForRunAll, @@ -239,7 +273,10 @@ public async Task StartTestRunWithCustomHostAsync( ITestRunEventsHandler runEventsHandler, ITestHostLauncher customHostLauncher) { - EqtTrace.Info("VsTestConsoleRequestSender.StartTestRunWithCustomHostAsync: Starting test run."); + if (EqtTrace.IsInfoEnabled) + { + EqtTrace.Info("VsTestConsoleRequestSender.StartTestRunWithCustomHostAsync: Starting test run."); + } await this.SendMessageAndListenAndReportTestResultsAsync( MessageType.GetTestRunnerProcessStartInfoForRunAll, @@ -257,7 +294,10 @@ await this.SendMessageAndListenAndReportTestResultsAsync( /// public void StartTestRunWithCustomHost(IEnumerable testCases, string runSettings, TestPlatformOptions options, ITestRunEventsHandler runEventsHandler, ITestHostLauncher customHostLauncher) { - EqtTrace.Info("VsTestConsoleRequestSender.StartTestRunWithCustomHost: Starting test run."); + if (EqtTrace.IsInfoEnabled) + { + EqtTrace.Info("VsTestConsoleRequestSender.StartTestRunWithCustomHost: Starting test run."); + } this.SendMessageAndListenAndReportTestResults( MessageType.GetTestRunnerProcessStartInfoForRunSelected, @@ -275,7 +315,10 @@ public void StartTestRunWithCustomHost(IEnumerable testCases, string r /// public async Task StartTestRunWithCustomHostAsync(IEnumerable testCases, string runSettings, TestPlatformOptions options, ITestRunEventsHandler runEventsHandler, ITestHostLauncher customHostLauncher) { - EqtTrace.Info("VsTestConsoleRequestSender.StartTestRunWithCustomHostAsync: Starting test run."); + if (EqtTrace.IsInfoEnabled) + { + EqtTrace.Info("VsTestConsoleRequestSender.StartTestRunWithCustomHostAsync: Starting test run."); + } await this.SendMessageAndListenAndReportTestResultsAsync( MessageType.GetTestRunnerProcessStartInfoForRunSelected, @@ -293,21 +336,30 @@ await this.SendMessageAndListenAndReportTestResultsAsync( /// public void CancelTestRun() { - EqtTrace.Info("VsTestConsoleRequestSender.CancelTestRun: Cancelling test run."); + if (EqtTrace.IsInfoEnabled) + { + EqtTrace.Info("VsTestConsoleRequestSender.CancelTestRun: Cancelling test run."); + } this.communicationManager.SendMessage(MessageType.CancelTestRun); } /// public void AbortTestRun() { - EqtTrace.Info("VsTestConsoleRequestSender.AbortTestRun: Aborting test run."); + if (EqtTrace.IsInfoEnabled) + { + EqtTrace.Info("VsTestConsoleRequestSender.AbortTestRun: Aborting test run."); + } this.communicationManager.SendMessage(MessageType.AbortTestRun); } /// public void CancelDiscovery() { - EqtTrace.Info("VsTestConsoleRequestSender.CancelDiscovery: Cancelling test discovery."); + if (EqtTrace.IsInfoEnabled) + { + EqtTrace.Info("VsTestConsoleRequestSender.CancelDiscovery: Cancelling test discovery."); + } this.communicationManager.SendMessage(MessageType.CancelDiscovery); } @@ -430,7 +482,10 @@ private void SendMessageAndListenAndReportTestCases(IEnumerable sources, } else if (string.Equals(MessageType.DiscoveryComplete, message.MessageType)) { - EqtTrace.Info("VsTestConsoleRequestSender.SendMessageAndListenAndReportTestCases: Discovery complete."); + if (EqtTrace.IsInfoEnabled) + { + EqtTrace.Info("VsTestConsoleRequestSender.SendMessageAndListenAndReportTestCases: Discovery complete."); + } var discoveryCompletePayload = this.dataSerializer.DeserializePayload(message); @@ -493,7 +548,10 @@ private async Task SendMessageAndListenAndReportTestCasesAsync(IEnumerable(message); @@ -554,7 +612,10 @@ private void SendMessageAndListenAndReportTestResults(string messageType, object } else if (string.Equals(MessageType.ExecutionComplete, message.MessageType)) { - EqtTrace.Info("VsTestConsoleRequestSender.SendMessageAndListenAndReportTestResults: Execution complete."); + if (EqtTrace.IsInfoEnabled) + { + EqtTrace.Info("VsTestConsoleRequestSender.SendMessageAndListenAndReportTestResults: Execution complete."); + } var testRunCompletePayload = this.dataSerializer.DeserializePayload(message); @@ -614,7 +675,10 @@ private async Task SendMessageAndListenAndReportTestResultsAsync(string messageT } else if (string.Equals(MessageType.ExecutionComplete, message.MessageType)) { - EqtTrace.Info("VsTestConsoleRequestSender.SendMessageAndListenAndReportTestResultsAsync: Execution complete."); + if (EqtTrace.IsInfoEnabled) + { + EqtTrace.Info("VsTestConsoleRequestSender.SendMessageAndListenAndReportTestResultsAsync: Execution complete."); + } var testRunCompletePayload = this.dataSerializer.DeserializePayload(message); diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleWrapper.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleWrapper.cs index 52e8457d5e..d22e5eb3a9 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleWrapper.cs +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleWrapper.cs @@ -114,7 +114,10 @@ internal VsTestConsoleWrapper(ITranslationLayerRequestSender requestSender, IPro /// public void StartSession() { - EqtTrace.Info("VsTestConsoleWrapper.StartSession: Starting VsTestConsoleWrapper session."); + if (EqtTrace.IsInfoEnabled) + { + EqtTrace.Info("VsTestConsoleWrapper.StartSession: Starting VsTestConsoleWrapper session."); + } this.testPlatformEventSource.TranslationLayerInitializeStart();