From cad90d0bf33190371a0403b13dffe3993e48a877 Mon Sep 17 00:00:00 2001 From: Codrin Poienaru Date: Mon, 11 Jan 2021 18:27:16 +0100 Subject: [PATCH 01/26] Groundwork for testhost sharing --- .../Client/ProxyExecutionManager.cs | 14 +++++----- .../TestSession/ProxyTestSessionManager.cs | 27 ++++++++++-------- .../Payloads/DiscoveryRequestPayload.cs | 6 ++++ .../ITranslationLayerRequestSender.cs | 2 ++ .../ITranslationLayerRequestSenderAsync.cs | 1 + .../VsTestConsoleRequestSender.cs | 12 ++++++-- .../VsTestConsoleWrapper.cs | 4 +-- .../VsTestConsoleRequestSenderTests.cs | 28 +++++++++---------- .../VsTestConsoleWrapperAsyncTests.cs | 10 +++---- .../VsTestConsoleWrapperTests.cs | 8 +++--- 10 files changed, 67 insertions(+), 45 deletions(-) diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyExecutionManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyExecutionManager.cs index b16d5ef3e9..cc944f6bef 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyExecutionManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyExecutionManager.cs @@ -284,7 +284,13 @@ public void Abort(ITestRunEventsHandler eventHandler) /// public void Close() { - this.ProxyOperationManager.Close(); + if (this.testSessionInfo == null) + { + this.ProxyOperationManager.Close(); + return; + } + + TestSessionPool.Instance.ReturnProxy(this.testSessionInfo, this.ProxyOperationManager.Id); } /// @@ -302,12 +308,6 @@ public bool AttachDebuggerToProcess(int pid) /// public void HandleTestRunComplete(TestRunCompleteEventArgs testRunCompleteArgs, TestRunChangedEventArgs lastChunkArgs, ICollection runContextAttachments, ICollection executorUris) { - if (this.testSessionInfo != null) - { - // TODO (copoiena): Is returning the proxy to the pool here enough ? - TestSessionPool.Instance.ReturnProxy(this.testSessionInfo, this.ProxyOperationManager.Id); - } - this.baseTestRunEventsHandler.HandleTestRunComplete(testRunCompleteArgs, lastChunkArgs, runContextAttachments, executorUris); } diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/TestSession/ProxyTestSessionManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/TestSession/ProxyTestSessionManager.cs index 1d072944fc..6f4c3648c8 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/TestSession/ProxyTestSessionManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/TestSession/ProxyTestSessionManager.cs @@ -53,7 +53,7 @@ public void StartSession( ITestSessionEventsHandler eventsHandler) { var testSessionInfo = new TestSessionInfo(); - Task[] taskList = new Task[this.parallelLevel]; + var taskList = new Task[this.parallelLevel]; // Create all the proxies in parallel, one task per proxy. for (int i = 0; i < this.parallelLevel; ++i) @@ -87,16 +87,21 @@ public void StartSession( /// public void StopSession() { - // TODO (copoiena): Do nothing for now because in the current implementation the - // testhosts are disposed of right after the test run is done. However, when we'll - // decide to re-use the testhosts for discovery & execution we'll perform some - // changes for keeping them alive indefinetely, so the responsability for killing - // testhosts will be with the users of the vstest.console wrapper. Then we'll need - // to be able to dispose of the testhosts here. - - // foreach (var kvp in this.proxyMap) - // { - // } + int index = 0; + var taskList = new Task[this.proxyMap.Count]; + + // Dispose of all the proxies in parallel, one task per proxy. + foreach (var kvp in this.proxyMap) + { + taskList[index++] = Task.Factory.StartNew(() => + { + // Initiate the end session handshake with the underlying testhost. + kvp.Value.Proxy.Close(); + }); + } + + // Wait for proxy disposal to be over. + Task.WaitAll(taskList); } /// diff --git a/src/Microsoft.TestPlatform.ObjectModel/Client/Payloads/DiscoveryRequestPayload.cs b/src/Microsoft.TestPlatform.ObjectModel/Client/Payloads/DiscoveryRequestPayload.cs index 70f6a8a94a..d0057377ba 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Client/Payloads/DiscoveryRequestPayload.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/Client/Payloads/DiscoveryRequestPayload.cs @@ -32,5 +32,11 @@ public TestPlatformOptions TestPlatformOptions get; set; } + + /// + /// Gets or sets the test session info. + /// + [DataMember] + public TestSessionInfo TestSessionInfo { get; set; } } } diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITranslationLayerRequestSender.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITranslationLayerRequestSender.cs index 6d016e2b18..d4b19d826a 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITranslationLayerRequestSender.cs +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITranslationLayerRequestSender.cs @@ -50,11 +50,13 @@ internal interface ITranslationLayerRequestSender : IDisposable, ITranslationLay /// Sources for discovering tests. /// Run settings for discovering tests. /// Options to be passed into the platform. + /// Test session info. /// Event handler for discovery events. void DiscoverTests( IEnumerable sources, string runSettings, TestPlatformOptions options, + TestSessionInfo testSessionInfo, ITestDiscoveryEventsHandler2 discoveryEventsHandler); /// diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITranslationLayerRequestSenderAsync.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITranslationLayerRequestSenderAsync.cs index 563eaea1b6..aa07882a6b 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITranslationLayerRequestSenderAsync.cs +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITranslationLayerRequestSenderAsync.cs @@ -33,6 +33,7 @@ Task DiscoverTestsAsync( IEnumerable sources, string runSettings, TestPlatformOptions options, + TestSessionInfo testSessionInfo, ITestDiscoveryEventsHandler2 discoveryEventsHandler); /// diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleRequestSender.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleRequestSender.cs index 35c7630730..514ae54a9e 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleRequestSender.cs +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleRequestSender.cs @@ -188,6 +188,7 @@ public void DiscoverTests( IEnumerable sources, string runSettings, TestPlatformOptions options, + TestSessionInfo testSessionInfo, ITestDiscoveryEventsHandler2 eventHandler) { if (EqtTrace.IsInfoEnabled) @@ -199,6 +200,7 @@ public void DiscoverTests( sources, runSettings, options, + testSessionInfo, eventHandler); } @@ -207,6 +209,7 @@ public async Task DiscoverTestsAsync( IEnumerable sources, string runSettings, TestPlatformOptions options, + TestSessionInfo testSessionInfo, ITestDiscoveryEventsHandler2 eventHandler) { if (EqtTrace.IsInfoEnabled) @@ -218,6 +221,7 @@ await this.SendMessageAndListenAndReportTestCasesAsync( sources, runSettings, options, + testSessionInfo, eventHandler); } @@ -963,6 +967,7 @@ private void SendMessageAndListenAndReportTestCases( IEnumerable sources, string runSettings, TestPlatformOptions options, + TestSessionInfo testSessionInfo, ITestDiscoveryEventsHandler2 eventHandler) { try @@ -973,7 +978,8 @@ private void SendMessageAndListenAndReportTestCases( { Sources = sources, RunSettings = runSettings, - TestPlatformOptions = options + TestPlatformOptions = options, + TestSessionInfo = testSessionInfo }, this.protocolVersion); var isDiscoveryComplete = false; @@ -1052,6 +1058,7 @@ private async Task SendMessageAndListenAndReportTestCasesAsync( IEnumerable sources, string runSettings, TestPlatformOptions options, + TestSessionInfo testSessionInfo, ITestDiscoveryEventsHandler2 eventHandler) { try @@ -1062,7 +1069,8 @@ private async Task SendMessageAndListenAndReportTestCasesAsync( { Sources = sources, RunSettings = runSettings, - TestPlatformOptions = options + TestPlatformOptions = options, + TestSessionInfo = testSessionInfo }, this.protocolVersion); var isDiscoveryComplete = false; diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleWrapper.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleWrapper.cs index 78adc5bb0c..57538ec41e 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleWrapper.cs +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleWrapper.cs @@ -220,11 +220,11 @@ public void DiscoverTests( { this.testPlatformEventSource.TranslationLayerDiscoveryStart(); this.EnsureInitialized(); - // TODO (copoiena): Add session info as a parameter. this.requestSender.DiscoverTests( sources, discoverySettings, options, + testSessionInfo, discoveryEventsHandler); } @@ -625,7 +625,7 @@ await this.requestSender.DiscoverTestsAsync( sources, discoverySettings, options, - // TODO(copoiena): Add session info as a parameter. + testSessionInfo, discoveryEventsHandler); } diff --git a/test/TranslationLayer.UnitTests/VsTestConsoleRequestSenderTests.cs b/test/TranslationLayer.UnitTests/VsTestConsoleRequestSenderTests.cs index 828cd0f22c..1b484eb95a 100644 --- a/test/TranslationLayer.UnitTests/VsTestConsoleRequestSenderTests.cs +++ b/test/TranslationLayer.UnitTests/VsTestConsoleRequestSenderTests.cs @@ -333,7 +333,7 @@ public void DiscoverTestsShouldCompleteWithZeroTests() }; this.mockCommunicationManager.Setup(cm => cm.ReceiveMessageAsync(It.IsAny())).Returns(Task.FromResult(discoveryComplete)); - this.requestSender.DiscoverTests(new List() { "1.dll" }, null, new TestPlatformOptions(), mockHandler.Object); + this.requestSender.DiscoverTests(new List() { "1.dll" }, null, new TestPlatformOptions(), null, mockHandler.Object); mockHandler.Verify(mh => mh.HandleDiscoveryComplete(It.IsAny(), null), Times.Once, "Discovery Complete must be called"); mockHandler.Verify(mh => mh.HandleDiscoveredTests(It.IsAny>()), Times.Never, "DiscoveredTests must not be called"); @@ -355,7 +355,7 @@ public async Task DiscoverTestsAsyncShouldCompleteWithZeroTests() }; this.mockCommunicationManager.Setup(cm => cm.ReceiveMessageAsync(It.IsAny())).Returns(Task.FromResult(discoveryComplete)); - await this.requestSender.DiscoverTestsAsync(new List() { "1.dll" }, null, null, mockHandler.Object); + await this.requestSender.DiscoverTestsAsync(new List() { "1.dll" }, null, null, null, mockHandler.Object); mockHandler.Verify(mh => mh.HandleDiscoveryComplete(It.IsAny(), null), Times.Once, "Discovery Complete must be called"); mockHandler.Verify(mh => mh.HandleDiscoveredTests(It.IsAny>()), Times.Never, "DiscoveredTests must not be called"); @@ -388,7 +388,7 @@ public void DiscoverTestsShouldCompleteWithSingleTest() mockHandler.Setup(mh => mh.HandleDiscoveredTests(It.IsAny>())).Callback( () => this.mockCommunicationManager.Setup(cm => cm.ReceiveMessageAsync(It.IsAny())).Returns(Task.FromResult(discoveryComplete))); - this.requestSender.DiscoverTests(new List() { "1.dll" }, null, new TestPlatformOptions(), mockHandler.Object); + this.requestSender.DiscoverTests(new List() { "1.dll" }, null, new TestPlatformOptions(), null, mockHandler.Object); mockHandler.Verify(mh => mh.HandleDiscoveryComplete(It.IsAny(), null), Times.Once, "Discovery Complete must be called"); mockHandler.Verify(mh => mh.HandleDiscoveredTests(It.IsAny>()), Times.Once, "DiscoveredTests must be called"); @@ -421,7 +421,7 @@ public async Task DiscoverTestsAsyncShouldCompleteWithSingleTest() mockHandler.Setup(mh => mh.HandleDiscoveredTests(It.IsAny>())).Callback( () => this.mockCommunicationManager.Setup(cm => cm.ReceiveMessageAsync(It.IsAny())).Returns(Task.FromResult(discoveryComplete))); - await this.requestSender.DiscoverTestsAsync(new List() { "1.dll" }, null, new TestPlatformOptions(), mockHandler.Object); + await this.requestSender.DiscoverTestsAsync(new List() { "1.dll" }, null, new TestPlatformOptions(), null, mockHandler.Object); mockHandler.Verify(mh => mh.HandleDiscoveryComplete(It.IsAny(), null), Times.Once, "Discovery Complete must be called"); mockHandler.Verify(mh => mh.HandleDiscoveredTests(It.IsAny>()), Times.Once, "DiscoveredTests must be called"); @@ -454,7 +454,7 @@ public void DiscoverTestsShouldReportBackTestsWithTraitsInTestsFoundMessage() this.mockCommunicationManager.Setup(cm => cm.ReceiveMessageAsync(It.IsAny())).Returns(Task.FromResult((discoveryComplete))); }); - this.requestSender.DiscoverTests(new List() { "1.dll" }, null, new TestPlatformOptions(), mockHandler.Object); + this.requestSender.DiscoverTests(new List() { "1.dll" }, null, new TestPlatformOptions(), null, mockHandler.Object); Assert.IsNotNull(receivedTestCases); Assert.AreEqual(1, receivedTestCases.Count); @@ -492,7 +492,7 @@ public async Task DiscoverTestsAsyncShouldReportBackTestsWithTraitsInTestsFoundM this.mockCommunicationManager.Setup(cm => cm.ReceiveMessageAsync(It.IsAny())).Returns(Task.FromResult((discoveryComplete))); }); - await this.requestSender.DiscoverTestsAsync(new List() { "1.dll" }, null, new TestPlatformOptions(), mockHandler.Object); + await this.requestSender.DiscoverTestsAsync(new List() { "1.dll" }, null, new TestPlatformOptions(), null, mockHandler.Object); Assert.IsNotNull(receivedTestCases); Assert.AreEqual(1, receivedTestCases.Count); @@ -528,7 +528,7 @@ public void DiscoverTestsShouldReportBackTestsWithTraitsInDiscoveryCompleteMessa receivedTestCases = tests?.ToList(); }); - this.requestSender.DiscoverTests(new List() { "1.dll" }, null, new TestPlatformOptions(), mockHandler.Object); + this.requestSender.DiscoverTests(new List() { "1.dll" }, null, new TestPlatformOptions(), null, mockHandler.Object); Assert.IsNotNull(receivedTestCases); Assert.AreEqual(1, receivedTestCases.Count); @@ -564,7 +564,7 @@ public async Task DiscoverTestsAsyncShouldReportBackTestsWithTraitsInDiscoveryCo receivedTestCases = tests?.ToList(); }); - await this.requestSender.DiscoverTestsAsync(new List() { "1.dll" }, null, new TestPlatformOptions(), mockHandler.Object); + await this.requestSender.DiscoverTestsAsync(new List() { "1.dll" }, null, new TestPlatformOptions(), null, mockHandler.Object); Assert.IsNotNull(receivedTestCases); Assert.AreEqual(1, receivedTestCases.Count); @@ -599,7 +599,7 @@ public void DiscoverTestsShouldCompleteWithTestMessage() mockHandler.Setup(mh => mh.HandleLogMessage(It.IsAny(), It.IsAny())).Callback( () => this.mockCommunicationManager.Setup(cm => cm.ReceiveMessageAsync(It.IsAny())).Returns(Task.FromResult(discoveryComplete))); - this.requestSender.DiscoverTests(new List() { "1.dll" }, null, new TestPlatformOptions(), mockHandler.Object); + this.requestSender.DiscoverTests(new List() { "1.dll" }, null, new TestPlatformOptions(), null, mockHandler.Object); mockHandler.Verify(mh => mh.HandleDiscoveryComplete(It.IsAny(), null), Times.Once, "Discovery Complete must be called"); mockHandler.Verify(mh => mh.HandleDiscoveredTests(It.IsAny>()), Times.Once, "DiscoveredTests must be called"); @@ -629,7 +629,7 @@ public async Task DiscoverTestsAsyncShouldCompleteWithTestMessage() mockHandler.Setup(mh => mh.HandleLogMessage(It.IsAny(), It.IsAny())).Callback( () => this.mockCommunicationManager.Setup(cm => cm.ReceiveMessageAsync(It.IsAny())).Returns(Task.FromResult(discoveryComplete))); - await this.requestSender.DiscoverTestsAsync(new List() { "1.dll" }, null, new TestPlatformOptions(), mockHandler.Object); + await this.requestSender.DiscoverTestsAsync(new List() { "1.dll" }, null, new TestPlatformOptions(), null, mockHandler.Object); mockHandler.Verify(mh => mh.HandleDiscoveryComplete(It.IsAny(), null), Times.Once, "Discovery Complete must be called"); mockHandler.Verify(mh => mh.HandleDiscoveredTests(It.IsAny>()), Times.Once, "DiscoveredTests must be called"); @@ -644,7 +644,7 @@ public void DiscoverTestsShouldAbortOnExceptionInSendMessage() var payload = new DiscoveryRequestPayload { Sources = sources, RunSettings = null }; this.mockCommunicationManager.Setup(cm => cm.SendMessage(MessageType.StartDiscovery, payload)).Throws(new IOException()); - this.requestSender.DiscoverTests(sources, null, new TestPlatformOptions(), mockHandler.Object); + this.requestSender.DiscoverTests(sources, null, new TestPlatformOptions(), null, mockHandler.Object); mockHandler.Verify(mh => mh.HandleDiscoveryComplete(It.IsAny(), null), Times.Once, "Discovery Complete must be called"); mockHandler.Verify(mh => mh.HandleLogMessage(TestMessageLevel.Error, It.IsAny()), Times.Once, "TestMessage event must be called"); @@ -659,7 +659,7 @@ public async Task DiscoverTestsAsyncShouldAbortOnExceptionInSendMessage() var payload = new DiscoveryRequestPayload { Sources = sources, RunSettings = null }; this.mockCommunicationManager.Setup(cm => cm.SendMessage(MessageType.StartDiscovery, payload)).Throws(new IOException()); - await this.requestSender.DiscoverTestsAsync(sources, null, new TestPlatformOptions(), mockHandler.Object); + await this.requestSender.DiscoverTestsAsync(sources, null, new TestPlatformOptions(), null, mockHandler.Object); mockHandler.Verify(mh => mh.HandleDiscoveryComplete(It.IsAny(), null), Times.Once, "Discovery Complete must be called"); mockHandler.Verify(mh => mh.HandleLogMessage(TestMessageLevel.Error, It.IsAny()), Times.Once, "TestMessage event must be called"); @@ -688,7 +688,7 @@ public void DiscoverTestsShouldLogErrorWhenProcessExited() mockHandler.Setup(mh => mh.HandleDiscoveryComplete( It.IsAny(), null)).Callback(() => manualEvent.Set()); - this.requestSender.DiscoverTests(sources, null, new TestPlatformOptions(), mockHandler.Object); + this.requestSender.DiscoverTests(sources, null, new TestPlatformOptions(), null, mockHandler.Object); manualEvent.WaitOne(); mockHandler.Verify(mh => mh.HandleLogMessage(TestMessageLevel.Error, It.IsAny()), Times.Once); @@ -713,7 +713,7 @@ public async Task DiscoverTestsAsyncShouldLogErrorWhenProcessExited() Assert.IsTrue(c.IsCancellationRequested); }).Returns(Task.FromResult((Message)null)); - await this.requestSender.DiscoverTestsAsync(sources, null, new TestPlatformOptions(), mockHandler.Object); + await this.requestSender.DiscoverTestsAsync(sources, null, new TestPlatformOptions(), null, mockHandler.Object); mockHandler.Verify(mh => mh.HandleLogMessage(TestMessageLevel.Error, It.IsAny()), Times.Once); } diff --git a/test/TranslationLayer.UnitTests/VsTestConsoleWrapperAsyncTests.cs b/test/TranslationLayer.UnitTests/VsTestConsoleWrapperAsyncTests.cs index be3777ccb8..e33017261e 100644 --- a/test/TranslationLayer.UnitTests/VsTestConsoleWrapperAsyncTests.cs +++ b/test/TranslationLayer.UnitTests/VsTestConsoleWrapperAsyncTests.cs @@ -140,7 +140,7 @@ public async Task DiscoverTestsAsyncShouldSucceed() { await this.consoleWrapper.DiscoverTestsAsync(this.testSources, null, new TestPlatformOptions(), new Mock().Object); - this.mockRequestSender.Verify(rs => rs.DiscoverTestsAsync(this.testSources, null, It.IsAny(), It.IsAny()), Times.Once); + this.mockRequestSender.Verify(rs => rs.DiscoverTestsAsync(this.testSources, null, It.IsAny(), null, It.IsAny()), Times.Once); } [TestMethod] @@ -148,7 +148,7 @@ public async Task DiscoverTestsAsyncShouldPassTestDiscoveryHandler2IfTestDiscove { await this.consoleWrapper.DiscoverTestsAsync(this.testSources, null, new TestPlatformOptions(), new Mock().Object); - this.mockRequestSender.Verify(rs => rs.DiscoverTestsAsync(this.testSources, null, It.IsAny(), It.IsAny()), Times.Once); + this.mockRequestSender.Verify(rs => rs.DiscoverTestsAsync(this.testSources, null, It.IsAny(), null, It.IsAny()), Times.Once); } [TestMethod] @@ -156,7 +156,7 @@ public async Task DiscoverTestsAndNullOptionsAsyncShouldSucceedOnNullOptions() { await this.consoleWrapper.DiscoverTestsAsync(this.testSources, null, null, new Mock().Object); - this.mockRequestSender.Verify(rs => rs.DiscoverTestsAsync(this.testSources, null, null, It.IsAny()), Times.Once); + this.mockRequestSender.Verify(rs => rs.DiscoverTestsAsync(this.testSources, null, null, null, It.IsAny()), Times.Once); } [TestMethod] @@ -165,7 +165,7 @@ public async Task DiscoverTestsAndOptionsAsyncShouldSucceedOnOptions() var options = new TestPlatformOptions(); await this.consoleWrapper.DiscoverTestsAsync(this.testSources, null, options, new Mock().Object); - this.mockRequestSender.Verify(rs => rs.DiscoverTestsAsync(this.testSources, null, options, It.IsAny()), Times.Once); + this.mockRequestSender.Verify(rs => rs.DiscoverTestsAsync(this.testSources, null, options, null, It.IsAny()), Times.Once); } [TestMethod] @@ -174,7 +174,7 @@ public void DiscoverTestsAsyncShouldThrowExceptionOnBadConnection() this.mockRequestSender.Setup(rs => rs.InitializeCommunicationAsync(It.IsAny())).Returns(Task.FromResult(-1)); Assert.ThrowsExceptionAsync(async () => await this.consoleWrapper.DiscoverTestsAsync(new List { "Hello", "World" }, null, new TestPlatformOptions(), new Mock().Object)); - this.mockRequestSender.Verify(rs => rs.DiscoverTestsAsync(It.IsAny>(), It.IsAny(), It.IsAny(), It.IsAny()), Times.Never); + this.mockRequestSender.Verify(rs => rs.DiscoverTestsAsync(It.IsAny>(), It.IsAny(), It.IsAny(), null, It.IsAny()), Times.Never); } [TestMethod] diff --git a/test/TranslationLayer.UnitTests/VsTestConsoleWrapperTests.cs b/test/TranslationLayer.UnitTests/VsTestConsoleWrapperTests.cs index caedfbd902..d99e9c9801 100644 --- a/test/TranslationLayer.UnitTests/VsTestConsoleWrapperTests.cs +++ b/test/TranslationLayer.UnitTests/VsTestConsoleWrapperTests.cs @@ -145,7 +145,7 @@ public void DiscoverTestsShouldSucceed() var options = new TestPlatformOptions() { TestCaseFilter = "PacMan" }; this.consoleWrapper.DiscoverTests(this.testSources, null, options, new Mock().Object); - this.mockRequestSender.Verify(rs => rs.DiscoverTests(this.testSources, null, options, It.IsAny()), Times.Once); + this.mockRequestSender.Verify(rs => rs.DiscoverTests(this.testSources, null, options, null, It.IsAny()), Times.Once); } [TestMethod] @@ -153,7 +153,7 @@ public void DiscoverTestsShouldPassOnNullOptions() { this.consoleWrapper.DiscoverTests(this.testSources, null, null, new Mock().Object); - this.mockRequestSender.Verify(rs => rs.DiscoverTests(this.testSources, null, null, It.IsAny()), Times.Once); + this.mockRequestSender.Verify(rs => rs.DiscoverTests(this.testSources, null, null, null, It.IsAny()), Times.Once); } [TestMethod] @@ -161,7 +161,7 @@ public void DiscoverTestsShouldCallTestDiscoveryHandler2IfTestDiscoveryHandler1I { this.consoleWrapper.DiscoverTests(this.testSources, null, new Mock().Object); - this.mockRequestSender.Verify(rs => rs.DiscoverTests(this.testSources, null, null, It.IsAny()), Times.Once); + this.mockRequestSender.Verify(rs => rs.DiscoverTests(this.testSources, null, null, null, It.IsAny()), Times.Once); } [TestMethod] @@ -172,7 +172,7 @@ public void DiscoverTestsShouldThrowExceptionOnBadConnection() var exception = Assert.ThrowsException(() => this.consoleWrapper.DiscoverTests(new List { "Hello", "World" }, null, null, new Mock().Object)); Assert.AreEqual("DummyProcess process failed to connect to vstest.console process after 90 seconds. This may occur due to machine slowness, please set environment variable VSTEST_CONNECTION_TIMEOUT to increase timeout.", exception.Message); - this.mockRequestSender.Verify(rs => rs.DiscoverTests(It.IsAny>(), It.IsAny(), null, It.IsAny()), Times.Never); + this.mockRequestSender.Verify(rs => rs.DiscoverTests(It.IsAny>(), It.IsAny(), null, null, It.IsAny()), Times.Never); } [TestMethod] From 859965e4d9e67bf364e31e46e9bc0b820e78b894 Mon Sep 17 00:00:00 2001 From: Codrin Poienaru Date: Mon, 11 Jan 2021 19:37:22 +0100 Subject: [PATCH 02/26] Enabled test session info passing through TP --- .../Client/ProxyDiscoveryManager.cs | 30 ++++++++-- .../TestEngine.cs | 21 +++++++ .../Client/DiscoveryCriteria.cs | 58 +++++++++++++++++-- 3 files changed, 97 insertions(+), 12 deletions(-) diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyDiscoveryManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyDiscoveryManager.cs index 7623603154..f363cba847 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyDiscoveryManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyDiscoveryManager.cs @@ -25,17 +25,37 @@ namespace Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client /// public class ProxyDiscoveryManager : IProxyDiscoveryManager, IBaseProxy, ITestDiscoveryEventsHandler2 { - private ProxyOperationManager proxyOperationManager; private readonly ITestRuntimeProvider testHostManager; + private readonly IFileHelper fileHelper; + private IDataSerializer dataSerializer; - private bool isCommunicationEstablished; private IRequestData requestData; private ITestDiscoveryEventsHandler2 baseTestDiscoveryEventsHandler; + private TestSessionInfo testSessionInfo = null; + private ProxyOperationManager proxyOperationManager; + private bool isCommunicationEstablished; private bool skipDefaultAdapters; - private readonly IFileHelper fileHelper; #region Constructors + /// + /// Initializes a new instance of the class. + /// + /// + /// The test session info. + public ProxyDiscoveryManager(TestSessionInfo testSessionInfo) + { + // Filling in test session info and proxy information. + this.testSessionInfo = testSessionInfo; + this.proxyOperationManager = TestSessionPool.Instance.TakeProxy(this.testSessionInfo); + + this.testHostManager = this.proxyOperationManager.TestHostManager; + this.dataSerializer = JsonDataSerializer.Instance; + this.isCommunicationEstablished = false; + this.requestData = this.proxyOperationManager.RequestData; + this.fileHelper = new FileHelper(); + } + /// /// Initializes a new instance of the class. /// @@ -55,9 +75,7 @@ public ProxyDiscoveryManager( testHostManager, JsonDataSerializer.Instance, new FileHelper()) - { - this.testHostManager = testHostManager; - } + { } /// /// Initializes a new instance of the class. diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/TestEngine.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/TestEngine.cs index 82efbca0be..4be825f166 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/TestEngine.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/TestEngine.cs @@ -79,6 +79,27 @@ public IProxyDiscoveryManager GetDiscoveryManager( Func proxyDiscoveryManagerCreator = () => { + if (discoveryCriteria.TestSessionInfo != null) + { + try + { + // In case we have an active test session, we always prefer the already + // created proxies instead of the ones that need to be created on the spot. + return new ProxyDiscoveryManager( + discoveryCriteria.TestSessionInfo); + } + catch (InvalidOperationException ex) + { + // If the proxy creation process based on test session info failed, then + // we'll proceed with the normal creation process as if no test session + // info was passed in in the first place. + // + // WARNING: This should not normally happen and it raises questions + // regarding the test session pool operation and consistency. + EqtTrace.Warning("ProxyDiscoveryManager failed: {0}", ex.ToString()); + } + } + var hostManager = this.testHostProviderManager.GetTestHostManagerByRunConfiguration(discoveryCriteria.RunSettings); hostManager?.Initialize(TestSessionMessageLogger.Instance, discoveryCriteria.RunSettings); diff --git a/src/Microsoft.TestPlatform.ObjectModel/Client/DiscoveryCriteria.cs b/src/Microsoft.TestPlatform.ObjectModel/Client/DiscoveryCriteria.cs index 3d405314ac..489dd49482 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Client/DiscoveryCriteria.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/Client/DiscoveryCriteria.cs @@ -37,10 +37,16 @@ public DiscoveryCriteria() /// /// Test configuration provided by user. /// - public DiscoveryCriteria(IEnumerable sources, long frequencyOfDiscoveredTestsEvent, string testSettings) - : this(sources, frequencyOfDiscoveredTestsEvent, TimeSpan.MaxValue, testSettings) - { - } + public DiscoveryCriteria( + IEnumerable sources, + long frequencyOfDiscoveredTestsEvent, + string testSettings) + : this( + sources, + frequencyOfDiscoveredTestsEvent, + TimeSpan.MaxValue, + testSettings) + { } /// /// Initializes a new instance of the class. @@ -57,7 +63,41 @@ public DiscoveryCriteria(IEnumerable sources, long frequencyOfDiscovered /// /// Run Settings for the discovery. /// - public DiscoveryCriteria(IEnumerable sources, long frequencyOfDiscoveredTestsEvent, TimeSpan discoveredTestEventTimeout, string runSettings) + public DiscoveryCriteria( + IEnumerable sources, + long frequencyOfDiscoveredTestsEvent, + TimeSpan discoveredTestEventTimeout, + string runSettings) + : this( + sources, + frequencyOfDiscoveredTestsEvent, + discoveredTestEventTimeout, + runSettings, + null) + { } + + /// + /// Initializes a new instance of the class. + /// + /// + /// Sources from which the tests should be discovered + /// + /// + /// Frequency of discovered test event. This is used for batching discovered tests. + /// + /// + /// Timeout that triggers the discovered test event regardless of cache size. + /// + /// + /// Run Settings for the discovery. + /// + /// The test session info object. + public DiscoveryCriteria( + IEnumerable sources, + long frequencyOfDiscoveredTestsEvent, + TimeSpan discoveredTestEventTimeout, + string runSettings, + TestSessionInfo testSessionInfo) { ValidateArg.NotNullOrEmpty(sources, "sources"); if (frequencyOfDiscoveredTestsEvent <= 0) @@ -78,6 +118,7 @@ public DiscoveryCriteria(IEnumerable sources, long frequencyOfDiscovered this.DiscoveredTestEventTimeout = discoveredTestEventTimeout; this.RunSettings = runSettings; + this.TestSessionInfo = testSessionInfo; } /// @@ -136,6 +177,11 @@ public IEnumerable Sources /// Gets or sets the criteria for filtering test cases. /// [DataMember] - public string TestCaseFilter {get; set;} + public string TestCaseFilter { get; set; } + + /// + /// Gets or sets the test session info object. + /// + public TestSessionInfo TestSessionInfo { get; set; } } } From 30775f160c9268fb8f06befdfe2a0682c68bc094 Mon Sep 17 00:00:00 2001 From: Codrin Poienaru Date: Tue, 12 Jan 2021 22:01:59 +0100 Subject: [PATCH 03/26] Testhost sharing is working --- .../TestRequestSender.cs | 7 +++++++ .../Client/ProxyDiscoveryManager.cs | 8 +++++++- .../Client/ProxyOperationManager.cs | 3 +++ src/Microsoft.TestPlatform.CrossPlatEngine/TestEngine.cs | 6 +++++- .../TestSession.cs | 4 ++-- .../TestPlatformHelpers/TestRequestManager.cs | 3 ++- 6 files changed, 26 insertions(+), 5 deletions(-) diff --git a/src/Microsoft.TestPlatform.CommunicationUtilities/TestRequestSender.cs b/src/Microsoft.TestPlatform.CommunicationUtilities/TestRequestSender.cs index df3bc35603..0507aee525 100644 --- a/src/Microsoft.TestPlatform.CommunicationUtilities/TestRequestSender.cs +++ b/src/Microsoft.TestPlatform.CommunicationUtilities/TestRequestSender.cs @@ -127,6 +127,8 @@ internal TestRequestSender( { } + public bool CloseConnectionOnOperationComplete { get; set; } = true; + /// public int InitializeCommunication() { @@ -703,6 +705,11 @@ private bool IsOperationComplete() private void SetOperationComplete() { + if (!this.CloseConnectionOnOperationComplete) + { + return; + } + // Complete the currently ongoing operation (Discovery/Execution) if (EqtTrace.IsVerboseEnabled) { diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyDiscoveryManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyDiscoveryManager.cs index f363cba847..cae18925a1 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyDiscoveryManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyDiscoveryManager.cs @@ -175,7 +175,13 @@ public void Abort() /// public void Close() { - this.proxyOperationManager.Close(); + if (this.testSessionInfo == null) + { + this.proxyOperationManager.Close(); + return; + } + + TestSessionPool.Instance.ReturnProxy(this.testSessionInfo, this.proxyOperationManager.Id); } /// diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyOperationManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyOperationManager.cs index 81e83f2e7d..6adab65360 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyOperationManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyOperationManager.cs @@ -309,6 +309,9 @@ public virtual void Close() var timeout = 100; EqtTrace.Verbose("ProxyOperationManager.Close: waiting for test host to exit for {0} ms", timeout); this.testHostExited.Wait(timeout); + + // Closing the communication channel. + this.RequestSender.Close(); } } catch (Exception ex) diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/TestEngine.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/TestEngine.cs index 4be825f166..3d99fe71fb 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/TestEngine.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/TestEngine.cs @@ -252,7 +252,11 @@ public IProxyTestSessionManager GetTestSessionManager( hostManager.SetCustomLauncher(testSessionCriteria.TestHostLauncher); } - var requestSender = new TestRequestSender(requestData.ProtocolConfig, hostManager); + var requestSender = new TestRequestSender(requestData.ProtocolConfig, hostManager) + { + CloseConnectionOnOperationComplete = false + }; + return isDataCollectorEnabled ? new ProxyOperationManagerWithDataCollection( diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/TestSession.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/TestSession.cs index d97761a4c9..40fb329639 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/TestSession.cs +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/TestSession.cs @@ -75,11 +75,11 @@ public void DiscoverTests( TestPlatformOptions options, ITestDiscoveryEventsHandler2 discoveryEventsHandler) { - // TODO (copoiena): Hook into the wrapper and pass session info here. this.consoleWrapper.DiscoverTests( sources, discoverySettings, options, + this.testSessionInfo, discoveryEventsHandler); } @@ -233,11 +233,11 @@ public async Task DiscoverTestsAsync( TestPlatformOptions options, ITestDiscoveryEventsHandler2 discoveryEventsHandler) { - // TODO (copoiena): Hook into the wrapper and pass session info here. await this.consoleWrapper.DiscoverTestsAsync( sources, discoverySettings, options, + this.testSessionInfo, discoveryEventsHandler); } diff --git a/src/vstest.console/TestPlatformHelpers/TestRequestManager.cs b/src/vstest.console/TestPlatformHelpers/TestRequestManager.cs index 5ce2fdacb5..8c9291568d 100644 --- a/src/vstest.console/TestPlatformHelpers/TestRequestManager.cs +++ b/src/vstest.console/TestPlatformHelpers/TestRequestManager.cs @@ -202,7 +202,8 @@ public void DiscoverTests( discoveryPayload.Sources, batchSize, this.commandLineOptions.TestStatsEventTimeout, - runsettings) + runsettings, + discoveryPayload.TestSessionInfo) { TestCaseFilter = this.commandLineOptions.TestCaseFilterValue ?? testCaseFilterFromRunsettings From b9057db23fb4fc94dbd6f1ff5ebceede73d528a5 Mon Sep 17 00:00:00 2001 From: Codrin Poienaru Date: Thu, 14 Jan 2021 17:32:43 +0100 Subject: [PATCH 04/26] Fixed double channel close --- .../TestPlatform.cs | 26 +-------- .../Engine/ClientProtocol/ITestEngine.cs | 2 - .../TestRequestSender.cs | 5 ++ .../Client/ProxyOperationManager.cs | 23 +++++++- .../Resources/Resources.Designer.cs | 9 +++ .../Resources/Resources.resx | 3 + .../Resources/xlf/Resources.cs.xlf | 5 ++ .../Resources/xlf/Resources.de.xlf | 5 ++ .../Resources/xlf/Resources.es.xlf | 5 ++ .../Resources/xlf/Resources.fr.xlf | 5 ++ .../Resources/xlf/Resources.it.xlf | 5 ++ .../Resources/xlf/Resources.ja.xlf | 5 ++ .../Resources/xlf/Resources.ko.xlf | 5 ++ .../Resources/xlf/Resources.pl.xlf | 5 ++ .../Resources/xlf/Resources.pt-BR.xlf | 5 ++ .../Resources/xlf/Resources.ru.xlf | 5 ++ .../Resources/xlf/Resources.tr.xlf | 5 ++ .../Resources/xlf/Resources.xlf | 5 ++ .../Resources/xlf/Resources.zh-Hans.xlf | 5 ++ .../Resources/xlf/Resources.zh-Hant.xlf | 5 ++ .../TestEngine.cs | 20 +++++-- .../TestSession/ProxyTestSessionManager.cs | 55 ++++++++++++------- 22 files changed, 163 insertions(+), 50 deletions(-) diff --git a/src/Microsoft.TestPlatform.Client/TestPlatform.cs b/src/Microsoft.TestPlatform.Client/TestPlatform.cs index 1f2915f065..9ba116cf41 100644 --- a/src/Microsoft.TestPlatform.Client/TestPlatform.cs +++ b/src/Microsoft.TestPlatform.Client/TestPlatform.cs @@ -170,32 +170,12 @@ public void StartTestSession( this.AddExtensionAssemblies(testSessionCriteria.RunSettings); var runConfiguration = XmlRunSettingsUtilities.GetRunConfigurationNode(testSessionCriteria.RunSettings); - - // Update extension assemblies from source when design mode is false. - // - // TODO (copoiena): Is it possible for this code to run if we're not in design mode ? - // An use case for this would be when running tests with "dotnet test". Usually there's - // a build involved then. if (!runConfiguration.DesignMode) { return; } - // Initialize loggers. - var loggerManager = this.TestEngine.GetLoggerManager(requestData); - loggerManager.Initialize(testSessionCriteria.RunSettings); - - var testHostManager = this.testHostProviderManager.GetTestHostManagerByRunConfiguration(testSessionCriteria.RunSettings); - ThrowExceptionIfTestHostManagerIsNull(testHostManager, testSessionCriteria.RunSettings); - - testHostManager.Initialize(TestSessionMessageLogger.Instance, testSessionCriteria.RunSettings); - - if (testSessionCriteria.TestHostLauncher != null) - { - testHostManager.SetCustomLauncher(testSessionCriteria.TestHostLauncher); - } - - var testSessionManager = this.TestEngine.GetTestSessionManager(requestData, testHostManager, testSessionCriteria); + var testSessionManager = this.TestEngine.GetTestSessionManager(requestData, testSessionCriteria); if (testSessionManager == null) { // The test session manager is null because the combination of runsettings and @@ -234,11 +214,11 @@ public void ClearExtensions() private void ThrowExceptionIfTestHostManagerIsNull( ITestRuntimeProvider testHostManager, - string settingXml) + string settingsXml) { if (testHostManager == null) { - EqtTrace.Error("TestPlatform.CreateTestRunRequest: No suitable testHostProvider found for runsettings : {0}", settingXml); + EqtTrace.Error("TestPlatform.CreateTestRunRequest: No suitable testHostProvider found for runsettings : {0}", settingsXml); throw new TestPlatformException(string.Format(CultureInfo.CurrentCulture, ClientResources.NoTestHostProviderFound)); } } diff --git a/src/Microsoft.TestPlatform.Common/Interfaces/Engine/ClientProtocol/ITestEngine.cs b/src/Microsoft.TestPlatform.Common/Interfaces/Engine/ClientProtocol/ITestEngine.cs index 03f2e222fb..0f75e1616a 100644 --- a/src/Microsoft.TestPlatform.Common/Interfaces/Engine/ClientProtocol/ITestEngine.cs +++ b/src/Microsoft.TestPlatform.Common/Interfaces/Engine/ClientProtocol/ITestEngine.cs @@ -53,7 +53,6 @@ IProxyExecutionManager GetExecutionManager( /// /// The request data for providing test session services and data. /// - /// Test host manager for the current test session. /// /// Test session criteria of the current test session. /// @@ -61,7 +60,6 @@ IProxyExecutionManager GetExecutionManager( /// An IProxyTestSessionManager object that can manage test sessions. IProxyTestSessionManager GetTestSessionManager( IRequestData requestData, - ITestRuntimeProvider testHostManager, StartTestSessionCriteria testSessionCriteria); /// diff --git a/src/Microsoft.TestPlatform.CommunicationUtilities/TestRequestSender.cs b/src/Microsoft.TestPlatform.CommunicationUtilities/TestRequestSender.cs index 0507aee525..c989f2d473 100644 --- a/src/Microsoft.TestPlatform.CommunicationUtilities/TestRequestSender.cs +++ b/src/Microsoft.TestPlatform.CommunicationUtilities/TestRequestSender.cs @@ -705,6 +705,11 @@ private bool IsOperationComplete() private void SetOperationComplete() { + // When sharing the testhost between discovery and execution we must keep the + // testhost alive after completing the operation it was spawned for. As such we + // suppress the test request sender channel close taking place here. This channel + // will be closed when the test session owner decides to dispose of the test session + // object. if (!this.CloseConnectionOnOperationComplete) { return; diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyOperationManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyOperationManager.cs index 6adab65360..048617b0b6 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyOperationManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyOperationManager.cs @@ -120,6 +120,12 @@ public ProxyOperationManager( /// Gets or sets the cancellation token source. /// public CancellationTokenSource CancellationTokenSource { get; set; } + + /// + /// Gets or sets a value indicating if the test request sender communication channel should + /// be closed when the proxy operation manager is closed. + /// + public bool CloseRequestSenderChannelOnProxyClose { get; set; } = false; #endregion #region IProxyOperationManager implementation. @@ -310,8 +316,21 @@ public virtual void Close() EqtTrace.Verbose("ProxyOperationManager.Close: waiting for test host to exit for {0} ms", timeout); this.testHostExited.Wait(timeout); - // Closing the communication channel. - this.RequestSender.Close(); + // In compatibility mode (no test session used) we don't share the testhost + // between test discovery and test run. The testhost is closed upon + // successfully completing the operation it was spawned for, and so the test + // request sender communication channel is closed then as well. As such, it's + // not a good idea to double close the communication channel here. + // + // In contrast, the new workflow (using test sessions) means we should keep + // the testhost alive until explicitly closed by the test session owner. For + // this we supressed the normal test request sender close and we have to close + // that communication channel here. + if (this.CloseRequestSenderChannelOnProxyClose) + { + // Closing the communication channel. + this.RequestSender.Close(); + } } } catch (Exception ex) diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/Resources.Designer.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/Resources.Designer.cs index 8ee4d46c5c..24fab7e1c9 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/Resources.Designer.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/Resources.Designer.cs @@ -249,6 +249,15 @@ internal static string NoSuchProxyId { } } + /// + /// Looks up a localized string similar to No suitable test runtime provider found for this run.. + /// + internal static string NoTestHostProviderFound { + get { + return ResourceManager.GetString("NoTestHostProviderFound", resourceCulture); + } + } + /// /// Looks up a localized string similar to No test matches the given testcase filter `{0}` in {1}. /// diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/Resources.resx b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/Resources.resx index 802bf4805b..b92c863738 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/Resources.resx +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/Resources.resx @@ -213,4 +213,7 @@ Proxy with id {0} is already available and cannot be re-enqueued. + + No suitable test runtime provider found for this run. + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.cs.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.cs.xlf index f82d76a3e7..4a65a50bae 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.cs.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.cs.xlf @@ -232,6 +232,11 @@ Proxy s ID {0} je už k dispozici a nedá se znovu zařadit do fronty. + + No suitable test runtime provider found for this run. + No suitable test runtime provider found for this run. + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.de.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.de.xlf index fa9a4ee1bc..db01a9e673 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.de.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.de.xlf @@ -232,6 +232,11 @@ Der Proxy mit der ID {0} ist bereits verfügbar und kann nicht erneut in die Warteschlange eingereiht werden. + + No suitable test runtime provider found for this run. + No suitable test runtime provider found for this run. + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.es.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.es.xlf index 87e1f13a4e..c9a79acad2 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.es.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.es.xlf @@ -232,6 +232,11 @@ El proxy con el identificador {0} ya está disponible y no se puede volver a poner en cola. + + No suitable test runtime provider found for this run. + No suitable test runtime provider found for this run. + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.fr.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.fr.xlf index 81c3bb53d1..d639bfb9b2 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.fr.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.fr.xlf @@ -232,6 +232,11 @@ Le proxy ayant l'ID {0} est déjà disponible et ne peut pas être empilé à nouveau. + + No suitable test runtime provider found for this run. + No suitable test runtime provider found for this run. + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.it.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.it.xlf index 21bfaa9c17..e2ae6ec9bb 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.it.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.it.xlf @@ -232,6 +232,11 @@ Il proxy con ID {0} è già disponibile e non può essere riaccodato. + + No suitable test runtime provider found for this run. + No suitable test runtime provider found for this run. + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ja.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ja.xlf index 0eb80ccaa0..ab3da08b08 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ja.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ja.xlf @@ -232,6 +232,11 @@ ID が {0} のプロキシは、既に使用可能になっているため、再度エンキューすることはできません。 + + No suitable test runtime provider found for this run. + No suitable test runtime provider found for this run. + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ko.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ko.xlf index 92958896e9..9e6c27d35f 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ko.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ko.xlf @@ -232,6 +232,11 @@ ID가 {0}인 프록시를 이미 사용할 수 있으며 큐에 다시 넣을 수 없습니다. + + No suitable test runtime provider found for this run. + No suitable test runtime provider found for this run. + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.pl.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.pl.xlf index 793a78d4e8..29185e0250 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.pl.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.pl.xlf @@ -232,6 +232,11 @@ Serwer proxy o identyfikatorze {0} jest już dostępny i nie można go ponownie umieścić w kolejce. + + No suitable test runtime provider found for this run. + No suitable test runtime provider found for this run. + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.pt-BR.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.pt-BR.xlf index 63502df5bb..a6720a38f7 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.pt-BR.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.pt-BR.xlf @@ -232,6 +232,11 @@ O proxy com a ID {0} já está disponível e não pode ser enfileirado novamente. + + No suitable test runtime provider found for this run. + No suitable test runtime provider found for this run. + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ru.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ru.xlf index 37a6f933f6..02e9f2dfbc 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ru.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ru.xlf @@ -232,6 +232,11 @@ Прокси-сервер с идентификатором {0} уже доступен и не может быть повторно поставлен в очередь. + + No suitable test runtime provider found for this run. + No suitable test runtime provider found for this run. + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.tr.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.tr.xlf index 442955eaec..6f14017a64 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.tr.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.tr.xlf @@ -232,6 +232,11 @@ {0} kimliğine sahip ara sunucu zaten var ve yeniden kuyruğa alınamaz. + + No suitable test runtime provider found for this run. + No suitable test runtime provider found for this run. + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.xlf index a5998be2f6..02671eb951 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.xlf @@ -143,6 +143,11 @@ Proxy with id {0} is already available and cannot be re-enqueued. + + No suitable test runtime provider found for this run. + No suitable test runtime provider found for this run. + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.zh-Hans.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.zh-Hans.xlf index dc8c5a7f29..c08f6311c8 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.zh-Hans.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.zh-Hans.xlf @@ -232,6 +232,11 @@ ID 为 {0} 的代理已可用,无法重新排队。 + + No suitable test runtime provider found for this run. + No suitable test runtime provider found for this run. + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.zh-Hant.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.zh-Hant.xlf index 15881061f1..408faeb424 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.zh-Hant.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.zh-Hant.xlf @@ -232,6 +232,11 @@ 識別碼為 {0} 的 Proxy 已可供使用,但無法重新加入佇列。 + + No suitable test runtime provider found for this run. + No suitable test runtime provider found for this run. + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/TestEngine.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/TestEngine.cs index 3d99fe71fb..e4730410db 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/TestEngine.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/TestEngine.cs @@ -5,6 +5,7 @@ namespace Microsoft.VisualStudio.TestPlatform.CrossPlatEngine { using System; using System.Collections.Generic; + using System.Globalization; using System.Linq; using Microsoft.VisualStudio.TestPlatform.Common; @@ -217,7 +218,6 @@ public IProxyExecutionManager GetExecutionManager( /// public IProxyTestSessionManager GetTestSessionManager( IRequestData requestData, - ITestRuntimeProvider testHostManager, StartTestSessionCriteria testSessionCriteria) { var parallelLevel = this.VerifyParallelSettingAndCalculateParallelLevel( @@ -245,8 +245,15 @@ public IProxyTestSessionManager GetTestSessionManager( Func proxyCreator = () => { var hostManager = this.testHostProviderManager.GetTestHostManagerByRunConfiguration(testSessionCriteria.RunSettings); - hostManager?.Initialize(TestSessionMessageLogger.Instance, testSessionCriteria.RunSettings); + if (hostManager == null) + { + throw new TestPlatformException( + string.Format( + CultureInfo.CurrentCulture, + Resources.Resources.NoTestHostProviderFound)); + } + hostManager.Initialize(TestSessionMessageLogger.Instance, testSessionCriteria.RunSettings); if (testSessionCriteria.TestHostLauncher != null) { hostManager.SetCustomLauncher(testSessionCriteria.TestHostLauncher); @@ -257,7 +264,6 @@ public IProxyTestSessionManager GetTestSessionManager( CloseConnectionOnOperationComplete = false }; - return isDataCollectorEnabled ? new ProxyOperationManagerWithDataCollection( requestData, @@ -267,10 +273,16 @@ public IProxyTestSessionManager GetTestSessionManager( requestData, testSessionCriteria.RunSettings, testSessionCriteria.Sources)) + { + CloseRequestSenderChannelOnProxyClose = true + } : new ProxyOperationManager( requestData, requestSender, - hostManager); + hostManager) + { + CloseRequestSenderChannelOnProxyClose = true + }; }; return new ProxyTestSessionManager(parallelLevel, proxyCreator); diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/TestSession/ProxyTestSessionManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/TestSession/ProxyTestSessionManager.cs index 6f4c3648c8..35f4bc72b4 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/TestSession/ProxyTestSessionManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/TestSession/ProxyTestSessionManager.cs @@ -9,6 +9,7 @@ namespace Microsoft.VisualStudio.TestPlatform.CrossPlatEngine using System.Threading.Tasks; using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client; + using Microsoft.VisualStudio.TestPlatform.ObjectModel; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Engine; @@ -60,17 +61,34 @@ public void StartSession( { taskList[i] = Task.Factory.StartNew(() => { - // Create the proxy. - var operationManagerProxy = this.CreateProxy(); - - // Initialize the proxy. - operationManagerProxy.Initialize(this.skipDefaultAdapters); - - // Start the test host associated to the proxy. - operationManagerProxy.SetupChannel( - criteria.Sources, - criteria.RunSettings, - eventsHandler); + try + { + // Create and cache the proxy. + var operationManagerProxy = this.proxyCreator(); + + // Initialize the proxy. + operationManagerProxy.Initialize(this.skipDefaultAdapters); + + // Start the test host associated to the proxy. + operationManagerProxy.SetupChannel( + criteria.Sources, + criteria.RunSettings, + eventsHandler); + + this.EnqueueNewProxy(operationManagerProxy); + } + catch (Exception ex) + { + // Log & silently eat up the exception. It's a valid course of action to + // just forfeit proxy creation. This means that anyone wishing to get a + // proxy operation manager would have to create their own, on the spot, + // instead of getting one already created, and this case is handled + // gracefully already. + EqtTrace.Error( + "ProxyTestSessionManager.StartSession: Cannot create proxy. Error: {0}", + ex.ToString()); + return; + } }); } @@ -175,21 +193,20 @@ public void EnqueueProxy(Guid proxyId) } } - private ProxyOperationManager CreateProxy() + private void EnqueueNewProxy(ProxyOperationManager operationManagerProxy) { - // Invoke the proxy creator. - var proxy = this.proxyCreator(); - lock (this.lockObject) { // Add the proxy to the map. - this.proxyMap.Add(proxy.Id, new ProxyOperationManagerContainer(proxy, available: true)); + this.proxyMap.Add( + operationManagerProxy.Id, + new ProxyOperationManagerContainer( + operationManagerProxy, + available: true)); // Enqueue the proxy id in the available queue. - this.availableProxyQueue.Enqueue(proxy.Id); + this.availableProxyQueue.Enqueue(operationManagerProxy.Id); } - - return proxy; } } From bd267b727fa335d05387ad854bd7a08a657f1162 Mon Sep 17 00:00:00 2001 From: Codrin Poienaru Date: Fri, 15 Jan 2021 10:42:51 +0100 Subject: [PATCH 05/26] Fixed not logging test platform event source when request is successful --- .../VsTestConsoleRequestSender.cs | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleRequestSender.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleRequestSender.cs index 514ae54a9e..fb4e0cc7bc 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleRequestSender.cs +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleRequestSender.cs @@ -538,8 +538,11 @@ public TestSessionInfo StartTestSession( eventsHandler?.HandleStartTestSessionComplete(null); } + finally + { + this.testPlatformEventSource.TranslationLayerStartTestSessionStop(); + } - this.testPlatformEventSource.TranslationLayerStartTestSessionStop(); return null; } @@ -636,8 +639,11 @@ public async Task StartTestSessionAsync( eventsHandler?.HandleStartTestSessionComplete(null); } + finally + { + this.testPlatformEventSource.TranslationLayerStartTestSessionStop(); + } - this.testPlatformEventSource.TranslationLayerStartTestSessionStop(); return null; } @@ -664,7 +670,7 @@ public bool StopTestSession( // after doing the start test session call. However, we should filter out requests // to stop such a session as soon as possible, at the request sender level. // - // We do this here instead of on the wrapper level in order to benefit of the + // We do this here instead of on the wrapper level in order to benefit from the // testplatform events being fired still. if (testSessionInfo == null) { @@ -718,8 +724,11 @@ public bool StopTestSession( eventsHandler?.HandleStopTestSessionComplete(testSessionInfo, false); } + finally + { + this.testPlatformEventSource.TranslationLayerStopTestSessionStop(); + } - this.testPlatformEventSource.TranslationLayerStopTestSessionStop(); return false; } @@ -746,7 +755,7 @@ public async Task StopTestSessionAsync( // after doing the start test session call. However, we should filter out requests // to stop such a session as soon as possible, at the request sender level. // - // We do this here instead of on the wrapper level in order to benefit of the + // We do this here instead of on the wrapper level in order to benefit from the // testplatform events being fired still. if (testSessionInfo == null) { @@ -800,8 +809,11 @@ public async Task StopTestSessionAsync( eventsHandler?.HandleStopTestSessionComplete(testSessionInfo, false); } + finally + { + this.testPlatformEventSource.TranslationLayerStopTestSessionStop(); + } - this.testPlatformEventSource.TranslationLayerStopTestSessionStop(); return false; } From 80059ae2d82ac819651533b3b25db3a2fc6af048 Mon Sep 17 00:00:00 2001 From: Codrin Poienaru Date: Mon, 18 Jan 2021 14:53:50 +0100 Subject: [PATCH 06/26] Added logic to avoid testhost cleanup --- .../Client/ProxyOperationManager.cs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyOperationManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyOperationManager.cs index 048617b0b6..0d906b9a7a 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyOperationManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyOperationManager.cs @@ -341,15 +341,19 @@ public virtual void Close() } finally { - this.initialized = false; + // Should only cleanup the testhost if we're in compatibility mode. + if (this.CloseRequestSenderChannelOnProxyClose) + { + this.initialized = false; - EqtTrace.Warning("ProxyOperationManager: Timed out waiting for test host to exit. Will terminate process."); + EqtTrace.Warning("ProxyOperationManager: Timed out waiting for test host to exit. Will terminate process."); - // Please clean up test host. - this.TestHostManager.CleanTestHostAsync(CancellationToken.None).Wait(); + // Please clean up test host. + this.TestHostManager.CleanTestHostAsync(CancellationToken.None).Wait(); - this.TestHostManager.HostExited -= this.TestHostManagerHostExited; - this.TestHostManager.HostLaunched -= this.TestHostManagerHostLaunched; + this.TestHostManager.HostExited -= this.TestHostManagerHostExited; + this.TestHostManager.HostLaunched -= this.TestHostManagerHostLaunched; + } } } From 809d6f49fc9373c9d637e8ba67bbbc1b640d72a5 Mon Sep 17 00:00:00 2001 From: Codrin Poienaru Date: Tue, 19 Jan 2021 15:47:58 +0100 Subject: [PATCH 07/26] Using console wrapper instead of test session --- .../Interfaces/ITestSession.cs | 180 ------- .../Interfaces/ITestSessionAsync.cs | 182 ------- .../Interfaces/IVsTestConsoleWrapper.cs | 197 ++----- .../Interfaces/IVsTestConsoleWrapperAsync.cs | 187 ++----- .../TestSession.cs | 373 ------------- .../VsTestConsoleRequestSender.cs | 24 +- .../VsTestConsoleWrapper.cs | 505 +++++++----------- 7 files changed, 297 insertions(+), 1351 deletions(-) delete mode 100644 src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSession.cs delete mode 100644 src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSessionAsync.cs delete mode 100644 src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/TestSession.cs diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSession.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSession.cs deleted file mode 100644 index 206c3aa009..0000000000 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSession.cs +++ /dev/null @@ -1,180 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -namespace Microsoft.VisualStudio.TestPlatform.VsTestConsole.TranslationLayer.Interfaces -{ - using System.Collections.Generic; - - using Microsoft.VisualStudio.TestPlatform.ObjectModel; - using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client; - using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.Interfaces; - - /// - /// Defines a test session that can be used to make calls to the vstest.console - /// process. - /// - public interface ITestSession : ITestSessionAsync - { - /// - /// Starts test discovery. - /// - /// - /// The list of source assemblies for the discovery. - /// The run settings for the discovery. - /// The discovery event handler. - void DiscoverTests( - IEnumerable sources, - string discoverySettings, - ITestDiscoveryEventsHandler discoveryEventsHandler); - - /// - /// Starts test discovery. - /// - /// - /// The list of source assemblies for the discovery. - /// The run settings for the discovery. - /// The test platform options. - /// The discovery event handler. - void DiscoverTests( - IEnumerable sources, - string discoverySettings, - TestPlatformOptions options, - ITestDiscoveryEventsHandler2 discoveryEventsHandler); - - /// - /// Cancels the last discovery request. - /// - new void CancelDiscovery(); - - /// - /// Starts a test run. - /// - /// - /// The list of source assemblies for the test run. - /// The run settings for the run. - /// The run event handler. - void RunTests( - IEnumerable sources, - string runSettings, - 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. - void RunTests( - IEnumerable sources, - string runSettings, - TestPlatformOptions options, - ITestRunEventsHandler testRunEventsHandler); - - /// - /// Starts a test run. - /// - /// - /// The list of test cases for the test run. - /// The run settings for the run. - /// The run event handler. - void RunTests( - IEnumerable testCases, - string runSettings, - 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. - void RunTests( - IEnumerable testCases, - string runSettings, - TestPlatformOptions options, - ITestRunEventsHandler testRunEventsHandler); - - /// - /// 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); - - /// - /// 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); - - /// - /// 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 custom host launcher. - void RunTestsWithCustomTestHost( - IEnumerable testCases, - string runSettings, - TestPlatformOptions options, - ITestRunEventsHandler testRunEventsHandler, - ITestHostLauncher customTestHostLauncher); - - /// - /// Stops the test session. - /// - /// - /// The session event handler. - /// - /// True if the session was successfuly stopped, false otherwise. - bool StopTestSession(ITestSessionEventsHandler eventsHandler); - - /// - /// Cancels the last test run. - /// - new void CancelTestRun(); - - /// - /// Aborts the last test run. - /// - new void AbortTestRun(); - } -} diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSessionAsync.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSessionAsync.cs deleted file mode 100644 index 9c2aff1496..0000000000 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSessionAsync.cs +++ /dev/null @@ -1,182 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -namespace Microsoft.VisualStudio.TestPlatform.VsTestConsole.TranslationLayer.Interfaces -{ - using System.Collections.Generic; - using System.Threading.Tasks; - using Microsoft.VisualStudio.TestPlatform.ObjectModel; - using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client; - using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.Interfaces; - - /// - /// Defines a test session that can be used to make async calls to the vstest.console - /// process. - /// - public interface ITestSessionAsync - { - /// - /// Starts test discovery. - /// - /// - /// The list of source assemblies for the discovery. - /// The run settings for the discovery. - /// The discovery event handler. - /// - Task DiscoverTestsAsync( - IEnumerable sources, - string discoverySettings, - ITestDiscoveryEventsHandler discoveryEventsHandler); - - /// - /// Starts test discovery. - /// - /// - /// The list of source assemblies for the discovery. - /// The run settings for the discovery. - /// The test platform options. - /// The discovery event handler. - Task DiscoverTestsAsync( - IEnumerable sources, - string discoverySettings, - TestPlatformOptions options, - ITestDiscoveryEventsHandler2 discoveryEventsHandler); - - /// - /// Cancels the last discovery request. - /// - void CancelDiscovery(); - - /// - /// Starts a test run. - /// - /// - /// The list of source assemblies for the test run. - /// The run settings for the run. - /// The run event handler. - Task RunTestsAsync( - IEnumerable sources, - string runSettings, - 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. - Task RunTestsAsync( - IEnumerable sources, - string runSettings, - TestPlatformOptions options, - ITestRunEventsHandler testRunEventsHandler); - - /// - /// Starts a test run. - /// - /// - /// The list of test cases for the test run. - /// The run settings for the run. - /// The run event handler. - Task RunTestsAsync( - IEnumerable testCases, - string runSettings, - 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. - Task RunTestsAsync( - IEnumerable testCases, - string runSettings, - TestPlatformOptions options, - ITestRunEventsHandler testRunEventsHandler); - - /// - /// 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. - 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. - Task RunTestsWithCustomTestHostAsync( - IEnumerable sources, - string runSettings, - TestPlatformOptions options, - ITestRunEventsHandler testRunEventsHandler, - 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. - Task RunTestsWithCustomTestHostAsync( - IEnumerable testCases, - string runSettings, - ITestRunEventsHandler testRunEventsHandler, - ITestHostLauncher customTestHostLauncher); - - /// - /// 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 custom host launcher. - Task RunTestsWithCustomTestHostAsync( - IEnumerable testCases, - string runSettings, - TestPlatformOptions options, - ITestRunEventsHandler testRunEventsHandler, - ITestHostLauncher customTestHostLauncher); - - /// - /// Stops the test session. - /// - /// - /// The session event handler. - /// - /// True if the session was successfuly stopped, false otherwise. - Task StopTestSessionAsync( - ITestSessionEventsHandler eventsHandler); - - /// - /// Cancels the last test run. - /// - void CancelTestRun(); - - /// - /// Aborts the last test run. - /// - void AbortTestRun(); - } -} diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/IVsTestConsoleWrapper.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/IVsTestConsoleWrapper.cs index d3ea821e1e..193cac1cc2 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/IVsTestConsoleWrapper.cs +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/IVsTestConsoleWrapper.cs @@ -7,7 +7,6 @@ namespace Microsoft.TestPlatform.VsTestConsole.TranslationLayer.Interfaces using Microsoft.VisualStudio.TestPlatform.ObjectModel; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.Interfaces; - using Microsoft.VisualStudio.TestPlatform.VsTestConsole.TranslationLayer.Interfaces; /// /// Controller for various test operations on the test runner. @@ -19,6 +18,58 @@ public interface IVsTestConsoleWrapper : IVsTestConsoleWrapperAsync /// void StartSession(); + /// + /// Starts a new test session. + /// + /// + /// The list of source assemblies for the test run. + /// The run settings for the run. + /// The session event handler. + void StartTestSession( + IList sources, + string runSettings, + ITestSessionEventsHandler eventsHandler); + + /// + /// Starts a new test session. + /// + /// + /// The list of source assemblies for the test run. + /// The run settings for the run. + /// The test platform options. + /// The session event handler. + void StartTestSession( + IList sources, + string runSettings, + TestPlatformOptions options, + ITestSessionEventsHandler eventsHandler); + + /// + /// Starts a new test session. + /// + /// + /// The list of source assemblies for the test run. + /// The run settings for the run. + /// The test platform options. + /// The session event handler. + /// The custom host launcher. + void StartTestSession( + IList sources, + string runSettings, + TestPlatformOptions options, + ITestSessionEventsHandler eventsHandler, + ITestHostLauncher testHostLauncher); + + /// + /// Stops the test session. + /// + /// + /// The session event handler. + /// + /// True if the session was successfuly stopped, false otherwise. + bool StopTestSession( + ITestSessionEventsHandler eventsHandler); + /// /// Initializes the test platform with paths to extensions like adapters, loggers and any /// other extensions. @@ -53,22 +104,6 @@ void DiscoverTests( TestPlatformOptions options, ITestDiscoveryEventsHandler2 discoveryEventsHandler); - /// - /// Starts test discovery. - /// - /// - /// The list of source assemblies for the discovery. - /// The run settings for the discovery. - /// The test platform options. - /// The test session info object. - /// The discovery event handler. - void DiscoverTests( - IEnumerable sources, - string discoverySettings, - TestPlatformOptions options, - TestSessionInfo testSessionInfo, - ITestDiscoveryEventsHandler2 discoveryEventsHandler); - /// /// Cancels the last discovery request. /// @@ -100,22 +135,6 @@ void RunTests( 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 test session info object. - /// The run event handler. - void RunTests( - IEnumerable sources, - string runSettings, - TestPlatformOptions options, - TestSessionInfo testSessionInfo, - ITestRunEventsHandler testRunEventsHandler); - /// /// Starts a test run. /// @@ -142,49 +161,17 @@ void RunTests( 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 test session info object. - /// The run event handler. - void RunTests( - IEnumerable testCases, - string runSettings, - TestPlatformOptions options, - TestSessionInfo testSessionInfo, - ITestRunEventsHandler testRunEventsHandler); - - /// - /// 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); @@ -195,28 +182,12 @@ void RunTestsWithCustomTestHost( /// 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); - - /// - /// 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); @@ -226,13 +197,11 @@ void RunTestsWithCustomTestHost( /// /// 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); @@ -243,77 +212,15 @@ void RunTestsWithCustomTestHost( /// 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); - /// - /// Starts a new test session. - /// - /// - /// The list of source assemblies for the test run. - /// The run settings for the run. - /// The session event handler. - /// - /// A test session info object. - ITestSession StartTestSession( - IList sources, - string runSettings, - ITestSessionEventsHandler eventsHandler); - - /// - /// Starts a new test session. - /// - /// - /// The list of source assemblies for the test run. - /// The run settings for the run. - /// The test platform options. - /// The session event handler. - /// - /// A test session info object. - ITestSession StartTestSession( - IList sources, - string runSettings, - TestPlatformOptions options, - ITestSessionEventsHandler eventsHandler); - - /// - /// Starts a new test session. - /// - /// - /// The list of source assemblies for the test run. - /// The run settings for the run. - /// The test platform options. - /// The session event handler. - /// The custom host launcher. - /// - /// A test session info object. - ITestSession StartTestSession( - IList sources, - string runSettings, - TestPlatformOptions options, - ITestSessionEventsHandler eventsHandler, - ITestHostLauncher testHostLauncher); - - /// - /// Stops the test session. - /// - /// - /// The test session info object. - /// The session event handler. - /// - /// True if the session was successfuly stopped, false otherwise. - bool StopTestSession( - TestSessionInfo testSessionInfo, - ITestSessionEventsHandler eventsHandler); - /// /// Cancels the last test run. /// diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/IVsTestConsoleWrapperAsync.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/IVsTestConsoleWrapperAsync.cs index 136e6eec84..389d23c04d 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/IVsTestConsoleWrapperAsync.cs +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/IVsTestConsoleWrapperAsync.cs @@ -10,7 +10,6 @@ namespace Microsoft.TestPlatform.VsTestConsole.TranslationLayer.Interfaces using Microsoft.VisualStudio.TestPlatform.ObjectModel; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.Interfaces; - using Microsoft.VisualStudio.TestPlatform.VsTestConsole.TranslationLayer.Interfaces; /// /// Asynchronous equivalent of . @@ -24,36 +23,72 @@ public interface IVsTestConsoleWrapperAsync /// /// Asynchronous equivalent of . + /// IVsTestConsoleWrapper.StartTestSession( + /// IList{string}, + /// string, + /// ITestSessionEventsHandler)"/>. /// - Task InitializeExtensionsAsync(IEnumerable pathToAdditionalExtensions); + Task StartTestSessionAsync( + IList sources, + string runSettings, + ITestSessionEventsHandler eventsHandler); /// /// Asynchronous equivalent of . + /// TestPlatformOptions, + /// ITestSessionEventsHandler)"/>. /// - Task DiscoverTestsAsync( - IEnumerable sources, - string discoverySettings, - ITestDiscoveryEventsHandler discoveryEventsHandler); + Task StartTestSessionAsync( + IList sources, + string runSettings, + TestPlatformOptions options, + ITestSessionEventsHandler eventsHandler); + + /// + /// Asynchronous equivalent of . + /// + Task StartTestSessionAsync( + IList sources, + string runSettings, + TestPlatformOptions options, + ITestSessionEventsHandler eventsHandler, + ITestHostLauncher testHostLauncher); + + /// + /// Asynchronous equivalent of . + /// + Task StopTestSessionAsync( + ITestSessionEventsHandler eventsHandler); + + /// + /// Asynchronous equivalent of . + /// + Task InitializeExtensionsAsync(IEnumerable pathToAdditionalExtensions); /// /// Asynchronous equivalent of . + /// ITestDiscoveryEventsHandler)"/>. /// Task DiscoverTestsAsync( IEnumerable sources, string discoverySettings, - TestPlatformOptions options, - ITestDiscoveryEventsHandler2 discoveryEventsHandler); + ITestDiscoveryEventsHandler discoveryEventsHandler); /// /// Asynchronous equivalent of . /// Task DiscoverTestsAsync( IEnumerable sources, string discoverySettings, TestPlatformOptions options, - TestSessionInfo testSessionInfo, ITestDiscoveryEventsHandler2 discoveryEventsHandler); /// @@ -105,43 +138,13 @@ Task RunTestsAsync( /// /// Asynchronous equivalent of . - /// - Task RunTestsAsync( - IEnumerable sources, - string runSettings, - TestPlatformOptions options, - TestSessionInfo testSessionInfo, - ITestRunEventsHandler testRunEventsHandler); - - /// - /// Asynchronous equivalent of . - /// - Task RunTestsAsync( - IEnumerable testCases, - string runSettings, - ITestRunEventsHandler testRunEventsHandler); - - /// - /// Asynchronous equivalent of . /// Task RunTestsAsync( IEnumerable testCases, string runSettings, - TestPlatformOptions options, ITestRunEventsHandler testRunEventsHandler); /// @@ -150,14 +153,12 @@ Task RunTestsAsync( /// IEnumerable{TestCase}, /// string, /// TestPlatformOptions, - /// TestSessionInfo, /// ITestRunEventsHandler)"/>. /// Task RunTestsAsync( IEnumerable testCases, string runSettings, TestPlatformOptions options, - TestSessionInfo testSessionInfo, ITestRunEventsHandler testRunEventsHandler); /// @@ -190,24 +191,6 @@ Task RunTestsWithCustomTestHostAsync( ITestRunEventsHandler testRunEventsHandler, ITestHostLauncher customTestHostLauncher); - /// - /// Asynchronous equivalent of . - /// - Task RunTestsWithCustomTestHostAsync( - IEnumerable sources, - string runSettings, - TestPlatformOptions options, - TestSessionInfo testSessionInfo, - ITestRunEventsHandler testRunEventsHandler, - ITestHostLauncher customTestHostLauncher); - /// /// Asynchronous equivalent of . - /// - Task RunTestsWithCustomTestHostAsync( - IEnumerable testCases, - string runSettings, - TestPlatformOptions options, - TestSessionInfo testSessionInfo, - ITestRunEventsHandler testRunEventsHandler, - ITestHostLauncher customTestHostLauncher); - - /// - /// Asynchronous equivalent of . - /// - Task StartTestSessionAsync( - IList sources, - string runSettings, - ITestSessionEventsHandler eventsHandler); - - /// - /// Asynchronous equivalent of . - /// - Task StartTestSessionAsync( - IList sources, - string runSettings, - TestPlatformOptions options, - ITestSessionEventsHandler eventsHandler); - - /// - /// Asynchronous equivalent of . - /// - Task StartTestSessionAsync( - IList sources, - string runSettings, - TestPlatformOptions options, - ITestSessionEventsHandler eventsHandler, - ITestHostLauncher testHostLauncher); - - /// - /// Asynchronous equivalent of . - /// - Task StopTestSessionAsync( - TestSessionInfo testSessionInfo, - ITestSessionEventsHandler eventsHandler); - /// /// See . /// diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/TestSession.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/TestSession.cs deleted file mode 100644 index 40fb329639..0000000000 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/TestSession.cs +++ /dev/null @@ -1,373 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -namespace Microsoft.TestPlatform.VsTestConsole.TranslationLayer -{ - using System.Collections.Generic; - using System.Threading.Tasks; - - using Microsoft.VisualStudio.TestPlatform.ObjectModel; - using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client; - using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.Interfaces; - using Microsoft.VisualStudio.TestPlatform.VsTestConsole.TranslationLayer.Interfaces; - - /// - /// Defines a test session object that can be used to make calls to the vstest.console - /// process. - /// - public class TestSession : ITestSession - { - private TestSessionInfo testSessionInfo; - private VsTestConsoleWrapper consoleWrapper; - - #region Constructors - /// - /// Initializes a new instance of the class. - /// - /// - /// The test session info object. - /// The encapsulated console wrapper. - public TestSession( - TestSessionInfo testSessionInfo, - VsTestConsoleWrapper consoleWrapper) - { - this.testSessionInfo = testSessionInfo; - this.consoleWrapper = consoleWrapper; - } - #endregion - - #region ITestSession - /// - public void AbortTestRun() - { - this.consoleWrapper.AbortTestRun(); - } - - /// - public void CancelDiscovery() - { - this.consoleWrapper.CancelDiscovery(); - } - - /// - public void CancelTestRun() - { - this.consoleWrapper.CancelTestRun(); - } - - /// - public void DiscoverTests( - IEnumerable sources, - string discoverySettings, - ITestDiscoveryEventsHandler discoveryEventsHandler) - { - this.DiscoverTests( - sources, - discoverySettings, - options: null, - discoveryEventsHandler: new DiscoveryEventsHandleConverter(discoveryEventsHandler)); - } - - /// - public void DiscoverTests( - IEnumerable sources, - string discoverySettings, - TestPlatformOptions options, - ITestDiscoveryEventsHandler2 discoveryEventsHandler) - { - this.consoleWrapper.DiscoverTests( - sources, - discoverySettings, - options, - this.testSessionInfo, - discoveryEventsHandler); - } - - /// - public void RunTests( - IEnumerable sources, - string runSettings, - ITestRunEventsHandler testRunEventsHandler) - { - this.RunTests( - sources, - runSettings, - options: null, - testRunEventsHandler); - } - - /// - public void RunTests( - IEnumerable sources, - string runSettings, - TestPlatformOptions options, - ITestRunEventsHandler testRunEventsHandler) - { - this.consoleWrapper.RunTests( - sources, - runSettings, - options, - this.testSessionInfo, - testRunEventsHandler); - } - - /// - public void RunTests( - IEnumerable testCases, - string runSettings, - ITestRunEventsHandler testRunEventsHandler) - { - this.RunTests( - testCases, - runSettings, - options: null, - testRunEventsHandler); - } - - /// - public void RunTests( - IEnumerable testCases, - string runSettings, - TestPlatformOptions options, - ITestRunEventsHandler testRunEventsHandler) - { - this.consoleWrapper.RunTests( - testCases, - runSettings, - options, - this.testSessionInfo, - testRunEventsHandler); - } - - /// - public void RunTestsWithCustomTestHost( - IEnumerable sources, - string runSettings, - ITestRunEventsHandler testRunEventsHandler, - ITestHostLauncher customTestHostLauncher) - { - this.RunTestsWithCustomTestHost( - sources, - runSettings, - options: null, - testRunEventsHandler, - customTestHostLauncher); - } - - /// - public void RunTestsWithCustomTestHost( - IEnumerable sources, - string runSettings, - TestPlatformOptions options, - ITestRunEventsHandler testRunEventsHandler, - ITestHostLauncher customTestHostLauncher) - { - this.consoleWrapper.RunTestsWithCustomTestHost( - sources, - runSettings, - options, - this.testSessionInfo, - testRunEventsHandler, - customTestHostLauncher); - } - - /// - public void RunTestsWithCustomTestHost( - IEnumerable testCases, - string runSettings, - ITestRunEventsHandler testRunEventsHandler, - ITestHostLauncher customTestHostLauncher) - { - this.RunTestsWithCustomTestHost( - testCases, - runSettings, - options: null, - testRunEventsHandler, - customTestHostLauncher); - } - - /// - public void RunTestsWithCustomTestHost( - IEnumerable testCases, - string runSettings, - TestPlatformOptions options, - ITestRunEventsHandler testRunEventsHandler, - ITestHostLauncher customTestHostLauncher) - { - this.consoleWrapper.RunTestsWithCustomTestHost( - testCases, - runSettings, - options, - this.testSessionInfo, - testRunEventsHandler, - customTestHostLauncher); - } - - /// - public bool StopTestSession(ITestSessionEventsHandler eventsHandler) - { - return this.consoleWrapper.StopTestSession( - this.testSessionInfo, - eventsHandler); - } - #endregion - - #region ITestSessionAsync - /// - public async Task DiscoverTestsAsync( - IEnumerable sources, - string discoverySettings, - ITestDiscoveryEventsHandler discoveryEventsHandler) - { - await this.DiscoverTestsAsync( - sources, - discoverySettings, - options: null, - discoveryEventsHandler: new DiscoveryEventsHandleConverter(discoveryEventsHandler)); - } - - /// - public async Task DiscoverTestsAsync( - IEnumerable sources, - string discoverySettings, - TestPlatformOptions options, - ITestDiscoveryEventsHandler2 discoveryEventsHandler) - { - await this.consoleWrapper.DiscoverTestsAsync( - sources, - discoverySettings, - options, - this.testSessionInfo, - discoveryEventsHandler); - } - - /// - public async Task RunTestsAsync( - IEnumerable sources, - string runSettings, - ITestRunEventsHandler testRunEventsHandler) - { - await this.RunTestsAsync( - sources, - runSettings, - options: null, - testRunEventsHandler); - } - - /// - public async Task RunTestsAsync( - IEnumerable sources, - string runSettings, - TestPlatformOptions options, - ITestRunEventsHandler testRunEventsHandler) - { - await this.consoleWrapper.RunTestsAsync( - sources, - runSettings, - options, - this.testSessionInfo, - testRunEventsHandler); - } - - /// - public async Task RunTestsAsync( - IEnumerable testCases, - string runSettings, - ITestRunEventsHandler testRunEventsHandler) - { - await this.RunTestsAsync( - testCases, - runSettings, - options: null, - testRunEventsHandler); - } - - /// - public async Task RunTestsAsync( - IEnumerable testCases, - string runSettings, - TestPlatformOptions options, - ITestRunEventsHandler testRunEventsHandler) - { - await this.consoleWrapper.RunTestsAsync( - testCases, - runSettings, - options, - this.testSessionInfo, - testRunEventsHandler); - } - - /// - public async Task RunTestsWithCustomTestHostAsync( - IEnumerable sources, - string runSettings, - ITestRunEventsHandler testRunEventsHandler, - ITestHostLauncher customTestHostLauncher) - { - await this.RunTestsWithCustomTestHostAsync( - sources, - runSettings, - options: null, - testRunEventsHandler, - customTestHostLauncher); - } - - /// - public async Task RunTestsWithCustomTestHostAsync( - IEnumerable sources, - string runSettings, - TestPlatformOptions options, - ITestRunEventsHandler testRunEventsHandler, - ITestHostLauncher customTestHostLauncher) - { - await this.consoleWrapper.RunTestsWithCustomTestHostAsync( - sources, - runSettings, - options, - this.testSessionInfo, - testRunEventsHandler, - customTestHostLauncher); - } - - /// - public async Task RunTestsWithCustomTestHostAsync( - IEnumerable testCases, - string runSettings, - ITestRunEventsHandler testRunEventsHandler, - ITestHostLauncher customTestHostLauncher) - { - await this.RunTestsWithCustomTestHostAsync( - testCases, - runSettings, - options: null, - testRunEventsHandler, - customTestHostLauncher); - } - - /// - public async Task RunTestsWithCustomTestHostAsync( - IEnumerable testCases, - string runSettings, - TestPlatformOptions options, - ITestRunEventsHandler testRunEventsHandler, - ITestHostLauncher customTestHostLauncher) - { - await this.consoleWrapper.RunTestsWithCustomTestHostAsync( - testCases, - runSettings, - options, - this.testSessionInfo, - testRunEventsHandler, - customTestHostLauncher); - } - - /// - public async Task StopTestSessionAsync(ITestSessionEventsHandler eventsHandler) - { - return await this.consoleWrapper.StopTestSessionAsync( - this.testSessionInfo, - eventsHandler); - } - #endregion - } -} diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleRequestSender.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleRequestSender.cs index fb4e0cc7bc..74a627ce8a 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleRequestSender.cs +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleRequestSender.cs @@ -148,9 +148,9 @@ public async Task InitializeCommunicationAsync(int clientConnectionTimeout) port = this.communicationManager.HostServer(new IPEndPoint(IPAddress.Loopback, 0)).Port; var timeoutSource = new CancellationTokenSource(clientConnectionTimeout); await Task.Run(() => - this.communicationManager.AcceptClientAsync(), timeoutSource.Token); + this.communicationManager.AcceptClientAsync(), timeoutSource.Token).ConfigureAwait(false); - this.handShakeSuccessful = await this.HandShakeWithVsTestConsoleAsync(); + this.handShakeSuccessful = await this.HandShakeWithVsTestConsoleAsync().ConfigureAwait(false); this.handShakeComplete.Set(); } catch (Exception ex) @@ -222,7 +222,7 @@ await this.SendMessageAndListenAndReportTestCasesAsync( runSettings, options, testSessionInfo, - eventHandler); + eventHandler).ConfigureAwait(false); } /// @@ -274,7 +274,7 @@ await this.SendMessageAndListenAndReportTestResultsAsync( TestSessionInfo = testSessionInfo }, runEventsHandler, - null); + null).ConfigureAwait(false); } /// @@ -326,7 +326,7 @@ await this.SendMessageAndListenAndReportTestResultsAsync( TestSessionInfo = testSessionInfo }, runEventsHandler, - null); + null).ConfigureAwait(false); } /// @@ -382,7 +382,7 @@ await this.SendMessageAndListenAndReportTestResultsAsync( TestSessionInfo = testSessionInfo }, runEventsHandler, - customHostLauncher); + customHostLauncher).ConfigureAwait(false); } /// @@ -438,7 +438,7 @@ await this.SendMessageAndListenAndReportTestResultsAsync( TestSessionInfo = testSessionInfo }, runEventsHandler, - customHostLauncher); + customHostLauncher).ConfigureAwait(false); } /// @@ -936,7 +936,7 @@ private async Task HandShakeWithVsTestConsoleAsync() { var success = false; var message = await this.communicationManager.ReceiveMessageAsync( - this.processExitCancellationTokenSource.Token); + this.processExitCancellationTokenSource.Token).ConfigureAwait(false); if (message.MessageType == MessageType.SessionConnected) { @@ -945,7 +945,7 @@ private async Task HandShakeWithVsTestConsoleAsync() this.protocolVersion); message = await this.communicationManager.ReceiveMessageAsync( - this.processExitCancellationTokenSource.Token); + this.processExitCancellationTokenSource.Token).ConfigureAwait(false); if (message.MessageType == MessageType.VersionCheck) { @@ -1094,7 +1094,7 @@ private async Task SendMessageAndListenAndReportTestCasesAsync( // This is just a notification. while (!isDiscoveryComplete) { - var message = await this.TryReceiveMessageAsync(); + var message = await this.TryReceiveMessageAsync().ConfigureAwait(false); if (string.Equals(MessageType.TestCasesFound, message.MessageType)) { @@ -1260,7 +1260,7 @@ private async Task SendMessageAndListenAndReportTestResultsAsync( // This is just a notification. while (!isTestRunComplete) { - var message = await this.TryReceiveMessageAsync(); + var message = await this.TryReceiveMessageAsync().ConfigureAwait(false); if (string.Equals(MessageType.TestRunStatsChange, message.MessageType)) { @@ -1442,7 +1442,7 @@ private Message TryReceiveMessage() private async Task TryReceiveMessageAsync() { Message message = await this.communicationManager.ReceiveMessageAsync( - this.processExitCancellationTokenSource.Token); + this.processExitCancellationTokenSource.Token).ConfigureAwait(false); if (message == null) { diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleWrapper.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleWrapper.cs index 57538ec41e..aca97bbfd0 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleWrapper.cs +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleWrapper.cs @@ -19,7 +19,6 @@ namespace Microsoft.TestPlatform.VsTestConsole.TranslationLayer using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.Interfaces; using Microsoft.VisualStudio.TestPlatform.PlatformAbstractions; using Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces; - using Microsoft.VisualStudio.TestPlatform.VsTestConsole.TranslationLayer.Interfaces; using CommunicationUtilitiesResources = Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.Resources.Resources; using CoreUtilitiesConstants = Microsoft.VisualStudio.TestPlatform.CoreUtilities.Constants; @@ -52,6 +51,7 @@ public class VsTestConsoleWrapper : IVsTestConsoleWrapper private readonly ITestPlatformEventSource testPlatformEventSource; + private TestSessionInfo testSessionInfo = null; #endregion #region Constructor @@ -173,6 +173,82 @@ public void StartSession() } } + /// + public void StartTestSession( + IList sources, + string runSettings, + ITestSessionEventsHandler eventsHandler) + { + this.StartTestSession( + sources, + runSettings, + options: null, + eventsHandler); + } + + /// + public void StartTestSession( + IList sources, + string runSettings, + TestPlatformOptions options, + ITestSessionEventsHandler eventsHandler) + { + this.StartTestSession( + sources, + runSettings, + options, + eventsHandler, + testHostLauncher: null); + } + + /// + public void StartTestSession( + IList sources, + string runSettings, + TestPlatformOptions options, + ITestSessionEventsHandler eventsHandler, + ITestHostLauncher testHostLauncher) + { + if (this.testSessionInfo != null) + { + return; + } + + this.testPlatformEventSource.TranslationLayerStartTestSessionStart(); + + this.EnsureInitialized(); + this.testSessionInfo = this.requestSender.StartTestSession( + sources, + runSettings, + options, + eventsHandler, + testHostLauncher); + } + + /// + public bool StopTestSession( + ITestSessionEventsHandler eventsHandler) + { + if (this.testSessionInfo == null) + { + return true; + } + + this.testPlatformEventSource.TranslationLayerStopTestSessionStart(); + + this.EnsureInitialized(); + try + { + return this.requestSender.StopTestSession( + this.testSessionInfo, + eventsHandler); + } + finally + { + this.testSessionInfo = null; + } + } + /// public void InitializeExtensions(IEnumerable pathToAdditionalExtensions) { @@ -201,22 +277,6 @@ public void DiscoverTests( string discoverySettings, TestPlatformOptions options, ITestDiscoveryEventsHandler2 discoveryEventsHandler) - { - this.DiscoverTests( - sources, - discoverySettings, - options, - testSessionInfo: null, - discoveryEventsHandler); - } - - /// - public void DiscoverTests( - IEnumerable sources, - string discoverySettings, - TestPlatformOptions options, - TestSessionInfo testSessionInfo, - ITestDiscoveryEventsHandler2 discoveryEventsHandler) { this.testPlatformEventSource.TranslationLayerDiscoveryStart(); this.EnsureInitialized(); @@ -224,7 +284,7 @@ public void DiscoverTests( sources, discoverySettings, options, - testSessionInfo, + this.testSessionInfo, discoveryEventsHandler); } @@ -253,22 +313,6 @@ public void RunTests( string runSettings, TestPlatformOptions options, ITestRunEventsHandler testRunEventsHandler) - { - this.RunTests( - sources, - runSettings, - options, - testSessionInfo: null, - testRunEventsHandler: testRunEventsHandler); - } - - /// - public void RunTests( - IEnumerable sources, - string runSettings, - TestPlatformOptions options, - TestSessionInfo testSessionInfo, - ITestRunEventsHandler testRunEventsHandler) { var sourceList = sources.ToList(); this.testPlatformEventSource.TranslationLayerExecutionStart( @@ -282,7 +326,7 @@ public void RunTests( sourceList, runSettings, options, - testSessionInfo, + this.testSessionInfo, testRunEventsHandler); } @@ -305,22 +349,6 @@ public void RunTests( string runSettings, TestPlatformOptions options, ITestRunEventsHandler testRunEventsHandler) - { - this.RunTests( - testCases, - runSettings, - options, - testSessionInfo: null, - testRunEventsHandler); - } - - /// - public void RunTests( - IEnumerable testCases, - string runSettings, - TestPlatformOptions options, - TestSessionInfo testSessionInfo, - ITestRunEventsHandler testRunEventsHandler) { var testCaseList = testCases.ToList(); this.testPlatformEventSource.TranslationLayerExecutionStart( @@ -334,7 +362,7 @@ public void RunTests( testCaseList, runSettings, options, - testSessionInfo, + this.testSessionInfo, testRunEventsHandler); } @@ -360,24 +388,6 @@ public void RunTestsWithCustomTestHost( TestPlatformOptions options, ITestRunEventsHandler testRunEventsHandler, ITestHostLauncher customTestHostLauncher) - { - this.RunTestsWithCustomTestHost( - sources, - runSettings, - options, - testSessionInfo: null, - testRunEventsHandler: testRunEventsHandler, - customTestHostLauncher: customTestHostLauncher); - } - - /// - public void RunTestsWithCustomTestHost( - IEnumerable sources, - string runSettings, - TestPlatformOptions options, - TestSessionInfo testSessionInfo, - ITestRunEventsHandler testRunEventsHandler, - ITestHostLauncher customTestHostLauncher) { var sourceList = sources.ToList(); this.testPlatformEventSource.TranslationLayerExecutionStart( @@ -391,7 +401,7 @@ public void RunTestsWithCustomTestHost( sourceList, runSettings, options, - testSessionInfo, + this.testSessionInfo, testRunEventsHandler, customTestHostLauncher); } @@ -418,24 +428,6 @@ public void RunTestsWithCustomTestHost( TestPlatformOptions options, ITestRunEventsHandler testRunEventsHandler, ITestHostLauncher customTestHostLauncher) - { - this.RunTestsWithCustomTestHost( - testCases, - runSettings, - options, - testSessionInfo: null, - testRunEventsHandler, - customTestHostLauncher); - } - - /// - public void RunTestsWithCustomTestHost( - IEnumerable testCases, - string runSettings, - TestPlatformOptions options, - TestSessionInfo testSessionInfo, - ITestRunEventsHandler testRunEventsHandler, - ITestHostLauncher customTestHostLauncher) { var testCaseList = testCases.ToList(); this.testPlatformEventSource.TranslationLayerExecutionStart( @@ -449,73 +441,11 @@ public void RunTestsWithCustomTestHost( testCaseList, runSettings, options, - testSessionInfo, + this.testSessionInfo, testRunEventsHandler, customTestHostLauncher); } - /// - public ITestSession StartTestSession( - IList sources, - string runSettings, - ITestSessionEventsHandler eventsHandler) - { - return this.StartTestSession( - sources, - runSettings, - options: null, - eventsHandler); - } - - /// - public ITestSession StartTestSession( - IList sources, - string runSettings, - TestPlatformOptions options, - ITestSessionEventsHandler eventsHandler) - { - return this.StartTestSession( - sources, - runSettings, - options, - eventsHandler, - testHostLauncher: null); - } - - /// - public ITestSession StartTestSession( - IList sources, - string runSettings, - TestPlatformOptions options, - ITestSessionEventsHandler eventsHandler, - ITestHostLauncher testHostLauncher) - { - this.testPlatformEventSource.TranslationLayerStartTestSessionStart(); - - this.EnsureInitialized(); - return new TestSession( - this.requestSender.StartTestSession( - sources, - runSettings, - options, - eventsHandler, - testHostLauncher), - this); - } - - /// - public bool StopTestSession( - TestSessionInfo testSessionInfo, - ITestSessionEventsHandler eventsHandler) - { - this.testPlatformEventSource.TranslationLayerStopTestSessionStart(); - - this.EnsureInitialized(); - return this.requestSender.StopTestSession( - testSessionInfo, - eventsHandler); - } - /// public void CancelTestRun() { @@ -555,7 +485,7 @@ public async Task StartSessionAsync() var timeout = EnvironmentHelper.GetConnectionTimeout(); // Start communication - var port = await this.requestSender.InitializeCommunicationAsync(timeout * 1000); + var port = await this.requestSender.InitializeCommunicationAsync(timeout * 1000).ConfigureAwait(false); if (port > 0) { @@ -575,58 +505,119 @@ public async Task StartSessionAsync() } /// - public async Task InitializeExtensionsAsync(IEnumerable pathToAdditionalExtensions) + public async Task StartTestSessionAsync( + IList sources, + string runSettings, + ITestSessionEventsHandler eventsHandler) { - await this.EnsureInitializedAsync(); - this.pathToAdditionalExtensions = pathToAdditionalExtensions.ToList(); - this.requestSender.InitializeExtensions(this.pathToAdditionalExtensions); + await this.StartTestSessionAsync( + sources, + runSettings, + options: null, + eventsHandler).ConfigureAwait(false); } /// - public async Task DiscoverTestsAsync( - IEnumerable sources, - string discoverySettings, - ITestDiscoveryEventsHandler discoveryEventsHandler) + public async Task StartTestSessionAsync( + IList sources, + string runSettings, + TestPlatformOptions options, + ITestSessionEventsHandler eventsHandler) { - await this.DiscoverTestsAsync( + await this.StartTestSessionAsync( sources, - discoverySettings, + runSettings, options: null, - discoveryEventsHandler: new DiscoveryEventsHandleConverter(discoveryEventsHandler)); + eventsHandler, + testHostLauncher: null).ConfigureAwait(false); } + /// + public async Task StartTestSessionAsync( + IList sources, + string runSettings, + TestPlatformOptions options, + ITestSessionEventsHandler eventsHandler, + ITestHostLauncher testHostLauncher) + { + if (this.testSessionInfo != null) + { + return; + } + + this.testPlatformEventSource.TranslationLayerStartTestSessionStart(); + + await this.EnsureInitializedAsync().ConfigureAwait(false); + this.testSessionInfo = await this.requestSender.StartTestSessionAsync( + sources, + runSettings, + options, + eventsHandler, + testHostLauncher).ConfigureAwait(false); + } + + /// + public async Task StopTestSessionAsync( + ITestSessionEventsHandler eventsHandler) + { + if (this.testSessionInfo == null) + { + return true; + } + + this.testPlatformEventSource.TranslationLayerStopTestSessionStart(); + + await this.EnsureInitializedAsync().ConfigureAwait(false); + try + { + return await this.requestSender.StopTestSessionAsync( + testSessionInfo, + eventsHandler).ConfigureAwait(false); + } + finally + { + this.testSessionInfo = null; + } + } + + /// + public async Task InitializeExtensionsAsync(IEnumerable pathToAdditionalExtensions) + { + await this.EnsureInitializedAsync().ConfigureAwait(false); + this.pathToAdditionalExtensions = pathToAdditionalExtensions.ToList(); + this.requestSender.InitializeExtensions(this.pathToAdditionalExtensions); + } /// public async Task DiscoverTestsAsync( IEnumerable sources, string discoverySettings, - TestPlatformOptions options, - ITestDiscoveryEventsHandler2 discoveryEventsHandler) + ITestDiscoveryEventsHandler discoveryEventsHandler) { await this.DiscoverTestsAsync( - sources, - discoverySettings, - options, - testSessionInfo: null, - discoveryEventsHandler); + sources, + discoverySettings, + options: null, + discoveryEventsHandler: new DiscoveryEventsHandleConverter(discoveryEventsHandler)) + .ConfigureAwait(false); } + /// public async Task DiscoverTestsAsync( IEnumerable sources, string discoverySettings, TestPlatformOptions options, - TestSessionInfo testSessionInfo, ITestDiscoveryEventsHandler2 discoveryEventsHandler) { this.testPlatformEventSource.TranslationLayerDiscoveryStart(); - await this.EnsureInitializedAsync(); + await this.EnsureInitializedAsync().ConfigureAwait(false); await this.requestSender.DiscoverTestsAsync( sources, discoverySettings, options, - testSessionInfo, - discoveryEventsHandler); + this.testSessionInfo, + discoveryEventsHandler).ConfigureAwait(false); } /// @@ -639,7 +630,7 @@ await this.RunTestsAsync( sources, runSettings, options: null, - testRunEventsHandler); + testRunEventsHandler).ConfigureAwait(false); } /// @@ -648,22 +639,6 @@ public async Task RunTestsAsync( string runSettings, TestPlatformOptions options, ITestRunEventsHandler testRunEventsHandler) - { - await this.RunTestsAsync( - sources, - runSettings, - options, - testSessionInfo: null, - testRunEventsHandler); - } - - /// - public async Task RunTestsAsync( - IEnumerable sources, - string runSettings, - TestPlatformOptions options, - TestSessionInfo testSessionInfo, - ITestRunEventsHandler testRunEventsHandler) { var sourceList = sources.ToList(); this.testPlatformEventSource.TranslationLayerExecutionStart( @@ -672,13 +647,13 @@ public async Task RunTestsAsync( 0, runSettings ?? string.Empty); - await this.EnsureInitializedAsync(); + await this.EnsureInitializedAsync().ConfigureAwait(false); await this.requestSender.StartTestRunAsync( sourceList, runSettings, options, - testSessionInfo, - testRunEventsHandler); + this.testSessionInfo, + testRunEventsHandler).ConfigureAwait(false); } /// @@ -691,7 +666,7 @@ await this.RunTestsAsync( testCases, runSettings, options: null, - testRunEventsHandler); + testRunEventsHandler).ConfigureAwait(false); } /// @@ -700,22 +675,6 @@ public async Task RunTestsAsync( string runSettings, TestPlatformOptions options, ITestRunEventsHandler testRunEventsHandler) - { - await this.RunTestsAsync( - testCases, - runSettings, - options, - testSessionInfo: null, - testRunEventsHandler); - } - - /// - public async Task RunTestsAsync( - IEnumerable testCases, - string runSettings, - TestPlatformOptions options, - TestSessionInfo testSessionInfo, - ITestRunEventsHandler testRunEventsHandler) { var testCaseList = testCases.ToList(); this.testPlatformEventSource.TranslationLayerExecutionStart( @@ -724,13 +683,13 @@ public async Task RunTestsAsync( testCaseList.Count, runSettings ?? string.Empty); - await this.EnsureInitializedAsync(); + await this.EnsureInitializedAsync().ConfigureAwait(false); await this.requestSender.StartTestRunAsync( testCaseList, runSettings, options, - testSessionInfo, - testRunEventsHandler); + this.testSessionInfo, + testRunEventsHandler).ConfigureAwait(false); } /// @@ -745,24 +704,7 @@ await this.RunTestsWithCustomTestHostAsync( runSettings, options: null, testRunEventsHandler, - customTestHostLauncher); - } - - /// - public async Task RunTestsWithCustomTestHostAsync( - IEnumerable sources, - string runSettings, - TestPlatformOptions options, - ITestRunEventsHandler testRunEventsHandler, - ITestHostLauncher customTestHostLauncher) - { - await this.RunTestsWithCustomTestHostAsync( - sources, - runSettings, - options, - testSessionInfo: null, - testRunEventsHandler, - customTestHostLauncher); + customTestHostLauncher).ConfigureAwait(false); } /// @@ -770,7 +712,6 @@ public async Task RunTestsWithCustomTestHostAsync( IEnumerable sources, string runSettings, TestPlatformOptions options, - TestSessionInfo testSessionInfo, ITestRunEventsHandler testRunEventsHandler, ITestHostLauncher customTestHostLauncher) { @@ -781,14 +722,14 @@ public async Task RunTestsWithCustomTestHostAsync( 0, runSettings ?? string.Empty); - await this.EnsureInitializedAsync(); + await this.EnsureInitializedAsync().ConfigureAwait(false); await this.requestSender.StartTestRunWithCustomHostAsync( sourceList, runSettings, options, - testSessionInfo, + this.testSessionInfo, testRunEventsHandler, - customTestHostLauncher); + customTestHostLauncher).ConfigureAwait(false); } /// @@ -803,7 +744,7 @@ await this.RunTestsWithCustomTestHostAsync( runSettings, options: null, testRunEventsHandler, - customTestHostLauncher); + customTestHostLauncher).ConfigureAwait(false); } /// @@ -813,24 +754,6 @@ public async Task RunTestsWithCustomTestHostAsync( TestPlatformOptions options, ITestRunEventsHandler testRunEventsHandler, ITestHostLauncher customTestHostLauncher) - { - await this.RunTestsWithCustomTestHostAsync( - testCases, - runSettings, - options, - testSessionInfo: null, - testRunEventsHandler, - customTestHostLauncher); - } - - /// - public async Task RunTestsWithCustomTestHostAsync( - IEnumerable testCases, - string runSettings, - TestPlatformOptions options, - TestSessionInfo testSessionInfo, - ITestRunEventsHandler testRunEventsHandler, - ITestHostLauncher customTestHostLauncher) { var testCaseList = testCases.ToList(); this.testPlatformEventSource.TranslationLayerExecutionStart( @@ -839,76 +762,14 @@ public async Task RunTestsWithCustomTestHostAsync( testCaseList.Count, runSettings ?? string.Empty); - await this.EnsureInitializedAsync(); + await this.EnsureInitializedAsync().ConfigureAwait(false); await this.requestSender.StartTestRunWithCustomHostAsync( testCaseList, runSettings, options, - testSessionInfo, + this.testSessionInfo, testRunEventsHandler, - customTestHostLauncher); - } - - /// - public async Task StartTestSessionAsync( - IList sources, - string runSettings, - ITestSessionEventsHandler eventsHandler) - { - return await this.StartTestSessionAsync( - sources, - runSettings, - options: null, - eventsHandler).ConfigureAwait(false); - } - - /// - public async Task StartTestSessionAsync( - IList sources, - string runSettings, - TestPlatformOptions options, - ITestSessionEventsHandler eventsHandler) - { - return await this.StartTestSessionAsync( - sources, - runSettings, - options: null, - eventsHandler, - testHostLauncher: null).ConfigureAwait(false); - } - - /// - public async Task StartTestSessionAsync( - IList sources, - string runSettings, - TestPlatformOptions options, - ITestSessionEventsHandler eventsHandler, - ITestHostLauncher testHostLauncher) - { - this.testPlatformEventSource.TranslationLayerStartTestSessionStart(); - - await this.EnsureInitializedAsync().ConfigureAwait(false); - return new TestSession( - await this.requestSender.StartTestSessionAsync( - sources, - runSettings, - options, - eventsHandler, - testHostLauncher).ConfigureAwait(false), - this); - } - - /// - public async Task StopTestSessionAsync( - TestSessionInfo testSessionInfo, - ITestSessionEventsHandler eventsHandler) - { - this.testPlatformEventSource.TranslationLayerStopTestSessionStart(); - - await this.EnsureInitializedAsync().ConfigureAwait(false); - return await this.requestSender.StopTestSessionAsync( - testSessionInfo, - eventsHandler).ConfigureAwait(false); + customTestHostLauncher).ConfigureAwait(false); } /// @@ -959,7 +820,7 @@ private async Task EnsureInitializedAsync() if (!this.vstestConsoleProcessManager.IsProcessInitialized()) { EqtTrace.Info("VsTestConsoleWrapper.EnsureInitializedAsync: Process is not started."); - await this.StartSessionAsync(); + await this.StartSessionAsync().ConfigureAwait(false); EqtTrace.Info("VsTestConsoleWrapper.EnsureInitializedAsync: Send a request to initialize extensions."); this.requestSender.InitializeExtensions(this.pathToAdditionalExtensions); From b831d876a1ab8b514ce02e65a8db98fc18cfd9af Mon Sep 17 00:00:00 2001 From: Codrin Poienaru Date: Fri, 22 Jan 2021 22:38:22 +0100 Subject: [PATCH 08/26] Reverted to previous interface --- .../Interfaces/ITestSession.cs | 180 +++++++++ .../Interfaces/ITestSessionAsync.cs | 182 +++++++++ .../Interfaces/IVsTestConsoleWrapper.cs | 99 ++++- .../Interfaces/IVsTestConsoleWrapperAsync.cs | 93 ++++- .../TestSession.cs | 373 ++++++++++++++++++ .../VsTestConsoleWrapper.cs | 288 ++++++++++---- 6 files changed, 1136 insertions(+), 79 deletions(-) create mode 100644 src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSession.cs create mode 100644 src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSessionAsync.cs create mode 100644 src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/TestSession.cs diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSession.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSession.cs new file mode 100644 index 0000000000..40361b5ad9 --- /dev/null +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSession.cs @@ -0,0 +1,180 @@ +// 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.VsTestConsole.TranslationLayer.Interfaces +{ + using System.Collections.Generic; + + using Microsoft.VisualStudio.TestPlatform.ObjectModel; + using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client; + using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.Interfaces; + + /// + /// Defines a test session that can be used to make calls to the vstest.console + /// process. + /// + public interface ITestSession : ITestSessionAsync + { + /// + /// Starts test discovery. + /// + /// + /// The list of source assemblies for the discovery. + /// The run settings for the discovery. + /// The discovery event handler. + void DiscoverTests( + IEnumerable sources, + string discoverySettings, + ITestDiscoveryEventsHandler discoveryEventsHandler); + + /// + /// Starts test discovery. + /// + /// + /// The list of source assemblies for the discovery. + /// The run settings for the discovery. + /// The test platform options. + /// The discovery event handler. + void DiscoverTests( + IEnumerable sources, + string discoverySettings, + TestPlatformOptions options, + ITestDiscoveryEventsHandler2 discoveryEventsHandler); + + /// + /// Cancels the last discovery request. + /// + new void CancelDiscovery(); + + /// + /// Starts a test run. + /// + /// + /// The list of source assemblies for the test run. + /// The run settings for the run. + /// The run event handler. + void RunTests( + IEnumerable sources, + string runSettings, + 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. + void RunTests( + IEnumerable sources, + string runSettings, + TestPlatformOptions options, + ITestRunEventsHandler testRunEventsHandler); + + /// + /// Starts a test run. + /// + /// + /// The list of test cases for the test run. + /// The run settings for the run. + /// The run event handler. + void RunTests( + IEnumerable testCases, + string runSettings, + 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. + void RunTests( + IEnumerable testCases, + string runSettings, + TestPlatformOptions options, + ITestRunEventsHandler testRunEventsHandler); + + /// + /// 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); + + /// + /// 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); + + /// + /// 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 custom host launcher. + void RunTestsWithCustomTestHost( + IEnumerable testCases, + string runSettings, + TestPlatformOptions options, + ITestRunEventsHandler testRunEventsHandler, + ITestHostLauncher customTestHostLauncher); + + /// + /// Stops the test session. + /// + /// + /// The session event handler. + /// + /// True if the session was successfuly stopped, false otherwise. + bool StopTestSession(ITestSessionEventsHandler eventsHandler); + + /// + /// Cancels the last test run. + /// + new void CancelTestRun(); + + /// + /// Aborts the last test run. + /// + new void AbortTestRun(); + } +} \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSessionAsync.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSessionAsync.cs new file mode 100644 index 0000000000..7e12a3b3ff --- /dev/null +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSessionAsync.cs @@ -0,0 +1,182 @@ +// 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.VsTestConsole.TranslationLayer.Interfaces +{ + using System.Collections.Generic; + using System.Threading.Tasks; + using Microsoft.VisualStudio.TestPlatform.ObjectModel; + using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client; + using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.Interfaces; + + /// + /// Defines a test session that can be used to make async calls to the vstest.console + /// process. + /// + public interface ITestSessionAsync + { + /// + /// Starts test discovery. + /// + /// + /// The list of source assemblies for the discovery. + /// The run settings for the discovery. + /// The discovery event handler. + /// + Task DiscoverTestsAsync( + IEnumerable sources, + string discoverySettings, + ITestDiscoveryEventsHandler discoveryEventsHandler); + + /// + /// Starts test discovery. + /// + /// + /// The list of source assemblies for the discovery. + /// The run settings for the discovery. + /// The test platform options. + /// The discovery event handler. + Task DiscoverTestsAsync( + IEnumerable sources, + string discoverySettings, + TestPlatformOptions options, + ITestDiscoveryEventsHandler2 discoveryEventsHandler); + + /// + /// Cancels the last discovery request. + /// + void CancelDiscovery(); + + /// + /// Starts a test run. + /// + /// + /// The list of source assemblies for the test run. + /// The run settings for the run. + /// The run event handler. + Task RunTestsAsync( + IEnumerable sources, + string runSettings, + 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. + Task RunTestsAsync( + IEnumerable sources, + string runSettings, + TestPlatformOptions options, + ITestRunEventsHandler testRunEventsHandler); + + /// + /// Starts a test run. + /// + /// + /// The list of test cases for the test run. + /// The run settings for the run. + /// The run event handler. + Task RunTestsAsync( + IEnumerable testCases, + string runSettings, + 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. + Task RunTestsAsync( + IEnumerable testCases, + string runSettings, + TestPlatformOptions options, + ITestRunEventsHandler testRunEventsHandler); + + /// + /// 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. + 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. + Task RunTestsWithCustomTestHostAsync( + IEnumerable sources, + string runSettings, + TestPlatformOptions options, + ITestRunEventsHandler testRunEventsHandler, + 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. + Task RunTestsWithCustomTestHostAsync( + IEnumerable testCases, + string runSettings, + ITestRunEventsHandler testRunEventsHandler, + ITestHostLauncher customTestHostLauncher); + + /// + /// 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 custom host launcher. + Task RunTestsWithCustomTestHostAsync( + IEnumerable testCases, + string runSettings, + TestPlatformOptions options, + ITestRunEventsHandler testRunEventsHandler, + ITestHostLauncher customTestHostLauncher); + + /// + /// Stops the test session. + /// + /// + /// The session event handler. + /// + /// True if the session was successfuly stopped, false otherwise. + Task StopTestSessionAsync( + ITestSessionEventsHandler eventsHandler); + + /// + /// Cancels the last test run. + /// + void CancelTestRun(); + + /// + /// Aborts the last test run. + /// + void AbortTestRun(); + } +} \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/IVsTestConsoleWrapper.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/IVsTestConsoleWrapper.cs index 193cac1cc2..0983d0d074 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/IVsTestConsoleWrapper.cs +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/IVsTestConsoleWrapper.cs @@ -7,6 +7,7 @@ namespace Microsoft.TestPlatform.VsTestConsole.TranslationLayer.Interfaces using Microsoft.VisualStudio.TestPlatform.ObjectModel; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.Interfaces; + using Microsoft.VisualStudio.TestPlatform.VsTestConsole.TranslationLayer.Interfaces; /// /// Controller for various test operations on the test runner. @@ -25,7 +26,9 @@ public interface IVsTestConsoleWrapper : IVsTestConsoleWrapperAsync /// The list of source assemblies for the test run. /// The run settings for the run. /// The session event handler. - void StartTestSession( + /// + /// A test session info object. + ITestSession StartTestSession( IList sources, string runSettings, ITestSessionEventsHandler eventsHandler); @@ -38,7 +41,9 @@ void StartTestSession( /// The run settings for the run. /// The test platform options. /// The session event handler. - void StartTestSession( + /// + /// A test session info object. + ITestSession StartTestSession( IList sources, string runSettings, TestPlatformOptions options, @@ -53,7 +58,9 @@ void StartTestSession( /// The test platform options. /// The session event handler. /// The custom host launcher. - void StartTestSession( + /// + /// A test session info object. + ITestSession StartTestSession( IList sources, string runSettings, TestPlatformOptions options, @@ -64,10 +71,12 @@ void StartTestSession( /// Stops the test session. /// /// + /// The test session info object. /// The session event handler. /// /// True if the session was successfuly stopped, false otherwise. bool StopTestSession( + TestSessionInfo testSessionInfo, ITestSessionEventsHandler eventsHandler); /// @@ -104,6 +113,22 @@ void DiscoverTests( TestPlatformOptions options, ITestDiscoveryEventsHandler2 discoveryEventsHandler); + /// + /// Starts test discovery. + /// + /// + /// The list of source assemblies for the discovery. + /// The run settings for the discovery. + /// The test platform options. + /// The test session info object. + /// The discovery event handler. + void DiscoverTests( + IEnumerable sources, + string discoverySettings, + TestPlatformOptions options, + TestSessionInfo testSessionInfo, + ITestDiscoveryEventsHandler2 discoveryEventsHandler); + /// /// Cancels the last discovery request. /// @@ -135,6 +160,22 @@ void RunTests( 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 test session info object. + /// The run event handler. + void RunTests( + IEnumerable sources, + string runSettings, + TestPlatformOptions options, + TestSessionInfo testSessionInfo, + ITestRunEventsHandler testRunEventsHandler); + /// /// Starts a test run. /// @@ -161,17 +202,49 @@ void RunTests( 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 test session info object. + /// The run event handler. + void RunTests( + IEnumerable testCases, + string runSettings, + TestPlatformOptions options, + TestSessionInfo testSessionInfo, + ITestRunEventsHandler testRunEventsHandler); + + /// + /// 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); @@ -182,12 +255,14 @@ void RunTestsWithCustomTestHost( /// 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); @@ -221,6 +296,24 @@ void RunTestsWithCustomTestHost( ITestRunEventsHandler testRunEventsHandler, ITestHostLauncher customTestHostLauncher); + /// + /// 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 custom host launcher. + void RunTestsWithCustomTestHost( + IEnumerable testCases, + string runSettings, + TestPlatformOptions options, + TestSessionInfo testSessionInfo, + ITestRunEventsHandler testRunEventsHandler, + ITestHostLauncher customTestHostLauncher); + /// /// Cancels the last test run. /// diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/IVsTestConsoleWrapperAsync.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/IVsTestConsoleWrapperAsync.cs index 389d23c04d..f1e5f987de 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/IVsTestConsoleWrapperAsync.cs +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/IVsTestConsoleWrapperAsync.cs @@ -10,6 +10,7 @@ namespace Microsoft.TestPlatform.VsTestConsole.TranslationLayer.Interfaces using Microsoft.VisualStudio.TestPlatform.ObjectModel; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.Interfaces; + using Microsoft.VisualStudio.TestPlatform.VsTestConsole.TranslationLayer.Interfaces; /// /// Asynchronous equivalent of . @@ -28,7 +29,7 @@ public interface IVsTestConsoleWrapperAsync /// string, /// ITestSessionEventsHandler)"/>. /// - Task StartTestSessionAsync( + Task StartTestSessionAsync( IList sources, string runSettings, ITestSessionEventsHandler eventsHandler); @@ -41,7 +42,7 @@ Task StartTestSessionAsync( /// TestPlatformOptions, /// ITestSessionEventsHandler)"/>. /// - Task StartTestSessionAsync( + Task StartTestSessionAsync( IList sources, string runSettings, TestPlatformOptions options, @@ -56,7 +57,7 @@ Task StartTestSessionAsync( /// ITestSessionEventsHandler, /// ITestHostLauncher)"/>. /// - Task StartTestSessionAsync( + Task StartTestSessionAsync( IList sources, string runSettings, TestPlatformOptions options, @@ -66,9 +67,11 @@ Task StartTestSessionAsync( /// /// Asynchronous equivalent of . /// Task StopTestSessionAsync( + TestSessionInfo testSessionInfo, ITestSessionEventsHandler eventsHandler); /// @@ -104,6 +107,22 @@ Task DiscoverTestsAsync( TestPlatformOptions options, ITestDiscoveryEventsHandler2 discoveryEventsHandler); + /// + /// Asynchronous equivalent of . + /// + Task DiscoverTestsAsync( + IEnumerable sources, + string discoverySettings, + TestPlatformOptions options, + TestSessionInfo testSessionInfo, + ITestDiscoveryEventsHandler2 discoveryEventsHandler); + /// /// See . /// @@ -138,13 +157,43 @@ Task RunTestsAsync( /// /// Asynchronous equivalent of . + /// + Task RunTestsAsync( + IEnumerable sources, + string runSettings, + TestPlatformOptions options, + TestSessionInfo testSessionInfo, + ITestRunEventsHandler testRunEventsHandler); + + /// + /// Asynchronous equivalent of . + /// + Task RunTestsAsync( + IEnumerable testCases, + string runSettings, + ITestRunEventsHandler testRunEventsHandler); + + /// + /// Asynchronous equivalent of . /// Task RunTestsAsync( IEnumerable testCases, string runSettings, + TestPlatformOptions options, ITestRunEventsHandler testRunEventsHandler); /// @@ -153,12 +202,14 @@ Task RunTestsAsync( /// IEnumerable{TestCase}, /// string, /// TestPlatformOptions, + /// TestSessionInfo, /// ITestRunEventsHandler)"/>. /// Task RunTestsAsync( IEnumerable testCases, string runSettings, TestPlatformOptions options, + TestSessionInfo testSessionInfo, ITestRunEventsHandler testRunEventsHandler); /// @@ -191,17 +242,51 @@ Task RunTestsWithCustomTestHostAsync( ITestRunEventsHandler testRunEventsHandler, ITestHostLauncher customTestHostLauncher); + /// + /// Asynchronous equivalent of . + /// + Task RunTestsWithCustomTestHostAsync( + IEnumerable sources, + string runSettings, + TestPlatformOptions options, + TestSessionInfo testSessionInfo, + ITestRunEventsHandler testRunEventsHandler, + ITestHostLauncher customTestHostLauncher); + + /// + /// Asynchronous equivalent of . + /// + Task RunTestsWithCustomTestHostAsync( + IEnumerable testCases, + string runSettings, + ITestRunEventsHandler testRunEventsHandler, + ITestHostLauncher customTestHostLauncher); + /// /// Asynchronous equivalent of . /// Task RunTestsWithCustomTestHostAsync( IEnumerable testCases, string runSettings, + TestPlatformOptions options, ITestRunEventsHandler testRunEventsHandler, ITestHostLauncher customTestHostLauncher); @@ -211,6 +296,7 @@ Task RunTestsWithCustomTestHostAsync( /// IEnumerable{TestCase}, /// string, /// TestPlatformOptions, + /// TestSessionInfo, /// ITestRunEventsHandler, /// ITestHostLauncher)"/>. /// @@ -218,6 +304,7 @@ Task RunTestsWithCustomTestHostAsync( IEnumerable testCases, string runSettings, TestPlatformOptions options, + TestSessionInfo testSessionInfo, ITestRunEventsHandler testRunEventsHandler, ITestHostLauncher customTestHostLauncher); diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/TestSession.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/TestSession.cs new file mode 100644 index 0000000000..3a9b5a6ecb --- /dev/null +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/TestSession.cs @@ -0,0 +1,373 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +namespace Microsoft.TestPlatform.VsTestConsole.TranslationLayer +{ + using System.Collections.Generic; + using System.Threading.Tasks; + + using Microsoft.VisualStudio.TestPlatform.ObjectModel; + using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client; + using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.Interfaces; + using Microsoft.VisualStudio.TestPlatform.VsTestConsole.TranslationLayer.Interfaces; + + /// + /// Defines a test session object that can be used to make calls to the vstest.console + /// process. + /// + public class TestSession : ITestSession + { + private TestSessionInfo testSessionInfo; + private VsTestConsoleWrapper consoleWrapper; + + #region Constructors + /// + /// Initializes a new instance of the class. + /// + /// + /// The test session info object. + /// The encapsulated console wrapper. + public TestSession( + TestSessionInfo testSessionInfo, + VsTestConsoleWrapper consoleWrapper) + { + this.testSessionInfo = testSessionInfo; + this.consoleWrapper = consoleWrapper; + } + #endregion + + #region ITestSession + /// + public void AbortTestRun() + { + this.consoleWrapper.AbortTestRun(); + } + + /// + public void CancelDiscovery() + { + this.consoleWrapper.CancelDiscovery(); + } + + /// + public void CancelTestRun() + { + this.consoleWrapper.CancelTestRun(); + } + + /// + public void DiscoverTests( + IEnumerable sources, + string discoverySettings, + ITestDiscoveryEventsHandler discoveryEventsHandler) + { + this.DiscoverTests( + sources, + discoverySettings, + options: null, + discoveryEventsHandler: new DiscoveryEventsHandleConverter(discoveryEventsHandler)); + } + + /// + public void DiscoverTests( + IEnumerable sources, + string discoverySettings, + TestPlatformOptions options, + ITestDiscoveryEventsHandler2 discoveryEventsHandler) + { + this.consoleWrapper.DiscoverTests( + sources, + discoverySettings, + options, + this.testSessionInfo, + discoveryEventsHandler); + } + + /// + public void RunTests( + IEnumerable sources, + string runSettings, + ITestRunEventsHandler testRunEventsHandler) + { + this.RunTests( + sources, + runSettings, + options: null, + testRunEventsHandler); + } + + /// + public void RunTests( + IEnumerable sources, + string runSettings, + TestPlatformOptions options, + ITestRunEventsHandler testRunEventsHandler) + { + this.consoleWrapper.RunTests( + sources, + runSettings, + options, + this.testSessionInfo, + testRunEventsHandler); + } + + /// + public void RunTests( + IEnumerable testCases, + string runSettings, + ITestRunEventsHandler testRunEventsHandler) + { + this.RunTests( + testCases, + runSettings, + options: null, + testRunEventsHandler); + } + + /// + public void RunTests( + IEnumerable testCases, + string runSettings, + TestPlatformOptions options, + ITestRunEventsHandler testRunEventsHandler) + { + this.consoleWrapper.RunTests( + testCases, + runSettings, + options, + this.testSessionInfo, + testRunEventsHandler); + } + + /// + public void RunTestsWithCustomTestHost( + IEnumerable sources, + string runSettings, + ITestRunEventsHandler testRunEventsHandler, + ITestHostLauncher customTestHostLauncher) + { + this.RunTestsWithCustomTestHost( + sources, + runSettings, + options: null, + testRunEventsHandler, + customTestHostLauncher); + } + + /// + public void RunTestsWithCustomTestHost( + IEnumerable sources, + string runSettings, + TestPlatformOptions options, + ITestRunEventsHandler testRunEventsHandler, + ITestHostLauncher customTestHostLauncher) + { + this.consoleWrapper.RunTestsWithCustomTestHost( + sources, + runSettings, + options, + this.testSessionInfo, + testRunEventsHandler, + customTestHostLauncher); + } + + /// + public void RunTestsWithCustomTestHost( + IEnumerable testCases, + string runSettings, + ITestRunEventsHandler testRunEventsHandler, + ITestHostLauncher customTestHostLauncher) + { + this.RunTestsWithCustomTestHost( + testCases, + runSettings, + options: null, + testRunEventsHandler, + customTestHostLauncher); + } + + /// + public void RunTestsWithCustomTestHost( + IEnumerable testCases, + string runSettings, + TestPlatformOptions options, + ITestRunEventsHandler testRunEventsHandler, + ITestHostLauncher customTestHostLauncher) + { + this.consoleWrapper.RunTestsWithCustomTestHost( + testCases, + runSettings, + options, + this.testSessionInfo, + testRunEventsHandler, + customTestHostLauncher); + } + + /// + public bool StopTestSession(ITestSessionEventsHandler eventsHandler) + { + return this.consoleWrapper.StopTestSession( + this.testSessionInfo, + eventsHandler); + } + #endregion + + #region ITestSessionAsync + /// + public async Task DiscoverTestsAsync( + IEnumerable sources, + string discoverySettings, + ITestDiscoveryEventsHandler discoveryEventsHandler) + { + await this.DiscoverTestsAsync( + sources, + discoverySettings, + options: null, + discoveryEventsHandler: new DiscoveryEventsHandleConverter(discoveryEventsHandler)); + } + + /// + public async Task DiscoverTestsAsync( + IEnumerable sources, + string discoverySettings, + TestPlatformOptions options, + ITestDiscoveryEventsHandler2 discoveryEventsHandler) + { + await this.consoleWrapper.DiscoverTestsAsync( + sources, + discoverySettings, + options, + this.testSessionInfo, + discoveryEventsHandler); + } + + /// + public async Task RunTestsAsync( + IEnumerable sources, + string runSettings, + ITestRunEventsHandler testRunEventsHandler) + { + await this.RunTestsAsync( + sources, + runSettings, + options: null, + testRunEventsHandler); + } + + /// + public async Task RunTestsAsync( + IEnumerable sources, + string runSettings, + TestPlatformOptions options, + ITestRunEventsHandler testRunEventsHandler) + { + await this.consoleWrapper.RunTestsAsync( + sources, + runSettings, + options, + this.testSessionInfo, + testRunEventsHandler); + } + + /// + public async Task RunTestsAsync( + IEnumerable testCases, + string runSettings, + ITestRunEventsHandler testRunEventsHandler) + { + await this.RunTestsAsync( + testCases, + runSettings, + options: null, + testRunEventsHandler); + } + + /// + public async Task RunTestsAsync( + IEnumerable testCases, + string runSettings, + TestPlatformOptions options, + ITestRunEventsHandler testRunEventsHandler) + { + await this.consoleWrapper.RunTestsAsync( + testCases, + runSettings, + options, + this.testSessionInfo, + testRunEventsHandler); + } + + /// + public async Task RunTestsWithCustomTestHostAsync( + IEnumerable sources, + string runSettings, + ITestRunEventsHandler testRunEventsHandler, + ITestHostLauncher customTestHostLauncher) + { + await this.RunTestsWithCustomTestHostAsync( + sources, + runSettings, + options: null, + testRunEventsHandler, + customTestHostLauncher); + } + + /// + public async Task RunTestsWithCustomTestHostAsync( + IEnumerable sources, + string runSettings, + TestPlatformOptions options, + ITestRunEventsHandler testRunEventsHandler, + ITestHostLauncher customTestHostLauncher) + { + await this.consoleWrapper.RunTestsWithCustomTestHostAsync( + sources, + runSettings, + options, + this.testSessionInfo, + testRunEventsHandler, + customTestHostLauncher); + } + + /// + public async Task RunTestsWithCustomTestHostAsync( + IEnumerable testCases, + string runSettings, + ITestRunEventsHandler testRunEventsHandler, + ITestHostLauncher customTestHostLauncher) + { + await this.RunTestsWithCustomTestHostAsync( + testCases, + runSettings, + options: null, + testRunEventsHandler, + customTestHostLauncher); + } + + /// + public async Task RunTestsWithCustomTestHostAsync( + IEnumerable testCases, + string runSettings, + TestPlatformOptions options, + ITestRunEventsHandler testRunEventsHandler, + ITestHostLauncher customTestHostLauncher) + { + await this.consoleWrapper.RunTestsWithCustomTestHostAsync( + testCases, + runSettings, + options, + this.testSessionInfo, + testRunEventsHandler, + customTestHostLauncher); + } + + /// + public async Task StopTestSessionAsync(ITestSessionEventsHandler eventsHandler) + { + return await this.consoleWrapper.StopTestSessionAsync( + this.testSessionInfo, + eventsHandler); + } + #endregion + } +} \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleWrapper.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleWrapper.cs index aca97bbfd0..d65a2d92d9 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleWrapper.cs +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleWrapper.cs @@ -19,6 +19,7 @@ namespace Microsoft.TestPlatform.VsTestConsole.TranslationLayer using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.Interfaces; using Microsoft.VisualStudio.TestPlatform.PlatformAbstractions; using Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces; + using Microsoft.VisualStudio.TestPlatform.VsTestConsole.TranslationLayer.Interfaces; using CommunicationUtilitiesResources = Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.Resources.Resources; using CoreUtilitiesConstants = Microsoft.VisualStudio.TestPlatform.CoreUtilities.Constants; @@ -51,7 +52,6 @@ public class VsTestConsoleWrapper : IVsTestConsoleWrapper private readonly ITestPlatformEventSource testPlatformEventSource; - private TestSessionInfo testSessionInfo = null; #endregion #region Constructor @@ -174,12 +174,12 @@ public void StartSession() } /// - public void StartTestSession( + public ITestSession StartTestSession( IList sources, string runSettings, ITestSessionEventsHandler eventsHandler) { - this.StartTestSession( + return this.StartTestSession( sources, runSettings, options: null, @@ -187,13 +187,13 @@ public void StartTestSession( } /// - public void StartTestSession( + public ITestSession StartTestSession( IList sources, string runSettings, TestPlatformOptions options, ITestSessionEventsHandler eventsHandler) { - this.StartTestSession( + return this.StartTestSession( sources, runSettings, options, @@ -202,51 +202,37 @@ public void StartTestSession( } /// - public void StartTestSession( + public ITestSession StartTestSession( IList sources, string runSettings, TestPlatformOptions options, ITestSessionEventsHandler eventsHandler, ITestHostLauncher testHostLauncher) { - if (this.testSessionInfo != null) - { - return; - } - this.testPlatformEventSource.TranslationLayerStartTestSessionStart(); this.EnsureInitialized(); - this.testSessionInfo = this.requestSender.StartTestSession( - sources, - runSettings, - options, - eventsHandler, - testHostLauncher); + return new TestSession( + this.requestSender.StartTestSession( + sources, + runSettings, + options, + eventsHandler, + testHostLauncher), + this); } /// public bool StopTestSession( + TestSessionInfo testSessionInfo, ITestSessionEventsHandler eventsHandler) { - if (this.testSessionInfo == null) - { - return true; - } - this.testPlatformEventSource.TranslationLayerStopTestSessionStart(); this.EnsureInitialized(); - try - { - return this.requestSender.StopTestSession( - this.testSessionInfo, - eventsHandler); - } - finally - { - this.testSessionInfo = null; - } + return this.requestSender.StopTestSession( + testSessionInfo, + eventsHandler); } /// @@ -277,14 +263,31 @@ public void DiscoverTests( string discoverySettings, TestPlatformOptions options, ITestDiscoveryEventsHandler2 discoveryEventsHandler) + { + this.DiscoverTests( + sources, + discoverySettings, + options, + testSessionInfo: null, + discoveryEventsHandler); + } + + /// + public void DiscoverTests( + IEnumerable sources, + string discoverySettings, + TestPlatformOptions options, + TestSessionInfo testSessionInfo, + ITestDiscoveryEventsHandler2 discoveryEventsHandler) { this.testPlatformEventSource.TranslationLayerDiscoveryStart(); + this.EnsureInitialized(); this.requestSender.DiscoverTests( sources, discoverySettings, options, - this.testSessionInfo, + testSessionInfo, discoveryEventsHandler); } @@ -313,6 +316,22 @@ public void RunTests( string runSettings, TestPlatformOptions options, ITestRunEventsHandler testRunEventsHandler) + { + this.RunTests( + sources, + runSettings, + options, + testSessionInfo: null, + testRunEventsHandler); + } + + /// + public void RunTests( + IEnumerable sources, + string runSettings, + TestPlatformOptions options, + TestSessionInfo testSessionInfo, + ITestRunEventsHandler testRunEventsHandler) { var sourceList = sources.ToList(); this.testPlatformEventSource.TranslationLayerExecutionStart( @@ -326,7 +345,7 @@ public void RunTests( sourceList, runSettings, options, - this.testSessionInfo, + testSessionInfo, testRunEventsHandler); } @@ -349,6 +368,22 @@ public void RunTests( string runSettings, TestPlatformOptions options, ITestRunEventsHandler testRunEventsHandler) + { + this.RunTests( + testCases, + runSettings, + options, + testSessionInfo: null, + testRunEventsHandler); + } + + /// + public void RunTests( + IEnumerable testCases, + string runSettings, + TestPlatformOptions options, + TestSessionInfo testSessionInfo, + ITestRunEventsHandler testRunEventsHandler) { var testCaseList = testCases.ToList(); this.testPlatformEventSource.TranslationLayerExecutionStart( @@ -362,7 +397,7 @@ public void RunTests( testCaseList, runSettings, options, - this.testSessionInfo, + testSessionInfo, testRunEventsHandler); } @@ -388,6 +423,24 @@ public void RunTestsWithCustomTestHost( TestPlatformOptions options, ITestRunEventsHandler testRunEventsHandler, ITestHostLauncher customTestHostLauncher) + { + this.RunTestsWithCustomTestHost( + sources, + runSettings, + options, + testSessionInfo: null, + testRunEventsHandler, + customTestHostLauncher); + } + + /// + public void RunTestsWithCustomTestHost( + IEnumerable sources, + string runSettings, + TestPlatformOptions options, + TestSessionInfo testSessionInfo, + ITestRunEventsHandler testRunEventsHandler, + ITestHostLauncher customTestHostLauncher) { var sourceList = sources.ToList(); this.testPlatformEventSource.TranslationLayerExecutionStart( @@ -401,7 +454,7 @@ public void RunTestsWithCustomTestHost( sourceList, runSettings, options, - this.testSessionInfo, + testSessionInfo, testRunEventsHandler, customTestHostLauncher); } @@ -428,6 +481,24 @@ public void RunTestsWithCustomTestHost( TestPlatformOptions options, ITestRunEventsHandler testRunEventsHandler, ITestHostLauncher customTestHostLauncher) + { + this.RunTestsWithCustomTestHost( + testCases, + runSettings, + options, + testSessionInfo: null, + testRunEventsHandler, + customTestHostLauncher); + } + + /// + public void RunTestsWithCustomTestHost( + IEnumerable testCases, + string runSettings, + TestPlatformOptions options, + TestSessionInfo testSessionInfo, + ITestRunEventsHandler testRunEventsHandler, + ITestHostLauncher customTestHostLauncher) { var testCaseList = testCases.ToList(); this.testPlatformEventSource.TranslationLayerExecutionStart( @@ -441,7 +512,7 @@ public void RunTestsWithCustomTestHost( testCaseList, runSettings, options, - this.testSessionInfo, + testSessionInfo, testRunEventsHandler, customTestHostLauncher); } @@ -505,12 +576,12 @@ public async Task StartSessionAsync() } /// - public async Task StartTestSessionAsync( + public async Task StartTestSessionAsync( IList sources, string runSettings, ITestSessionEventsHandler eventsHandler) { - await this.StartTestSessionAsync( + return await this.StartTestSessionAsync( sources, runSettings, options: null, @@ -518,13 +589,13 @@ await this.StartTestSessionAsync( } /// - public async Task StartTestSessionAsync( + public async Task StartTestSessionAsync( IList sources, string runSettings, TestPlatformOptions options, ITestSessionEventsHandler eventsHandler) { - await this.StartTestSessionAsync( + return await this.StartTestSessionAsync( sources, runSettings, options: null, @@ -533,51 +604,37 @@ await this.StartTestSessionAsync( } /// - public async Task StartTestSessionAsync( + public async Task StartTestSessionAsync( IList sources, string runSettings, TestPlatformOptions options, ITestSessionEventsHandler eventsHandler, ITestHostLauncher testHostLauncher) { - if (this.testSessionInfo != null) - { - return; - } - this.testPlatformEventSource.TranslationLayerStartTestSessionStart(); await this.EnsureInitializedAsync().ConfigureAwait(false); - this.testSessionInfo = await this.requestSender.StartTestSessionAsync( - sources, - runSettings, - options, - eventsHandler, - testHostLauncher).ConfigureAwait(false); + return new TestSession( + await this.requestSender.StartTestSessionAsync( + sources, + runSettings, + options, + eventsHandler, + testHostLauncher).ConfigureAwait(false), + this); } /// public async Task StopTestSessionAsync( + TestSessionInfo testSessionInfo, ITestSessionEventsHandler eventsHandler) { - if (this.testSessionInfo == null) - { - return true; - } - this.testPlatformEventSource.TranslationLayerStopTestSessionStart(); await this.EnsureInitializedAsync().ConfigureAwait(false); - try - { - return await this.requestSender.StopTestSessionAsync( - testSessionInfo, - eventsHandler).ConfigureAwait(false); - } - finally - { - this.testSessionInfo = null; - } + return await this.requestSender.StopTestSessionAsync( + testSessionInfo, + eventsHandler).ConfigureAwait(false); } /// @@ -609,14 +666,31 @@ public async Task DiscoverTestsAsync( string discoverySettings, TestPlatformOptions options, ITestDiscoveryEventsHandler2 discoveryEventsHandler) + { + await this.DiscoverTestsAsync( + sources, + discoverySettings, + options, + testSessionInfo: null, + discoveryEventsHandler).ConfigureAwait(false); + } + + /// + public async Task DiscoverTestsAsync( + IEnumerable sources, + string discoverySettings, + TestPlatformOptions options, + TestSessionInfo testSessionInfo, + ITestDiscoveryEventsHandler2 discoveryEventsHandler) { this.testPlatformEventSource.TranslationLayerDiscoveryStart(); + await this.EnsureInitializedAsync().ConfigureAwait(false); await this.requestSender.DiscoverTestsAsync( sources, discoverySettings, options, - this.testSessionInfo, + testSessionInfo, discoveryEventsHandler).ConfigureAwait(false); } @@ -639,6 +713,22 @@ public async Task RunTestsAsync( string runSettings, TestPlatformOptions options, ITestRunEventsHandler testRunEventsHandler) + { + await this.RunTestsAsync( + sources, + runSettings, + options, + testSessionInfo: null, + testRunEventsHandler).ConfigureAwait(false); + } + + /// + public async Task RunTestsAsync( + IEnumerable sources, + string runSettings, + TestPlatformOptions options, + TestSessionInfo testSessionInfo, + ITestRunEventsHandler testRunEventsHandler) { var sourceList = sources.ToList(); this.testPlatformEventSource.TranslationLayerExecutionStart( @@ -652,7 +742,7 @@ await this.requestSender.StartTestRunAsync( sourceList, runSettings, options, - this.testSessionInfo, + testSessionInfo, testRunEventsHandler).ConfigureAwait(false); } @@ -675,6 +765,22 @@ public async Task RunTestsAsync( string runSettings, TestPlatformOptions options, ITestRunEventsHandler testRunEventsHandler) + { + await this.RunTestsAsync( + testCases, + runSettings, + options, + testSessionInfo: null, + testRunEventsHandler).ConfigureAwait(false); + } + + /// + public async Task RunTestsAsync( + IEnumerable testCases, + string runSettings, + TestPlatformOptions options, + TestSessionInfo testSessionInfo, + ITestRunEventsHandler testRunEventsHandler) { var testCaseList = testCases.ToList(); this.testPlatformEventSource.TranslationLayerExecutionStart( @@ -688,7 +794,7 @@ await this.requestSender.StartTestRunAsync( testCaseList, runSettings, options, - this.testSessionInfo, + testSessionInfo, testRunEventsHandler).ConfigureAwait(false); } @@ -714,6 +820,24 @@ public async Task RunTestsWithCustomTestHostAsync( TestPlatformOptions options, ITestRunEventsHandler testRunEventsHandler, ITestHostLauncher customTestHostLauncher) + { + await this.RunTestsWithCustomTestHostAsync( + sources, + runSettings, + options, + testSessionInfo: null, + testRunEventsHandler, + customTestHostLauncher).ConfigureAwait(false); + } + + /// + public async Task RunTestsWithCustomTestHostAsync( + IEnumerable sources, + string runSettings, + TestPlatformOptions options, + TestSessionInfo testSessionInfo, + ITestRunEventsHandler testRunEventsHandler, + ITestHostLauncher customTestHostLauncher) { var sourceList = sources.ToList(); this.testPlatformEventSource.TranslationLayerExecutionStart( @@ -727,7 +851,7 @@ await this.requestSender.StartTestRunWithCustomHostAsync( sourceList, runSettings, options, - this.testSessionInfo, + testSessionInfo, testRunEventsHandler, customTestHostLauncher).ConfigureAwait(false); } @@ -754,6 +878,24 @@ public async Task RunTestsWithCustomTestHostAsync( TestPlatformOptions options, ITestRunEventsHandler testRunEventsHandler, ITestHostLauncher customTestHostLauncher) + { + await this.RunTestsWithCustomTestHostAsync( + testCases, + runSettings, + options, + testSessionInfo: null, + testRunEventsHandler, + customTestHostLauncher).ConfigureAwait(false); + } + + /// + public async Task RunTestsWithCustomTestHostAsync( + IEnumerable testCases, + string runSettings, + TestPlatformOptions options, + TestSessionInfo testSessionInfo, + ITestRunEventsHandler testRunEventsHandler, + ITestHostLauncher customTestHostLauncher) { var testCaseList = testCases.ToList(); this.testPlatformEventSource.TranslationLayerExecutionStart( @@ -767,7 +909,7 @@ await this.requestSender.StartTestRunWithCustomHostAsync( testCaseList, runSettings, options, - this.testSessionInfo, + testSessionInfo, testRunEventsHandler, customTestHostLauncher).ConfigureAwait(false); } From 8ebaabc5f9e85d2cae94f9b279257f79cffcdc4a Mon Sep 17 00:00:00 2001 From: Codrin Poienaru Date: Mon, 25 Jan 2021 16:30:05 +0100 Subject: [PATCH 09/26] Removed trailing whitespaces after restoring previous interface --- .../Interfaces/ITestSession.cs | 202 ++++++++--------- .../Interfaces/ITestSessionAsync.cs | 204 +++++++++--------- .../TestSession.cs | 80 +++---- 3 files changed, 243 insertions(+), 243 deletions(-) diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSession.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSession.cs index 40361b5ad9..70ea884332 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSession.cs +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSession.cs @@ -1,5 +1,5 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. +// 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.VsTestConsole.TranslationLayer.Interfaces { @@ -9,118 +9,118 @@ namespace Microsoft.VisualStudio.TestPlatform.VsTestConsole.TranslationLayer.Int using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.Interfaces; - /// - /// Defines a test session that can be used to make calls to the vstest.console - /// process. - /// + /// + /// Defines a test session that can be used to make calls to the vstest.console + /// process. + /// public interface ITestSession : ITestSessionAsync { - /// - /// Starts test discovery. - /// - /// - /// The list of source assemblies for the discovery. - /// The run settings for the discovery. - /// The discovery event handler. + /// + /// Starts test discovery. + /// + /// + /// The list of source assemblies for the discovery. + /// The run settings for the discovery. + /// The discovery event handler. void DiscoverTests( IEnumerable sources, string discoverySettings, ITestDiscoveryEventsHandler discoveryEventsHandler); - /// - /// Starts test discovery. - /// - /// - /// The list of source assemblies for the discovery. - /// The run settings for the discovery. - /// The test platform options. - /// The discovery event handler. + /// + /// Starts test discovery. + /// + /// + /// The list of source assemblies for the discovery. + /// The run settings for the discovery. + /// The test platform options. + /// The discovery event handler. void DiscoverTests( IEnumerable sources, string discoverySettings, TestPlatformOptions options, ITestDiscoveryEventsHandler2 discoveryEventsHandler); - /// - /// Cancels the last discovery request. - /// + /// + /// Cancels the last discovery request. + /// new void CancelDiscovery(); - /// - /// Starts a test run. - /// - /// - /// The list of source assemblies for the test run. - /// The run settings for the run. - /// The run event handler. + /// + /// Starts a test run. + /// + /// + /// The list of source assemblies for the test run. + /// The run settings for the run. + /// The run event handler. void RunTests( IEnumerable sources, string runSettings, 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. + /// + /// 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. void RunTests( IEnumerable sources, string runSettings, TestPlatformOptions options, ITestRunEventsHandler testRunEventsHandler); - /// - /// Starts a test run. - /// - /// - /// The list of test cases for the test run. - /// The run settings for the run. - /// The run event handler. + /// + /// Starts a test run. + /// + /// + /// The list of test cases for the test run. + /// The run settings for the run. + /// The run event handler. void RunTests( IEnumerable testCases, string runSettings, 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. + /// + /// 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. void RunTests( IEnumerable testCases, string runSettings, TestPlatformOptions options, ITestRunEventsHandler testRunEventsHandler); - /// - /// 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. + /// + /// 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. + /// + /// 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, @@ -128,29 +128,29 @@ void RunTestsWithCustomTestHost( ITestRunEventsHandler testRunEventsHandler, 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. + /// + /// 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); - /// - /// 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 custom host launcher. + /// + /// 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 custom host launcher. void RunTestsWithCustomTestHost( IEnumerable testCases, string runSettings, @@ -158,23 +158,23 @@ void RunTestsWithCustomTestHost( ITestRunEventsHandler testRunEventsHandler, ITestHostLauncher customTestHostLauncher); - /// - /// Stops the test session. - /// - /// - /// The session event handler. - /// - /// True if the session was successfuly stopped, false otherwise. + /// + /// Stops the test session. + /// + /// + /// The session event handler. + /// + /// True if the session was successfuly stopped, false otherwise. bool StopTestSession(ITestSessionEventsHandler eventsHandler); - /// - /// Cancels the last test run. - /// + /// + /// Cancels the last test run. + /// new void CancelTestRun(); - /// - /// Aborts the last test run. - /// + /// + /// Aborts the last test run. + /// new void AbortTestRun(); } } \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSessionAsync.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSessionAsync.cs index 7e12a3b3ff..65e59945ad 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSessionAsync.cs +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSessionAsync.cs @@ -1,5 +1,5 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. +// 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.VsTestConsole.TranslationLayer.Interfaces { @@ -9,119 +9,119 @@ namespace Microsoft.VisualStudio.TestPlatform.VsTestConsole.TranslationLayer.Int using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.Interfaces; - /// - /// Defines a test session that can be used to make async calls to the vstest.console - /// process. - /// + /// + /// Defines a test session that can be used to make async calls to the vstest.console + /// process. + /// public interface ITestSessionAsync { - /// - /// Starts test discovery. - /// - /// - /// The list of source assemblies for the discovery. - /// The run settings for the discovery. - /// The discovery event handler. - /// + /// + /// Starts test discovery. + /// + /// + /// The list of source assemblies for the discovery. + /// The run settings for the discovery. + /// The discovery event handler. + /// Task DiscoverTestsAsync( IEnumerable sources, string discoverySettings, ITestDiscoveryEventsHandler discoveryEventsHandler); - /// - /// Starts test discovery. - /// - /// - /// The list of source assemblies for the discovery. - /// The run settings for the discovery. - /// The test platform options. - /// The discovery event handler. + /// + /// Starts test discovery. + /// + /// + /// The list of source assemblies for the discovery. + /// The run settings for the discovery. + /// The test platform options. + /// The discovery event handler. Task DiscoverTestsAsync( IEnumerable sources, string discoverySettings, TestPlatformOptions options, ITestDiscoveryEventsHandler2 discoveryEventsHandler); - /// - /// Cancels the last discovery request. - /// + /// + /// Cancels the last discovery request. + /// void CancelDiscovery(); - /// - /// Starts a test run. - /// - /// - /// The list of source assemblies for the test run. - /// The run settings for the run. - /// The run event handler. + /// + /// Starts a test run. + /// + /// + /// The list of source assemblies for the test run. + /// The run settings for the run. + /// The run event handler. Task RunTestsAsync( IEnumerable sources, string runSettings, 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. + /// + /// 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. Task RunTestsAsync( IEnumerable sources, string runSettings, TestPlatformOptions options, ITestRunEventsHandler testRunEventsHandler); - /// - /// Starts a test run. - /// - /// - /// The list of test cases for the test run. - /// The run settings for the run. - /// The run event handler. + /// + /// Starts a test run. + /// + /// + /// The list of test cases for the test run. + /// The run settings for the run. + /// The run event handler. Task RunTestsAsync( IEnumerable testCases, string runSettings, 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. + /// + /// 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. Task RunTestsAsync( IEnumerable testCases, string runSettings, TestPlatformOptions options, ITestRunEventsHandler testRunEventsHandler); - /// - /// 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. + /// + /// 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. 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. + /// + /// 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. Task RunTestsWithCustomTestHostAsync( IEnumerable sources, string runSettings, @@ -129,29 +129,29 @@ Task RunTestsWithCustomTestHostAsync( ITestRunEventsHandler testRunEventsHandler, 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. + /// + /// 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. Task RunTestsWithCustomTestHostAsync( IEnumerable testCases, string runSettings, ITestRunEventsHandler testRunEventsHandler, ITestHostLauncher customTestHostLauncher); - /// - /// 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 custom host launcher. + /// + /// 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 custom host launcher. Task RunTestsWithCustomTestHostAsync( IEnumerable testCases, string runSettings, @@ -159,24 +159,24 @@ Task RunTestsWithCustomTestHostAsync( ITestRunEventsHandler testRunEventsHandler, ITestHostLauncher customTestHostLauncher); - /// - /// Stops the test session. - /// - /// - /// The session event handler. - /// - /// True if the session was successfuly stopped, false otherwise. + /// + /// Stops the test session. + /// + /// + /// The session event handler. + /// + /// True if the session was successfuly stopped, false otherwise. Task StopTestSessionAsync( ITestSessionEventsHandler eventsHandler); - /// - /// Cancels the last test run. - /// + /// + /// Cancels the last test run. + /// void CancelTestRun(); - /// - /// Aborts the last test run. - /// + /// + /// Aborts the last test run. + /// void AbortTestRun(); } } \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/TestSession.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/TestSession.cs index 3a9b5a6ecb..b68e150045 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/TestSession.cs +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/TestSession.cs @@ -1,5 +1,5 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace Microsoft.TestPlatform.VsTestConsole.TranslationLayer { @@ -11,22 +11,22 @@ namespace Microsoft.TestPlatform.VsTestConsole.TranslationLayer using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.Interfaces; using Microsoft.VisualStudio.TestPlatform.VsTestConsole.TranslationLayer.Interfaces; - /// - /// Defines a test session object that can be used to make calls to the vstest.console - /// process. - /// + /// + /// Defines a test session object that can be used to make calls to the vstest.console + /// process. + /// public class TestSession : ITestSession { private TestSessionInfo testSessionInfo; private VsTestConsoleWrapper consoleWrapper; - #region Constructors - /// - /// Initializes a new instance of the class. - /// - /// - /// The test session info object. - /// The encapsulated console wrapper. + #region Constructors + /// + /// Initializes a new instance of the class. + /// + /// + /// The test session info object. + /// The encapsulated console wrapper. public TestSession( TestSessionInfo testSessionInfo, VsTestConsoleWrapper consoleWrapper) @@ -36,26 +36,26 @@ public TestSession( } #endregion - #region ITestSession - /// + #region ITestSession + /// public void AbortTestRun() { this.consoleWrapper.AbortTestRun(); } - /// + /// public void CancelDiscovery() { this.consoleWrapper.CancelDiscovery(); } - /// + /// public void CancelTestRun() { this.consoleWrapper.CancelTestRun(); } - /// + /// public void DiscoverTests( IEnumerable sources, string discoverySettings, @@ -68,7 +68,7 @@ public void DiscoverTests( discoveryEventsHandler: new DiscoveryEventsHandleConverter(discoveryEventsHandler)); } - /// + /// public void DiscoverTests( IEnumerable sources, string discoverySettings, @@ -83,7 +83,7 @@ public void DiscoverTests( discoveryEventsHandler); } - /// + /// public void RunTests( IEnumerable sources, string runSettings, @@ -96,7 +96,7 @@ public void RunTests( testRunEventsHandler); } - /// + /// public void RunTests( IEnumerable sources, string runSettings, @@ -111,7 +111,7 @@ public void RunTests( testRunEventsHandler); } - /// + /// public void RunTests( IEnumerable testCases, string runSettings, @@ -124,7 +124,7 @@ public void RunTests( testRunEventsHandler); } - /// + /// public void RunTests( IEnumerable testCases, string runSettings, @@ -139,7 +139,7 @@ public void RunTests( testRunEventsHandler); } - /// + /// public void RunTestsWithCustomTestHost( IEnumerable sources, string runSettings, @@ -154,7 +154,7 @@ public void RunTestsWithCustomTestHost( customTestHostLauncher); } - /// + /// public void RunTestsWithCustomTestHost( IEnumerable sources, string runSettings, @@ -171,7 +171,7 @@ public void RunTestsWithCustomTestHost( customTestHostLauncher); } - /// + /// public void RunTestsWithCustomTestHost( IEnumerable testCases, string runSettings, @@ -186,7 +186,7 @@ public void RunTestsWithCustomTestHost( customTestHostLauncher); } - /// + /// public void RunTestsWithCustomTestHost( IEnumerable testCases, string runSettings, @@ -203,7 +203,7 @@ public void RunTestsWithCustomTestHost( customTestHostLauncher); } - /// + /// public bool StopTestSession(ITestSessionEventsHandler eventsHandler) { return this.consoleWrapper.StopTestSession( @@ -212,8 +212,8 @@ public bool StopTestSession(ITestSessionEventsHandler eventsHandler) } #endregion - #region ITestSessionAsync - /// + #region ITestSessionAsync + /// public async Task DiscoverTestsAsync( IEnumerable sources, string discoverySettings, @@ -226,7 +226,7 @@ await this.DiscoverTestsAsync( discoveryEventsHandler: new DiscoveryEventsHandleConverter(discoveryEventsHandler)); } - /// + /// public async Task DiscoverTestsAsync( IEnumerable sources, string discoverySettings, @@ -241,7 +241,7 @@ await this.consoleWrapper.DiscoverTestsAsync( discoveryEventsHandler); } - /// + /// public async Task RunTestsAsync( IEnumerable sources, string runSettings, @@ -254,7 +254,7 @@ await this.RunTestsAsync( testRunEventsHandler); } - /// + /// public async Task RunTestsAsync( IEnumerable sources, string runSettings, @@ -269,7 +269,7 @@ await this.consoleWrapper.RunTestsAsync( testRunEventsHandler); } - /// + /// public async Task RunTestsAsync( IEnumerable testCases, string runSettings, @@ -282,7 +282,7 @@ await this.RunTestsAsync( testRunEventsHandler); } - /// + /// public async Task RunTestsAsync( IEnumerable testCases, string runSettings, @@ -297,7 +297,7 @@ await this.consoleWrapper.RunTestsAsync( testRunEventsHandler); } - /// + /// public async Task RunTestsWithCustomTestHostAsync( IEnumerable sources, string runSettings, @@ -312,7 +312,7 @@ await this.RunTestsWithCustomTestHostAsync( customTestHostLauncher); } - /// + /// public async Task RunTestsWithCustomTestHostAsync( IEnumerable sources, string runSettings, @@ -329,7 +329,7 @@ await this.consoleWrapper.RunTestsWithCustomTestHostAsync( customTestHostLauncher); } - /// + /// public async Task RunTestsWithCustomTestHostAsync( IEnumerable testCases, string runSettings, @@ -344,7 +344,7 @@ await this.RunTestsWithCustomTestHostAsync( customTestHostLauncher); } - /// + /// public async Task RunTestsWithCustomTestHostAsync( IEnumerable testCases, string runSettings, @@ -361,7 +361,7 @@ await this.consoleWrapper.RunTestsWithCustomTestHostAsync( customTestHostLauncher); } - /// + /// public async Task StopTestSessionAsync(ITestSessionEventsHandler eventsHandler) { return await this.consoleWrapper.StopTestSessionAsync( From ff8507b0e665631834a0bfdc9282b65873fb0f72 Mon Sep 17 00:00:00 2001 From: Codrin Poienaru Date: Mon, 25 Jan 2021 16:38:46 +0100 Subject: [PATCH 10/26] Reverted whitespaces --- .../Interfaces/ITestSession.cs | 24 +++++++++---------- .../Interfaces/ITestSessionAsync.cs | 24 +++++++++---------- .../TestSession.cs | 2 +- 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSession.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSession.cs index 70ea884332..bc41396489 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSession.cs +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSession.cs @@ -18,7 +18,7 @@ public interface ITestSession : ITestSessionAsync /// /// Starts test discovery. /// - /// + /// /// The list of source assemblies for the discovery. /// The run settings for the discovery. /// The discovery event handler. @@ -30,7 +30,7 @@ void DiscoverTests( /// /// Starts test discovery. /// - /// + /// /// The list of source assemblies for the discovery. /// The run settings for the discovery. /// The test platform options. @@ -49,7 +49,7 @@ void DiscoverTests( /// /// Starts a test run. /// - /// + /// /// The list of source assemblies for the test run. /// The run settings for the run. /// The run event handler. @@ -61,7 +61,7 @@ void RunTests( /// /// Starts a test run. /// - /// + /// /// The list of source assemblies for the test run. /// The run settings for the run. /// The test platform options. @@ -75,7 +75,7 @@ void RunTests( /// /// Starts a test run. /// - /// + /// /// The list of test cases for the test run. /// The run settings for the run. /// The run event handler. @@ -87,7 +87,7 @@ void RunTests( /// /// Starts a test run. /// - /// + /// /// The list of test cases for the test run. /// The run settings for the run. /// The test platform options. @@ -101,7 +101,7 @@ void RunTests( /// /// Starts a test run. /// - /// + /// /// The list of source assemblies for the test run. /// The run settings for the run. /// The run event handler. @@ -115,7 +115,7 @@ void RunTestsWithCustomTestHost( /// /// Starts a test run. /// - /// + /// /// The list of source assemblies for the test run. /// The run settings for the run. /// The test platform options. @@ -131,7 +131,7 @@ void RunTestsWithCustomTestHost( /// /// Starts a test run. /// - /// + /// /// The list of test cases for the test run. /// The run settings for the run. /// The run event handler. @@ -145,7 +145,7 @@ void RunTestsWithCustomTestHost( /// /// Starts a test run. /// - /// + /// /// The list of test cases for the test run. /// The run settings for the run. /// The test platform options. @@ -161,9 +161,9 @@ void RunTestsWithCustomTestHost( /// /// Stops the test session. /// - /// + /// /// The session event handler. - /// + /// /// True if the session was successfuly stopped, false otherwise. bool StopTestSession(ITestSessionEventsHandler eventsHandler); diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSessionAsync.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSessionAsync.cs index 65e59945ad..63d71deee5 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSessionAsync.cs +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSessionAsync.cs @@ -18,7 +18,7 @@ public interface ITestSessionAsync /// /// Starts test discovery. /// - /// + /// /// The list of source assemblies for the discovery. /// The run settings for the discovery. /// The discovery event handler. @@ -31,7 +31,7 @@ Task DiscoverTestsAsync( /// /// Starts test discovery. /// - /// + /// /// The list of source assemblies for the discovery. /// The run settings for the discovery. /// The test platform options. @@ -50,7 +50,7 @@ Task DiscoverTestsAsync( /// /// Starts a test run. /// - /// + /// /// The list of source assemblies for the test run. /// The run settings for the run. /// The run event handler. @@ -62,7 +62,7 @@ Task RunTestsAsync( /// /// Starts a test run. /// - /// + /// /// The list of source assemblies for the test run. /// The run settings for the run. /// The test platform options. @@ -76,7 +76,7 @@ Task RunTestsAsync( /// /// Starts a test run. /// - /// + /// /// The list of test cases for the test run. /// The run settings for the run. /// The run event handler. @@ -88,7 +88,7 @@ Task RunTestsAsync( /// /// Starts a test run. /// - /// + /// /// The list of test cases for the test run. /// The run settings for the run. /// The test platform options. @@ -102,7 +102,7 @@ Task RunTestsAsync( /// /// Starts a test run. /// - /// + /// /// The list of source assemblies for the test run. /// The run settings for the run. /// The run event handler. @@ -116,7 +116,7 @@ Task RunTestsWithCustomTestHostAsync( /// /// Starts a test run. /// - /// + /// /// The list of source assemblies for the test run. /// The run settings for the run. /// The test platform options. @@ -132,7 +132,7 @@ Task RunTestsWithCustomTestHostAsync( /// /// Starts a test run. /// - /// + /// /// The list of test cases for the test run. /// The run settings for the run. /// The run event handler. @@ -146,7 +146,7 @@ Task RunTestsWithCustomTestHostAsync( /// /// Starts a test run. /// - /// + /// /// The list of test cases for the test run. /// The run settings for the run. /// The test platform options. @@ -162,9 +162,9 @@ Task RunTestsWithCustomTestHostAsync( /// /// Stops the test session. /// - /// + /// /// The session event handler. - /// + /// /// True if the session was successfuly stopped, false otherwise. Task StopTestSessionAsync( ITestSessionEventsHandler eventsHandler); diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/TestSession.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/TestSession.cs index b68e150045..9aeabf0b3b 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/TestSession.cs +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/TestSession.cs @@ -24,7 +24,7 @@ public class TestSession : ITestSession /// /// Initializes a new instance of the class. /// - /// + /// /// The test session info object. /// The encapsulated console wrapper. public TestSession( From 629f20fec721911d245a5a5251d3f281e356438b Mon Sep 17 00:00:00 2001 From: Codrin Poienaru Date: Mon, 25 Jan 2021 16:40:15 +0100 Subject: [PATCH 11/26] Reverted whitespaces 2 --- .../Interfaces/ITestSession.cs | 2 +- .../Interfaces/ITestSessionAsync.cs | 2 +- .../TestSession.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSession.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSession.cs index bc41396489..206c3aa009 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSession.cs +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSession.cs @@ -177,4 +177,4 @@ void RunTestsWithCustomTestHost( /// new void AbortTestRun(); } -} \ No newline at end of file +} diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSessionAsync.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSessionAsync.cs index 63d71deee5..9c2aff1496 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSessionAsync.cs +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSessionAsync.cs @@ -179,4 +179,4 @@ Task StopTestSessionAsync( /// void AbortTestRun(); } -} \ No newline at end of file +} diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/TestSession.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/TestSession.cs index 9aeabf0b3b..40fb329639 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/TestSession.cs +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/TestSession.cs @@ -370,4 +370,4 @@ public async Task StopTestSessionAsync(ITestSessionEventsHandler eventsHan } #endregion } -} \ No newline at end of file +} From f91228ea47b7919e0feb91229037423480b84c58 Mon Sep 17 00:00:00 2001 From: Codrin Poienaru Date: Mon, 25 Jan 2021 18:43:07 +0100 Subject: [PATCH 12/26] Added check for matching run settings and disabled test sessions with data collectors --- .../TestPlatform.cs | 2 +- .../IProxyTestSessionManager.cs | 5 +- .../Client/ProxyDiscoveryManager.cs | 7 ++- .../Client/ProxyExecutionManager.cs | 10 +++- .../Resources/Resources.Designer.cs | 9 ++++ .../Resources/Resources.resx | 3 ++ .../Resources/xlf/Resources.cs.xlf | 5 ++ .../Resources/xlf/Resources.de.xlf | 5 ++ .../Resources/xlf/Resources.es.xlf | 5 ++ .../Resources/xlf/Resources.fr.xlf | 5 ++ .../Resources/xlf/Resources.it.xlf | 5 ++ .../Resources/xlf/Resources.ja.xlf | 5 ++ .../Resources/xlf/Resources.ko.xlf | 5 ++ .../Resources/xlf/Resources.pl.xlf | 5 ++ .../Resources/xlf/Resources.pt-BR.xlf | 5 ++ .../Resources/xlf/Resources.ru.xlf | 5 ++ .../Resources/xlf/Resources.tr.xlf | 5 ++ .../Resources/xlf/Resources.xlf | 5 ++ .../Resources/xlf/Resources.zh-Hans.xlf | 5 ++ .../Resources/xlf/Resources.zh-Hant.xlf | 5 ++ .../TestEngine.cs | 47 ++++++++++------ .../TestSession/ProxyTestSessionManager.cs | 50 ++++++++++++++--- .../TestSession/TestSessionPool.cs | 7 ++- .../Interfaces/ITestSession.cs | 7 +++ .../Interfaces/ITestSessionAsync.cs | 7 +++ .../TestSession.cs | 54 +++++++++++++------ .../VsTestConsoleWrapper.cs | 2 + 27 files changed, 229 insertions(+), 51 deletions(-) diff --git a/src/Microsoft.TestPlatform.Client/TestPlatform.cs b/src/Microsoft.TestPlatform.Client/TestPlatform.cs index 9ba116cf41..b66ab8b0a4 100644 --- a/src/Microsoft.TestPlatform.Client/TestPlatform.cs +++ b/src/Microsoft.TestPlatform.Client/TestPlatform.cs @@ -187,7 +187,7 @@ public void StartTestSession( } testSessionManager.Initialize(false); - testSessionManager.StartSession(testSessionCriteria, eventsHandler); + testSessionManager.StartSession(eventsHandler); } /// diff --git a/src/Microsoft.TestPlatform.Common/Interfaces/Engine/ClientProtocol/IProxyTestSessionManager.cs b/src/Microsoft.TestPlatform.Common/Interfaces/Engine/ClientProtocol/IProxyTestSessionManager.cs index 415974639d..154e5c6781 100644 --- a/src/Microsoft.TestPlatform.Common/Interfaces/Engine/ClientProtocol/IProxyTestSessionManager.cs +++ b/src/Microsoft.TestPlatform.Common/Interfaces/Engine/ClientProtocol/IProxyTestSessionManager.cs @@ -22,13 +22,10 @@ public interface IProxyTestSessionManager /// Starts the test session based on the test session criteria. /// /// - /// The test session criteria. /// /// Event handler for handling events fired during test session management operations. /// - void StartSession( - StartTestSessionCriteria criteria, - ITestSessionEventsHandler eventsHandler); + void StartSession(ITestSessionEventsHandler eventsHandler); /// /// Stops the test session. diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyDiscoveryManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyDiscoveryManager.cs index cae18925a1..807c2bb2f0 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyDiscoveryManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyDiscoveryManager.cs @@ -43,11 +43,14 @@ public class ProxyDiscoveryManager : IProxyDiscoveryManager, IBaseProxy, ITestDi /// /// /// The test session info. - public ProxyDiscoveryManager(TestSessionInfo testSessionInfo) + /// The run settings. + public ProxyDiscoveryManager(TestSessionInfo testSessionInfo, string runSettings) { // Filling in test session info and proxy information. this.testSessionInfo = testSessionInfo; - this.proxyOperationManager = TestSessionPool.Instance.TakeProxy(this.testSessionInfo); + this.proxyOperationManager = TestSessionPool.Instance.TakeProxy( + this.testSessionInfo, + runSettings); this.testHostManager = this.proxyOperationManager.TestHostManager; this.dataSerializer = JsonDataSerializer.Instance; diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyExecutionManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyExecutionManager.cs index cc944f6bef..24e51c49e3 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyExecutionManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyExecutionManager.cs @@ -61,14 +61,20 @@ public CancellationTokenSource CancellationTokenSource /// /// /// The test session info. + /// The run settings. /// /// A flag indicating if debugging should be enabled or not. /// - public ProxyExecutionManager(TestSessionInfo testSessionInfo, bool debugEnabledForTestSession) + public ProxyExecutionManager( + TestSessionInfo testSessionInfo, + string runSettings, + bool debugEnabledForTestSession) { // Filling in test session info and proxy information. this.testSessionInfo = testSessionInfo; - this.ProxyOperationManager = TestSessionPool.Instance.TakeProxy(this.testSessionInfo); + this.ProxyOperationManager = TestSessionPool.Instance.TakeProxy( + this.testSessionInfo, + runSettings); // This should be set to enable debugging when we have test session info available. this.debugEnabledForTestSession = debugEnabledForTestSession; diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/Resources.Designer.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/Resources.Designer.cs index 24fab7e1c9..ecacf63ace 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/Resources.Designer.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/Resources.Designer.cs @@ -240,6 +240,15 @@ internal static string NonExistingExtensions { } } + /// + /// Looks up a localized string similar to Could not find an available proxy to match the original run settings.. + /// + internal static string NoProxyMatchesDescription { + get { + return ResourceManager.GetString("NoProxyMatchesDescription", resourceCulture); + } + } + /// /// Looks up a localized string similar to Proxy with id {0} is not managed by the current session manager.. /// diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/Resources.resx b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/Resources.resx index b92c863738..0b58ecd27a 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/Resources.resx +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/Resources.resx @@ -216,4 +216,7 @@ No suitable test runtime provider found for this run. + + Could not find an available proxy to match the original run settings. + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.cs.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.cs.xlf index 4a65a50bae..390de02342 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.cs.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.cs.xlf @@ -237,6 +237,11 @@ No suitable test runtime provider found for this run. + + Could not find an available proxy to match the original run settings. + Could not find an available proxy to match the original run settings. + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.de.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.de.xlf index db01a9e673..030199c1fd 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.de.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.de.xlf @@ -237,6 +237,11 @@ No suitable test runtime provider found for this run. + + Could not find an available proxy to match the original run settings. + Could not find an available proxy to match the original run settings. + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.es.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.es.xlf index c9a79acad2..ecf92b5139 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.es.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.es.xlf @@ -237,6 +237,11 @@ No suitable test runtime provider found for this run. + + Could not find an available proxy to match the original run settings. + Could not find an available proxy to match the original run settings. + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.fr.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.fr.xlf index d639bfb9b2..397fa5b4a3 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.fr.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.fr.xlf @@ -237,6 +237,11 @@ No suitable test runtime provider found for this run. + + Could not find an available proxy to match the original run settings. + Could not find an available proxy to match the original run settings. + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.it.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.it.xlf index e2ae6ec9bb..f3c86cf2bf 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.it.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.it.xlf @@ -237,6 +237,11 @@ No suitable test runtime provider found for this run. + + Could not find an available proxy to match the original run settings. + Could not find an available proxy to match the original run settings. + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ja.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ja.xlf index ab3da08b08..fa8f43078a 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ja.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ja.xlf @@ -237,6 +237,11 @@ No suitable test runtime provider found for this run. + + Could not find an available proxy to match the original run settings. + Could not find an available proxy to match the original run settings. + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ko.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ko.xlf index 9e6c27d35f..7f47bcbe1b 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ko.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ko.xlf @@ -237,6 +237,11 @@ No suitable test runtime provider found for this run. + + Could not find an available proxy to match the original run settings. + Could not find an available proxy to match the original run settings. + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.pl.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.pl.xlf index 29185e0250..98a67c8c35 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.pl.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.pl.xlf @@ -237,6 +237,11 @@ No suitable test runtime provider found for this run. + + Could not find an available proxy to match the original run settings. + Could not find an available proxy to match the original run settings. + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.pt-BR.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.pt-BR.xlf index a6720a38f7..8083d21083 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.pt-BR.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.pt-BR.xlf @@ -237,6 +237,11 @@ No suitable test runtime provider found for this run. + + Could not find an available proxy to match the original run settings. + Could not find an available proxy to match the original run settings. + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ru.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ru.xlf index 02e9f2dfbc..46c979f412 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ru.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ru.xlf @@ -237,6 +237,11 @@ No suitable test runtime provider found for this run. + + Could not find an available proxy to match the original run settings. + Could not find an available proxy to match the original run settings. + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.tr.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.tr.xlf index 6f14017a64..8bf557e504 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.tr.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.tr.xlf @@ -237,6 +237,11 @@ No suitable test runtime provider found for this run. + + Could not find an available proxy to match the original run settings. + Could not find an available proxy to match the original run settings. + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.xlf index 02671eb951..4ee8df296a 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.xlf @@ -148,6 +148,11 @@ No suitable test runtime provider found for this run. + + Could not find an available proxy to match the original run settings. + Could not find an available proxy to match the original run settings. + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.zh-Hans.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.zh-Hans.xlf index c08f6311c8..2440b91c05 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.zh-Hans.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.zh-Hans.xlf @@ -237,6 +237,11 @@ No suitable test runtime provider found for this run. + + Could not find an available proxy to match the original run settings. + Could not find an available proxy to match the original run settings. + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.zh-Hant.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.zh-Hant.xlf index 408faeb424..5faedf65ca 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.zh-Hant.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.zh-Hant.xlf @@ -237,6 +237,11 @@ No suitable test runtime provider found for this run. + + Could not find an available proxy to match the original run settings. + Could not find an available proxy to match the original run settings. + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/TestEngine.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/TestEngine.cs index e4730410db..3b28761f87 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/TestEngine.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/TestEngine.cs @@ -87,7 +87,8 @@ public IProxyDiscoveryManager GetDiscoveryManager( // In case we have an active test session, we always prefer the already // created proxies instead of the ones that need to be created on the spot. return new ProxyDiscoveryManager( - discoveryCriteria.TestSessionInfo); + discoveryCriteria.TestSessionInfo, + discoveryCriteria.RunSettings); } catch (InvalidOperationException ex) { @@ -97,7 +98,9 @@ public IProxyDiscoveryManager GetDiscoveryManager( // // WARNING: This should not normally happen and it raises questions // regarding the test session pool operation and consistency. - EqtTrace.Warning("ProxyDiscoveryManager failed: {0}", ex.ToString()); + EqtTrace.Warning( + "ProxyDiscoveryManager creation with test session failed: {0}", + ex.ToString()); } } @@ -164,6 +167,7 @@ public IProxyExecutionManager GetExecutionManager( // execution proxy and the one with data collection enabled. return new ProxyExecutionManager( testRunCriteria.TestSessionInfo, + testRunCriteria.TestRunSettings, testRunCriteria.DebugEnabledForTestSession); } catch (InvalidOperationException ex) @@ -174,7 +178,9 @@ public IProxyExecutionManager GetExecutionManager( // // WARNING: This should not normally happen and it raises questions // regarding the test session pool operation and consistency. - EqtTrace.Warning("ProxyExecutionManager failed: {0}", ex.ToString()); + EqtTrace.Warning( + "ProxyExecutionManager creation with test session failed: {0}", + ex.ToString()); } } @@ -264,18 +270,29 @@ public IProxyTestSessionManager GetTestSessionManager( CloseConnectionOnOperationComplete = false }; + // TODO (copoiena): For now we don't support data collection alongside test + // sessions. + // + // The reason for this is that, in the case of Code Coverage for example, the + // data collector needs to pass some environment variables to the testhost process + // before the testhost process is started. This means that the data collector must + // be running when the testhost process is spawned, however the testhost process + // should be spawned during build, and it's problematic to have the data collector + // running during build because it must instrument the .dll files that don't exist + // yet. return isDataCollectorEnabled - ? new ProxyOperationManagerWithDataCollection( - requestData, - requestSender, - hostManager, - new ProxyDataCollectionManager( - requestData, - testSessionCriteria.RunSettings, - testSessionCriteria.Sources)) - { - CloseRequestSenderChannelOnProxyClose = true - } + ? null + // ? new ProxyOperationManagerWithDataCollection( + // requestData, + // requestSender, + // hostManager, + // new ProxyDataCollectionManager( + // requestData, + // testSessionCriteria.RunSettings, + // testSessionCriteria.Sources)) + // { + // CloseRequestSenderChannelOnProxyClose = true + // } : new ProxyOperationManager( requestData, requestSender, @@ -285,7 +302,7 @@ public IProxyTestSessionManager GetTestSessionManager( }; }; - return new ProxyTestSessionManager(parallelLevel, proxyCreator); + return new ProxyTestSessionManager(testSessionCriteria, parallelLevel, proxyCreator); } /// diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/TestSession/ProxyTestSessionManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/TestSession/ProxyTestSessionManager.cs index 35f4bc72b4..f648f437fc 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/TestSession/ProxyTestSessionManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/TestSession/ProxyTestSessionManager.cs @@ -21,8 +21,10 @@ namespace Microsoft.VisualStudio.TestPlatform.CrossPlatEngine public class ProxyTestSessionManager : IProxyTestSessionManager { private readonly object lockObject = new object(); + private StartTestSessionCriteria testSessionCriteria; private int parallelLevel; private bool skipDefaultAdapters; + private TestSessionInfo testSessionInfo; private Func proxyCreator; private Queue availableProxyQueue; private IDictionary proxyMap; @@ -31,10 +33,15 @@ public class ProxyTestSessionManager : IProxyTestSessionManager /// Initializes a new instance of the class. /// /// + /// The test session criteria. /// The parallel level. /// The proxy creator. - public ProxyTestSessionManager(int parallelLevel, Func proxyCreator) + public ProxyTestSessionManager( + StartTestSessionCriteria criteria, + int parallelLevel, + Func proxyCreator) { + this.testSessionCriteria = criteria; this.parallelLevel = parallelLevel; this.proxyCreator = proxyCreator; @@ -49,11 +56,15 @@ public void Initialize(bool skipDefaultAdapters) } /// - public void StartSession( - StartTestSessionCriteria criteria, - ITestSessionEventsHandler eventsHandler) + public void StartSession(ITestSessionEventsHandler eventsHandler) { - var testSessionInfo = new TestSessionInfo(); + if (this.testSessionInfo != null) + { + return; + } + + this.testSessionInfo = new TestSessionInfo(); + var taskList = new Task[this.parallelLevel]; // Create all the proxies in parallel, one task per proxy. @@ -71,8 +82,8 @@ public void StartSession( // Start the test host associated to the proxy. operationManagerProxy.SetupChannel( - criteria.Sources, - criteria.RunSettings, + this.testSessionCriteria.Sources, + this.testSessionCriteria.RunSettings, eventsHandler); this.EnqueueNewProxy(operationManagerProxy); @@ -105,6 +116,11 @@ public void StartSession( /// public void StopSession() { + if (this.testSessionInfo == null) + { + return; + } + int index = 0; var taskList = new Task[this.proxyMap.Count]; @@ -120,14 +136,18 @@ public void StopSession() // Wait for proxy disposal to be over. Task.WaitAll(taskList); + + this.testSessionInfo = null; } /// /// Dequeues a proxy to be used either by discovery or execution. /// /// + /// The run settings. + /// /// The dequeued proxy. - public ProxyOperationManager DequeueProxy() + public ProxyOperationManager DequeueProxy(string runSettings) { ProxyOperationManagerContainer proxyContainer = null; @@ -142,6 +162,20 @@ public ProxyOperationManager DequeueProxy() CrossPlatResources.NoAvailableProxyForDeque)); } + // We must ensure the current run settings match the run settings from when the + // testhost was started. If not, throw an exception to force the caller to create + // its own proxy instead. + // + // TODO (copoiena): This run settings match is rudimentary. We should refine the + // match criteria in the future. + if (!this.testSessionCriteria.RunSettings.Equals(runSettings)) + { + throw new InvalidOperationException( + string.Format( + CultureInfo.CurrentUICulture, + CrossPlatResources.NoProxyMatchesDescription)); + } + // Get the proxy id from the available queue. var proxyId = this.availableProxyQueue.Dequeue(); diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/TestSession/TestSessionPool.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/TestSession/TestSessionPool.cs index 5110552b50..5488c36af8 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/TestSession/TestSessionPool.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/TestSession/TestSessionPool.cs @@ -115,9 +115,12 @@ public bool KillSession(TestSessionInfo testSessionInfo) /// /// /// The test session info object. + /// The run settings. /// /// The proxy object. - public ProxyOperationManager TakeProxy(TestSessionInfo testSessionInfo) + public ProxyOperationManager TakeProxy( + TestSessionInfo testSessionInfo, + string runSettings) { ProxyTestSessionManager sessionManager = null; lock (this.lockObject) @@ -130,7 +133,7 @@ public ProxyOperationManager TakeProxy(TestSessionInfo testSessionInfo) // // This can potentially throw, but let the caller handle this as it must recover from // this error by creating its own proxy. - return sessionManager.DequeueProxy(); + return sessionManager.DequeueProxy(runSettings); } /// diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSession.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSession.cs index 206c3aa009..6099de216c 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSession.cs +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSession.cs @@ -158,6 +158,13 @@ void RunTestsWithCustomTestHost( ITestRunEventsHandler testRunEventsHandler, ITestHostLauncher customTestHostLauncher); + /// + /// Stops the test session. + /// + /// + /// True if the session was successfuly stopped, false otherwise. + bool StopTestSession(); + /// /// Stops the test session. /// diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSessionAsync.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSessionAsync.cs index 9c2aff1496..9b1c45d014 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSessionAsync.cs +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSessionAsync.cs @@ -159,6 +159,13 @@ Task RunTestsWithCustomTestHostAsync( ITestRunEventsHandler testRunEventsHandler, ITestHostLauncher customTestHostLauncher); + /// + /// Stops the test session. + /// + /// + /// True if the session was successfuly stopped, false otherwise. + Task StopTestSessionAsync(); + /// /// Stops the test session. /// diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/TestSession.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/TestSession.cs index 40fb329639..215ac0e19b 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/TestSession.cs +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/TestSession.cs @@ -5,7 +5,7 @@ namespace Microsoft.TestPlatform.VsTestConsole.TranslationLayer { using System.Collections.Generic; using System.Threading.Tasks; - + using Microsoft.TestPlatform.VsTestConsole.TranslationLayer.Interfaces; using Microsoft.VisualStudio.TestPlatform.ObjectModel; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.Interfaces; @@ -18,7 +18,8 @@ namespace Microsoft.TestPlatform.VsTestConsole.TranslationLayer public class TestSession : ITestSession { private TestSessionInfo testSessionInfo; - private VsTestConsoleWrapper consoleWrapper; + private ITestSessionEventsHandler eventsHandler; + private IVsTestConsoleWrapper consoleWrapper; #region Constructors /// @@ -26,12 +27,15 @@ public class TestSession : ITestSession /// /// /// The test session info object. + /// The session event handler. /// The encapsulated console wrapper. public TestSession( TestSessionInfo testSessionInfo, - VsTestConsoleWrapper consoleWrapper) + ITestSessionEventsHandler eventsHandler, + IVsTestConsoleWrapper consoleWrapper) { this.testSessionInfo = testSessionInfo; + this.eventsHandler = eventsHandler; this.consoleWrapper = consoleWrapper; } #endregion @@ -203,6 +207,14 @@ public void RunTestsWithCustomTestHost( customTestHostLauncher); } + /// + public bool StopTestSession() + { + return this.consoleWrapper.StopTestSession( + this.testSessionInfo, + this.eventsHandler); + } + /// public bool StopTestSession(ITestSessionEventsHandler eventsHandler) { @@ -220,10 +232,12 @@ public async Task DiscoverTestsAsync( ITestDiscoveryEventsHandler discoveryEventsHandler) { await this.DiscoverTestsAsync( - sources, - discoverySettings, - options: null, - discoveryEventsHandler: new DiscoveryEventsHandleConverter(discoveryEventsHandler)); + sources, + discoverySettings, + options: null, + discoveryEventsHandler: + new DiscoveryEventsHandleConverter(discoveryEventsHandler)) + .ConfigureAwait(false); } /// @@ -238,7 +252,7 @@ await this.consoleWrapper.DiscoverTestsAsync( discoverySettings, options, this.testSessionInfo, - discoveryEventsHandler); + discoveryEventsHandler).ConfigureAwait(false); } /// @@ -251,7 +265,7 @@ await this.RunTestsAsync( sources, runSettings, options: null, - testRunEventsHandler); + testRunEventsHandler).ConfigureAwait(false); } /// @@ -266,7 +280,7 @@ await this.consoleWrapper.RunTestsAsync( runSettings, options, this.testSessionInfo, - testRunEventsHandler); + testRunEventsHandler).ConfigureAwait(false); } /// @@ -279,7 +293,7 @@ await this.RunTestsAsync( testCases, runSettings, options: null, - testRunEventsHandler); + testRunEventsHandler).ConfigureAwait(false); } /// @@ -294,7 +308,7 @@ await this.consoleWrapper.RunTestsAsync( runSettings, options, this.testSessionInfo, - testRunEventsHandler); + testRunEventsHandler).ConfigureAwait(false); } /// @@ -309,7 +323,7 @@ await this.RunTestsWithCustomTestHostAsync( runSettings, options: null, testRunEventsHandler, - customTestHostLauncher); + customTestHostLauncher).ConfigureAwait(false); } /// @@ -326,7 +340,7 @@ await this.consoleWrapper.RunTestsWithCustomTestHostAsync( options, this.testSessionInfo, testRunEventsHandler, - customTestHostLauncher); + customTestHostLauncher).ConfigureAwait(false); } /// @@ -341,7 +355,7 @@ await this.RunTestsWithCustomTestHostAsync( runSettings, options: null, testRunEventsHandler, - customTestHostLauncher); + customTestHostLauncher).ConfigureAwait(false); } /// @@ -358,7 +372,13 @@ await this.consoleWrapper.RunTestsWithCustomTestHostAsync( options, this.testSessionInfo, testRunEventsHandler, - customTestHostLauncher); + customTestHostLauncher).ConfigureAwait(false); + } + + /// + public async Task StopTestSessionAsync() + { + return await this.StopTestSessionAsync(this.eventsHandler).ConfigureAwait(false); } /// @@ -366,7 +386,7 @@ public async Task StopTestSessionAsync(ITestSessionEventsHandler eventsHan { return await this.consoleWrapper.StopTestSessionAsync( this.testSessionInfo, - eventsHandler); + eventsHandler).ConfigureAwait(false); } #endregion } diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleWrapper.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleWrapper.cs index d65a2d92d9..9072ef2ae2 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleWrapper.cs +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleWrapper.cs @@ -219,6 +219,7 @@ public ITestSession StartTestSession( options, eventsHandler, testHostLauncher), + eventsHandler, this); } @@ -621,6 +622,7 @@ await this.requestSender.StartTestSessionAsync( options, eventsHandler, testHostLauncher).ConfigureAwait(false), + eventsHandler, this); } From 3c2e26bded17f350c7364eee1aec08f71190a00e Mon Sep 17 00:00:00 2001 From: Codrin Poienaru Date: Mon, 25 Jan 2021 18:46:16 +0100 Subject: [PATCH 13/26] Refactored SetupChannel --- .../Client/ProxyOperationManager.cs | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyOperationManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyOperationManager.cs index 0d906b9a7a..02aac015ac 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyOperationManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyOperationManager.cs @@ -219,10 +219,9 @@ public virtual bool SetupChannel(IEnumerable sources, string runSettings try { // Launch the test host. - var hostLaunchedTask = this.TestHostManager.LaunchTestHostAsync( + this.testHostLaunched = this.TestHostManager.LaunchTestHostAsync( testHostStartInfo, - this.CancellationTokenSource.Token); - this.testHostLaunched = hostLaunchedTask.Result; + this.CancellationTokenSource.Token).Result; if (this.testHostLaunched && testHostConnectionInfo.Role == ConnectionRole.Host) { @@ -245,9 +244,11 @@ public virtual bool SetupChannel(IEnumerable sources, string runSettings var hostDebugEnabled = Environment.GetEnvironmentVariable("VSTEST_HOST_DEBUG"); var nativeHostDebugEnabled = Environment.GetEnvironmentVariable("VSTEST_HOST_NATIVE_DEBUG"); - if (!string.IsNullOrEmpty(hostDebugEnabled) && hostDebugEnabled.Equals("1", StringComparison.Ordinal) || - new PlatformEnvironment().OperatingSystem.Equals(PlatformOperatingSystem.Windows) && - !string.IsNullOrEmpty(nativeHostDebugEnabled) && nativeHostDebugEnabled.Equals("1", StringComparison.Ordinal)) + if ((!string.IsNullOrEmpty(hostDebugEnabled) + && hostDebugEnabled.Equals("1", StringComparison.Ordinal)) + || (new PlatformEnvironment().OperatingSystem.Equals(PlatformOperatingSystem.Windows) + && !string.IsNullOrEmpty(nativeHostDebugEnabled) + && nativeHostDebugEnabled.Equals("1", StringComparison.Ordinal))) { ConsoleOutput.Instance.WriteLine( CrossPlatEngineResources.HostDebuggerWarning, @@ -265,8 +266,8 @@ public virtual bool SetupChannel(IEnumerable sources, string runSettings } // If test host does not launch then throw exception, otherwise wait for connection. - if (!this.testHostLaunched || - !this.RequestSender.WaitForRequestHandlerConnection( + if (!this.testHostLaunched + || !this.RequestSender.WaitForRequestHandlerConnection( connTimeout * 1000, this.CancellationTokenSource.Token)) { @@ -287,7 +288,6 @@ public virtual bool SetupChannel(IEnumerable sources, string runSettings // Older test hosts are not aware of protocol version check, hence we should not be // sending VersionCheck message to these test hosts. this.CompatIssueWithVersionCheckAndRunsettings(); - if (this.versionCheckRequired) { this.RequestSender.CheckVersionWithTestHost(); @@ -372,6 +372,7 @@ public virtual void Close() /// public virtual TestProcessStartInfo UpdateTestProcessStartInfo(TestProcessStartInfo testProcessStartInfo) { + // TODO (copoiena): If called and testhost is already running, we should restart. if (this.baseProxy == null) { // Update Telemetry Opt in status because by default in Test Host Telemetry is opted out From ef039a255beba593295569e41bbfdaeffcd13909 Mon Sep 17 00:00:00 2001 From: Codrin Poienaru Date: Wed, 27 Jan 2021 19:38:58 +0100 Subject: [PATCH 14/26] Implemented a disposable TestSession --- .../Interfaces/ITestSession.cs | 3 +- .../Interfaces/ITestSessionAsync.cs | 4 +- .../TestSession.cs | 78 ++++++++++++++++--- 3 files changed, 72 insertions(+), 13 deletions(-) diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSession.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSession.cs index 6099de216c..c7e174d722 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSession.cs +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSession.cs @@ -3,6 +3,7 @@ namespace Microsoft.VisualStudio.TestPlatform.VsTestConsole.TranslationLayer.Interfaces { + using System; using System.Collections.Generic; using Microsoft.VisualStudio.TestPlatform.ObjectModel; @@ -13,7 +14,7 @@ namespace Microsoft.VisualStudio.TestPlatform.VsTestConsole.TranslationLayer.Int /// Defines a test session that can be used to make calls to the vstest.console /// process. /// - public interface ITestSession : ITestSessionAsync + public interface ITestSession : IDisposable, ITestSessionAsync { /// /// Starts test discovery. diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSessionAsync.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSessionAsync.cs index 9b1c45d014..dc2f9d125d 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSessionAsync.cs +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSessionAsync.cs @@ -3,8 +3,10 @@ namespace Microsoft.VisualStudio.TestPlatform.VsTestConsole.TranslationLayer.Interfaces { + using System; using System.Collections.Generic; using System.Threading.Tasks; + using Microsoft.VisualStudio.TestPlatform.ObjectModel; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.Interfaces; @@ -13,7 +15,7 @@ namespace Microsoft.VisualStudio.TestPlatform.VsTestConsole.TranslationLayer.Int /// Defines a test session that can be used to make async calls to the vstest.console /// process. /// - public interface ITestSessionAsync + public interface ITestSessionAsync : IDisposable { /// /// Starts test discovery. diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/TestSession.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/TestSession.cs index 215ac0e19b..c5f80812ed 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/TestSession.cs +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/TestSession.cs @@ -3,8 +3,10 @@ namespace Microsoft.TestPlatform.VsTestConsole.TranslationLayer { + using System; using System.Collections.Generic; using System.Threading.Tasks; + using Microsoft.TestPlatform.VsTestConsole.TranslationLayer.Interfaces; using Microsoft.VisualStudio.TestPlatform.ObjectModel; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client; @@ -17,9 +19,11 @@ namespace Microsoft.TestPlatform.VsTestConsole.TranslationLayer /// public class TestSession : ITestSession { + private bool disposed = false; + private TestSessionInfo testSessionInfo; - private ITestSessionEventsHandler eventsHandler; - private IVsTestConsoleWrapper consoleWrapper; + private readonly ITestSessionEventsHandler eventsHandler; + private readonly IVsTestConsoleWrapper consoleWrapper; #region Constructors /// @@ -38,6 +42,36 @@ public TestSession( this.eventsHandler = eventsHandler; this.consoleWrapper = consoleWrapper; } + + /// + /// Destroys the current instance of the class. + /// + ~TestSession() => this.Dispose(false); + + /// + /// Disposes of the current instance of the class. + /// + public void Dispose() + { + this.Dispose(true); + GC.SuppressFinalize(this); + } + + /// + /// Disposes of the current instance of the class. + /// + /// + /// Indicates if managed resources should be disposed. + protected virtual void Dispose(bool disposing) + { + if (this.disposed) + { + return; + } + + this.StopTestSession(); + this.disposed = true; + } #endregion #region ITestSession @@ -210,17 +244,27 @@ public void RunTestsWithCustomTestHost( /// public bool StopTestSession() { - return this.consoleWrapper.StopTestSession( - this.testSessionInfo, - this.eventsHandler); + return this.StopTestSession(this.eventsHandler); } /// public bool StopTestSession(ITestSessionEventsHandler eventsHandler) { - return this.consoleWrapper.StopTestSession( - this.testSessionInfo, - eventsHandler); + if (this.testSessionInfo == null) + { + return true; + } + + try + { + return this.consoleWrapper.StopTestSession( + this.testSessionInfo, + eventsHandler); + } + finally + { + this.testSessionInfo = null; + } } #endregion @@ -384,9 +428,21 @@ public async Task StopTestSessionAsync() /// public async Task StopTestSessionAsync(ITestSessionEventsHandler eventsHandler) { - return await this.consoleWrapper.StopTestSessionAsync( - this.testSessionInfo, - eventsHandler).ConfigureAwait(false); + if (this.testSessionInfo == null) + { + return true; + } + + try + { + return await this.consoleWrapper.StopTestSessionAsync( + this.testSessionInfo, + eventsHandler).ConfigureAwait(false); + } + finally + { + this.testSessionInfo = null; + } } #endregion } From 3e431773add41afd0796fb145b293ff88cfc44da Mon Sep 17 00:00:00 2001 From: Codrin Poienaru Date: Tue, 31 Aug 2021 18:26:58 +0200 Subject: [PATCH 15/26] Checked out loc changes from main --- .../Resources/xlf/Resources.cs.xlf | 334 +++++++++--------- .../Resources/xlf/Resources.de.xlf | 334 +++++++++--------- .../Resources/xlf/Resources.es.xlf | 334 +++++++++--------- .../Resources/xlf/Resources.fr.xlf | 334 +++++++++--------- .../Resources/xlf/Resources.it.xlf | 334 +++++++++--------- .../Resources/xlf/Resources.ja.xlf | 334 +++++++++--------- .../Resources/xlf/Resources.ko.xlf | 334 +++++++++--------- .../Resources/xlf/Resources.pl.xlf | 334 +++++++++--------- .../Resources/xlf/Resources.pt-BR.xlf | 334 +++++++++--------- .../Resources/xlf/Resources.ru.xlf | 334 +++++++++--------- .../Resources/xlf/Resources.tr.xlf | 334 +++++++++--------- .../Resources/xlf/Resources.zh-Hans.xlf | 334 +++++++++--------- .../Resources/xlf/Resources.zh-Hant.xlf | 334 +++++++++--------- 13 files changed, 2106 insertions(+), 2236 deletions(-) diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.cs.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.cs.xlf index 0e7960aeca..8daa2d861a 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.cs.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.cs.xlf @@ -1,172 +1,162 @@ - - - - - - Exception occurred while instantiating discoverer : {0} - - Při vytváření instance nástroje zjišťování došlo k výjimce: {0} - - - Multiple test adapters with the same uri '{0}' were found. Ignoring adapter '{1}'. Please uninstall the conflicting adapter(s) to avoid this warning. - {0} is the unique identifier of test adapter. {1} is the name of the test adapter that shares a unique identifier with a previously loaded adapter. - Našlo se více adaptérů testů se stejným identifikátorem URI {0}. Ignoruje se adaptér {1}. Pokud se chcete tomuto upozornění vyhnout, odinstalujte prosím konfliktní adaptéry. - - - Ignoring the specified duplicate source '{0}'. - - Ignoruje se zadaný duplicitní zdroj {0}. - - - An exception occurred while test discoverer '{0}' was loading tests. Exception: {1} - - V době, kdy nástroj zjišťování testů {0} načítal testy, došlo k výjimce. Výjimka: {1} - - - An exception occurred while invoking executor '{0}': {1} - - Při volání prováděcího modulu {0} došlo k výjimce: {1} - - - Could not find file {0}. - - Nepovedlo se najít soubor {0}. - - - Host debugging is enabled. Please attach debugger to testhost process to continue. - Host, testhost are key words, it should not be localized - Je povolené ladění hostitele. Pokud chcete pokračovat, připojte prosím ladicí program k procesu testhost. - - - Ignoring the test executor corresponding to test discoverer {0} because the discoverer does not have the DefaultExecutorUri attribute . You might need to re-install the test adapter add-in. - - Ignoruje se prováděcí modul testování, který odpovídá nástroji zjišťování testů {0}, protože nástroj zjišťování nemá atribut DefaultExecutorUri. Možná bude nutné přeinstalovat doplněk adaptéru testu. - - - Failed to initialize client proxy: could not connect to test process. - - Nepovedlo se inicializovat proxy klienta: nešlo se připojit k procesu testu. - - - This operation is not allowed in the context of a non-debug run. - - Tato operace se v kontextu běhu bez ladění nepovoluje. - - - Could not find test executor with URI '{0}'. Make sure that the test executor is installed and supports .net runtime version {1}. - {0} - Executor uri String {1}- Version - .net Version Eg:-2.0.50727.00 - Nepovedlo se najít prováděcí modul testování s identifikátorem URI {0}. Ujistěte se, že je prováděcí modul testování nainstalovaný a že podporuje .NET runtime verze {1}. - - - None of the specified source(s) '{0}' is valid. Fix the above errors/warnings and then try again. - - Žádný ze zadaných zdrojů {0} není platný. Opravte chyby/upozornění výše a zkuste to znovu. - - - , - - , - - - No tests matched the filter because it contains one or more properties that are not valid ({0}). Specify filter expression containing valid properties ({1}). - - Filtru neodpovídá žádný test, protože obsahuje nejméně jednu vlastnost, která není platná ({0}). Zadejte výraz filtru, který obsahuje platné vlastnosti ({1}). - - - Could not find {0}. Make sure that the dotnet is installed on the machine. - Nejde najít {0}. Ujistěte se, že na počítači je nainstalovaný dotnet. - - - - Testhost process exited with error: {0}. Please check the diagnostic logs for more information. - Proces testhost se ukončil s chybou: {0}. Další informace najdete v diagnostických protokolech. - - - - DataCollector debugging is enabled. Please attach debugger to datacollector process to continue. - Je povolené ladění kolekce dat. Pokud chcete pokračovat, připojte prosím ladicí program k procesu kolekce dat. - - - - No test is available in {0}. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again. - V {0} nejsou dostupné žádné testy. Ujistěte se, že nástroje pro zjišťování a provádění testů jsou zaregistrované a že jsou vhodně zvolená nastavení verzí platformy a architektury, a zkuste to znovu. - - - - Logging TestHost Diagnostics in file: {0} - Protokolování diagnostiky TestHost v souboru: {0} - - - - Failed to launch testhost with error: {0} - Nepovedlo se spustit hostitele testu kvůli této chybě: {0} - - - - ExecutionThreadApartmentState option not supported for framework: {0}. - Možnost ExecutionThreadApartmentState se pro rozhraní nepodporuje: {0}. - - - - You are using an older version of Microsoft.NET.Test.Sdk. Kindly move to a version equal or greater than 15.3.0. - Používáte starší verzi sady Microsoft.NET.Test.Sdk. Přejděte prosím na verzi 15.3.0 nebo vyšší. - - - - Could not find extensions: {0} - Nepovedlo se najít rozšíření: {0} - - - - Adapter lookup is being changed, please follow https://github.com/Microsoft/vstest-docs/blob/main/RFCs/0022-User-Specified-TestAdapter-Lookup.md#roadmap for more details. - Mění se vyhledávání adaptéru. Pro další informace se podívejte sem: https://github.com/Microsoft/vstest-docs/blob/main/RFCs/0022-User-Specified-TestAdapter-Lookup.md#roadmap - - - - No test matches the given testcase filter `{0}` in {1} - Žádný test neodpovídá danému filtru testovacích případů {0} v: {1} - - - - Discovery of tests cancelled. - Zjišťování testů bylo zrušeno. - - - - Cannot attach the debugger to the default test host with process ID: {0}. - Ladicí program se nedá připojit k výchozímu hostiteli testů s ID procesu {0}. - - - - {0} Access denied while trying to create "TestResults" folder in mentioned location. You are getting this exception because you are running vstest.console.exe from a folder which requires having write access. To solve the issue: please run vstest.console.exe from a folder where you have write privileges. - {0} Při pokusu o vytvoření složky TestResults v uvedeném umístění došlo k odepření přístupu. Tato výjimka se vyvolala, protože spouštíte vstest.console.exe ze složky, která vyžaduje, abyste měli přístup pro zápis. Pokud chcete problém vyřešit, spusťte prosím vstest.console.exe ze složky, ve které máte oprávnění k zápisu. - - - - Could not find an available proxy to deque. - Nepovedlo se najít dostupný proxy server, který se má odebrat z fronty. - - - - Proxy with id {0} is not managed by the current session manager. - Aktuální správce relace nespravuje proxy s ID {0}. - - - - Proxy with id {0} is already available and cannot be re-enqueued. - Proxy s ID {0} je už k dispozici a nedá se znovu zařadit do fronty. - - - - No suitable test runtime provider found for this run. - No suitable test runtime provider found for this run. - - - - Could not find an available proxy to match the original run settings. - Could not find an available proxy to match the original run settings. - - - - - + + + + + + Exception occurred while instantiating discoverer : {0} + + Při vytváření instance nástroje zjišťování došlo k výjimce: {0} + + + Multiple test adapters with the same uri '{0}' were found. Ignoring adapter '{1}'. Please uninstall the conflicting adapter(s) to avoid this warning. + {0} is the unique identifier of test adapter. {1} is the name of the test adapter that shares a unique identifier with a previously loaded adapter. + Našlo se více adaptérů testů se stejným identifikátorem URI {0}. Ignoruje se adaptér {1}. Pokud se chcete tomuto upozornění vyhnout, odinstalujte prosím konfliktní adaptéry. + + + Ignoring the specified duplicate source '{0}'. + + Ignoruje se zadaný duplicitní zdroj {0}. + + + An exception occurred while test discoverer '{0}' was loading tests. Exception: {1} + + V době, kdy nástroj zjišťování testů {0} načítal testy, došlo k výjimce. Výjimka: {1} + + + An exception occurred while invoking executor '{0}': {1} + + Při volání prováděcího modulu {0} došlo k výjimce: {1} + + + Could not find file {0}. + + Nepovedlo se najít soubor {0}. + + + Host debugging is enabled. Please attach debugger to testhost process to continue. + Host, testhost are key words, it should not be localized + Je povolené ladění hostitele. Pokud chcete pokračovat, připojte prosím ladicí program k procesu testhost. + + + Ignoring the test executor corresponding to test discoverer {0} because the discoverer does not have the DefaultExecutorUri attribute . You might need to re-install the test adapter add-in. + + Ignoruje se prováděcí modul testování, který odpovídá nástroji zjišťování testů {0}, protože nástroj zjišťování nemá atribut DefaultExecutorUri. Možná bude nutné přeinstalovat doplněk adaptéru testu. + + + Failed to initialize client proxy: could not connect to test process. + + Nepovedlo se inicializovat proxy klienta: nešlo se připojit k procesu testu. + + + This operation is not allowed in the context of a non-debug run. + + Tato operace se v kontextu běhu bez ladění nepovoluje. + + + Could not find test executor with URI '{0}'. Make sure that the test executor is installed and supports .net runtime version {1}. + {0} - Executor uri String {1}- Version - .net Version Eg:-2.0.50727.00 + Nepovedlo se najít prováděcí modul testování s identifikátorem URI {0}. Ujistěte se, že je prováděcí modul testování nainstalovaný a že podporuje .NET runtime verze {1}. + + + None of the specified source(s) '{0}' is valid. Fix the above errors/warnings and then try again. + + Žádný ze zadaných zdrojů {0} není platný. Opravte chyby/upozornění výše a zkuste to znovu. + + + , + + , + + + No tests matched the filter because it contains one or more properties that are not valid ({0}). Specify filter expression containing valid properties ({1}). + + Filtru neodpovídá žádný test, protože obsahuje nejméně jednu vlastnost, která není platná ({0}). Zadejte výraz filtru, který obsahuje platné vlastnosti ({1}). + + + Could not find {0}. Make sure that the dotnet is installed on the machine. + Nejde najít {0}. Ujistěte se, že na počítači je nainstalovaný dotnet. + + + + Testhost process exited with error: {0}. Please check the diagnostic logs for more information. + Proces testhost se ukončil s chybou: {0}. Další informace najdete v diagnostických protokolech. + + + + DataCollector debugging is enabled. Please attach debugger to datacollector process to continue. + Je povolené ladění kolekce dat. Pokud chcete pokračovat, připojte prosím ladicí program k procesu kolekce dat. + + + + No test is available in {0}. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again. + V {0} nejsou dostupné žádné testy. Ujistěte se, že nástroje pro zjišťování a provádění testů jsou zaregistrované a že jsou vhodně zvolená nastavení verzí platformy a architektury, a zkuste to znovu. + + + + Logging TestHost Diagnostics in file: {0} + Protokolování diagnostiky TestHost v souboru: {0} + + + + Failed to launch testhost with error: {0} + Nepovedlo se spustit hostitele testu kvůli této chybě: {0} + + + + ExecutionThreadApartmentState option not supported for framework: {0}. + Možnost ExecutionThreadApartmentState se pro rozhraní nepodporuje: {0}. + + + + You are using an older version of Microsoft.NET.Test.Sdk. Kindly move to a version equal or greater than 15.3.0. + Používáte starší verzi sady Microsoft.NET.Test.Sdk. Přejděte prosím na verzi 15.3.0 nebo vyšší. + + + + Could not find extensions: {0} + Nepovedlo se najít rozšíření: {0} + + + + Adapter lookup is being changed, please follow https://github.com/Microsoft/vstest-docs/blob/main/RFCs/0022-User-Specified-TestAdapter-Lookup.md#roadmap for more details. + Mění se vyhledávání adaptéru. Pro další informace se podívejte sem: https://github.com/Microsoft/vstest-docs/blob/main/RFCs/0022-User-Specified-TestAdapter-Lookup.md#roadmap + + + + No test matches the given testcase filter `{0}` in {1} + Žádný test neodpovídá danému filtru testovacích případů {0} v: {1} + + + + Discovery of tests cancelled. + Zjišťování testů bylo zrušeno. + + + + Cannot attach the debugger to the default test host with process ID: {0}. + Ladicí program se nedá připojit k výchozímu hostiteli testů s ID procesu {0}. + + + + {0} Access denied while trying to create "TestResults" folder in mentioned location. You are getting this exception because you are running vstest.console.exe from a folder which requires having write access. To solve the issue: please run vstest.console.exe from a folder where you have write privileges. + {0} Při pokusu o vytvoření složky TestResults v uvedeném umístění došlo k odepření přístupu. Tato výjimka se vyvolala, protože spouštíte vstest.console.exe ze složky, která vyžaduje, abyste měli přístup pro zápis. Pokud chcete problém vyřešit, spusťte prosím vstest.console.exe ze složky, ve které máte oprávnění k zápisu. + + + + Could not find an available proxy to deque. + Nepovedlo se najít dostupný proxy server, který se má odebrat z fronty. + + + + Proxy with id {0} is not managed by the current session manager. + Aktuální správce relace nespravuje proxy s ID {0}. + + + + Proxy with id {0} is already available and cannot be re-enqueued. + Proxy s ID {0} je už k dispozici a nedá se znovu zařadit do fronty. + + + + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.de.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.de.xlf index dd81c61852..ae770775d9 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.de.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.de.xlf @@ -1,172 +1,162 @@ - - - - - - Exception occurred while instantiating discoverer : {0} - - Ausnahme beim Instanziieren des Discoverers: {0} - - - Multiple test adapters with the same uri '{0}' were found. Ignoring adapter '{1}'. Please uninstall the conflicting adapter(s) to avoid this warning. - {0} is the unique identifier of test adapter. {1} is the name of the test adapter that shares a unique identifier with a previously loaded adapter. - Mehrere Testadapter mit dem gleichen URI "{0}" wurden gefunden. Der Adapter "{1}" wird ignoriert. Deinstallieren Sie die in Konflikt stehenden Adapter, um diese Warnung zu vermeiden. - - - Ignoring the specified duplicate source '{0}'. - - Die angegebene doppelte Quelle "{0}" wird ignoriert. - - - An exception occurred while test discoverer '{0}' was loading tests. Exception: {1} - - Ausnahme beim Laden von Tests durch den Testdiscoverer "{0}". Ausnahme: {1} - - - An exception occurred while invoking executor '{0}': {1} - - Ausnahme beim Aufrufen von Executor "{0}": {1} - - - Could not find file {0}. - - Die Datei "{0}" wurde nicht gefunden. - - - Host debugging is enabled. Please attach debugger to testhost process to continue. - Host, testhost are key words, it should not be localized - Hostdebuggen ist aktiviert. Fügen Sie den Debugger an den Testhostprozess an, um den Vorgang fortzusetzen. - - - Ignoring the test executor corresponding to test discoverer {0} because the discoverer does not have the DefaultExecutorUri attribute . You might need to re-install the test adapter add-in. - - Der Testexecutor, der dem Testdiscoverer "{0}" entspricht, wird ignoriert, weil der Discoverer nicht das DefaultExecutorUri-Attribut aufweist. Sie müssen ggf. das Testadapter-Add-In erneut installieren. - - - Failed to initialize client proxy: could not connect to test process. - - Fehler beim Initialisieren des Clientproxys: Es konnte keine Verbindung mit dem Testprozess hergestellt werden. - - - This operation is not allowed in the context of a non-debug run. - - Dieser Vorgang ist im Kontext einer Nichtdebugausführung unzulässig. - - - Could not find test executor with URI '{0}'. Make sure that the test executor is installed and supports .net runtime version {1}. - {0} - Executor uri String {1}- Version - .net Version Eg:-2.0.50727.00 - Der Testexecutor mit dem URI "{0}" wurde nicht gefunden. Stellen Sie sicher, dass der Testexecutor installiert ist und .NET Runtime-Version {1} unterstützt. - - - None of the specified source(s) '{0}' is valid. Fix the above errors/warnings and then try again. - - Keine der angegebenen Quellen "{0}" ist gültig. Beheben Sie die oben aufgeführten Fehler/Warnungen, und versuchen Sie es erneut. - - - , - - , - - - No tests matched the filter because it contains one or more properties that are not valid ({0}). Specify filter expression containing valid properties ({1}). - - Es stimmten keine Tests mit dem Filter überein, weil er mindestens eine ungültige Eigenschaft enthält ({0}). Geben Sie einen Filterausdruck mit gültigen Eigenschaften an ({1}). - - - Could not find {0}. Make sure that the dotnet is installed on the machine. - {0} wurde nicht gefunden. Stellen Sie sicher, dass das dotnet auf dem Computer installiert ist. - - - - Testhost process exited with error: {0}. Please check the diagnostic logs for more information. - Der TestHost-Prozess wurde mit folgendem Fehler beendet: {0}. Weitere Informationen finden Sie in den Diagnoseprotokollen. - - - - DataCollector debugging is enabled. Please attach debugger to datacollector process to continue. - DataCollector-Debugging ist aktiviert. Fügen Sie den Debugger an den Datensammlerprozess an, um den Vorgang fortzusetzen. - - - - No test is available in {0}. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again. - In "{0}" ist kein Test verfügbar. Stellen Sie sicher, dass die Testdiscoverer und -executors registriert und die Versionseinstellungen für Plattform und Framework richtig sind, und wiederholen Sie den Vorgang. - - - - Logging TestHost Diagnostics in file: {0} - Die TestHost-Diagnose wird in der Datei {0} protokolliert. - - - - Failed to launch testhost with error: {0} - Fehler beim Starten von Testhost: {0} - - - - ExecutionThreadApartmentState option not supported for framework: {0}. - Die ExecutionThreadApartmentState-Option wird für das Framework nicht unterstützt: {0}. - - - - You are using an older version of Microsoft.NET.Test.Sdk. Kindly move to a version equal or greater than 15.3.0. - Sie verwenden eine ältere Version von Microsoft.NET.Test.Sdk. Wechseln Sie zu Version 15.3.0 oder höher. - - - - Could not find extensions: {0} - Erweiterungen nicht gefunden: {0} - - - - Adapter lookup is being changed, please follow https://github.com/Microsoft/vstest-docs/blob/main/RFCs/0022-User-Specified-TestAdapter-Lookup.md#roadmap for more details. - Die Adaptersuche wird geändert. Weitere Informationen finden Sie unter https://github.com/Microsoft/vstest-docs/blob/main/RFCs/0022-User-Specified-TestAdapter-Lookup.md#roadmap. - - - - No test matches the given testcase filter `{0}` in {1} - Kein Test entspricht dem angegebenen Testfallfilter "{0}" in "{1}". - - - - Discovery of tests cancelled. - Die Ermittlung von Tests wurde abgebrochen. - - - - Cannot attach the debugger to the default test host with process ID: {0}. - Der Debugger kann nicht an den Standardtesthost mit der Prozess-ID {0} angefügt werden. - - - - {0} Access denied while trying to create "TestResults" folder in mentioned location. You are getting this exception because you are running vstest.console.exe from a folder which requires having write access. To solve the issue: please run vstest.console.exe from a folder where you have write privileges. - {0} Beim Erstellen des Ordners "TestResults" am angegebenen Speicherort wurde der Zugriff verweigert. Sie erhalten diese Ausnahme, weil Sie "vstest.console.exe" in einem Ordner ausführen, für den Schreibzugriff erforderlich ist. So beheben Sie das Problem: Führen Sie "vstest.console.exe" in einem Ordner aus, für den Sie Schreibberechtigungen besitzen. - - - - Could not find an available proxy to deque. - Es wurde kein verfügbarer Proxy für die Deque gefunden. - - - - Proxy with id {0} is not managed by the current session manager. - Der Proxy mit der ID {0} wird nicht vom aktuellen Sitzungs-Manager verwaltet. - - - - Proxy with id {0} is already available and cannot be re-enqueued. - Der Proxy mit der ID {0} ist bereits verfügbar und kann nicht erneut in die Warteschlange eingereiht werden. - - - - No suitable test runtime provider found for this run. - No suitable test runtime provider found for this run. - - - - Could not find an available proxy to match the original run settings. - Could not find an available proxy to match the original run settings. - - - - - + + + + + + Exception occurred while instantiating discoverer : {0} + + Ausnahme beim Instanziieren des Discoverers: {0} + + + Multiple test adapters with the same uri '{0}' were found. Ignoring adapter '{1}'. Please uninstall the conflicting adapter(s) to avoid this warning. + {0} is the unique identifier of test adapter. {1} is the name of the test adapter that shares a unique identifier with a previously loaded adapter. + Mehrere Testadapter mit dem gleichen URI "{0}" wurden gefunden. Der Adapter "{1}" wird ignoriert. Deinstallieren Sie die in Konflikt stehenden Adapter, um diese Warnung zu vermeiden. + + + Ignoring the specified duplicate source '{0}'. + + Die angegebene doppelte Quelle "{0}" wird ignoriert. + + + An exception occurred while test discoverer '{0}' was loading tests. Exception: {1} + + Ausnahme beim Laden von Tests durch den Testdiscoverer "{0}". Ausnahme: {1} + + + An exception occurred while invoking executor '{0}': {1} + + Ausnahme beim Aufrufen von Executor "{0}": {1} + + + Could not find file {0}. + + Die Datei "{0}" wurde nicht gefunden. + + + Host debugging is enabled. Please attach debugger to testhost process to continue. + Host, testhost are key words, it should not be localized + Hostdebuggen ist aktiviert. Fügen Sie den Debugger an den Testhostprozess an, um den Vorgang fortzusetzen. + + + Ignoring the test executor corresponding to test discoverer {0} because the discoverer does not have the DefaultExecutorUri attribute . You might need to re-install the test adapter add-in. + + Der Testexecutor, der dem Testdiscoverer "{0}" entspricht, wird ignoriert, weil der Discoverer nicht das DefaultExecutorUri-Attribut aufweist. Sie müssen ggf. das Testadapter-Add-In erneut installieren. + + + Failed to initialize client proxy: could not connect to test process. + + Fehler beim Initialisieren des Clientproxys: Es konnte keine Verbindung mit dem Testprozess hergestellt werden. + + + This operation is not allowed in the context of a non-debug run. + + Dieser Vorgang ist im Kontext einer Nichtdebugausführung unzulässig. + + + Could not find test executor with URI '{0}'. Make sure that the test executor is installed and supports .net runtime version {1}. + {0} - Executor uri String {1}- Version - .net Version Eg:-2.0.50727.00 + Der Testexecutor mit dem URI "{0}" wurde nicht gefunden. Stellen Sie sicher, dass der Testexecutor installiert ist und .NET Runtime-Version {1} unterstützt. + + + None of the specified source(s) '{0}' is valid. Fix the above errors/warnings and then try again. + + Keine der angegebenen Quellen "{0}" ist gültig. Beheben Sie die oben aufgeführten Fehler/Warnungen, und versuchen Sie es erneut. + + + , + + , + + + No tests matched the filter because it contains one or more properties that are not valid ({0}). Specify filter expression containing valid properties ({1}). + + Es stimmten keine Tests mit dem Filter überein, weil er mindestens eine ungültige Eigenschaft enthält ({0}). Geben Sie einen Filterausdruck mit gültigen Eigenschaften an ({1}). + + + Could not find {0}. Make sure that the dotnet is installed on the machine. + {0} wurde nicht gefunden. Stellen Sie sicher, dass das dotnet auf dem Computer installiert ist. + + + + Testhost process exited with error: {0}. Please check the diagnostic logs for more information. + Der TestHost-Prozess wurde mit folgendem Fehler beendet: {0}. Weitere Informationen finden Sie in den Diagnoseprotokollen. + + + + DataCollector debugging is enabled. Please attach debugger to datacollector process to continue. + DataCollector-Debugging ist aktiviert. Fügen Sie den Debugger an den Datensammlerprozess an, um den Vorgang fortzusetzen. + + + + No test is available in {0}. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again. + In "{0}" ist kein Test verfügbar. Stellen Sie sicher, dass die Testdiscoverer und -executors registriert und die Versionseinstellungen für Plattform und Framework richtig sind, und wiederholen Sie den Vorgang. + + + + Logging TestHost Diagnostics in file: {0} + Die TestHost-Diagnose wird in der Datei {0} protokolliert. + + + + Failed to launch testhost with error: {0} + Fehler beim Starten von Testhost: {0} + + + + ExecutionThreadApartmentState option not supported for framework: {0}. + Die ExecutionThreadApartmentState-Option wird für das Framework nicht unterstützt: {0}. + + + + You are using an older version of Microsoft.NET.Test.Sdk. Kindly move to a version equal or greater than 15.3.0. + Sie verwenden eine ältere Version von Microsoft.NET.Test.Sdk. Wechseln Sie zu Version 15.3.0 oder höher. + + + + Could not find extensions: {0} + Erweiterungen nicht gefunden: {0} + + + + Adapter lookup is being changed, please follow https://github.com/Microsoft/vstest-docs/blob/main/RFCs/0022-User-Specified-TestAdapter-Lookup.md#roadmap for more details. + Die Adaptersuche wird geändert. Weitere Informationen finden Sie unter https://github.com/Microsoft/vstest-docs/blob/main/RFCs/0022-User-Specified-TestAdapter-Lookup.md#roadmap. + + + + No test matches the given testcase filter `{0}` in {1} + Kein Test entspricht dem angegebenen Testfallfilter "{0}" in "{1}". + + + + Discovery of tests cancelled. + Die Ermittlung von Tests wurde abgebrochen. + + + + Cannot attach the debugger to the default test host with process ID: {0}. + Der Debugger kann nicht an den Standardtesthost mit der Prozess-ID {0} angefügt werden. + + + + {0} Access denied while trying to create "TestResults" folder in mentioned location. You are getting this exception because you are running vstest.console.exe from a folder which requires having write access. To solve the issue: please run vstest.console.exe from a folder where you have write privileges. + {0} Beim Erstellen des Ordners "TestResults" am angegebenen Speicherort wurde der Zugriff verweigert. Sie erhalten diese Ausnahme, weil Sie "vstest.console.exe" in einem Ordner ausführen, für den Schreibzugriff erforderlich ist. So beheben Sie das Problem: Führen Sie "vstest.console.exe" in einem Ordner aus, für den Sie Schreibberechtigungen besitzen. + + + + Could not find an available proxy to deque. + Es wurde kein verfügbarer Proxy für die Deque gefunden. + + + + Proxy with id {0} is not managed by the current session manager. + Der Proxy mit der ID {0} wird nicht vom aktuellen Sitzungs-Manager verwaltet. + + + + Proxy with id {0} is already available and cannot be re-enqueued. + Der Proxy mit der ID {0} ist bereits verfügbar und kann nicht erneut in die Warteschlange eingereiht werden. + + + + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.es.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.es.xlf index 1ca9cafea2..37a9ca613b 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.es.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.es.xlf @@ -1,172 +1,162 @@ - - - - - - Exception occurred while instantiating discoverer : {0} - - Se produjo una excepción al crear una instancia del programa de detección: {0} - - - Multiple test adapters with the same uri '{0}' were found. Ignoring adapter '{1}'. Please uninstall the conflicting adapter(s) to avoid this warning. - {0} is the unique identifier of test adapter. {1} is the name of the test adapter that shares a unique identifier with a previously loaded adapter. - Se han encontrado varios adaptadores de prueba con el mismo URI ({0}). Se omitirá el adaptador '{1}'. Desinstale los adaptadores que están en conflicto para evitar esta advertencia. - - - Ignoring the specified duplicate source '{0}'. - - Se omitirá el origen duplicado especificado ({0}). - - - An exception occurred while test discoverer '{0}' was loading tests. Exception: {1} - - Se produjo una excepción cuando el programa de detección de pruebas '{0}' estaba cargando pruebas. Excepción: {1} - - - An exception occurred while invoking executor '{0}': {1} - - Se produjo una excepción al invocar al ejecutor '{0}': {1} - - - Could not find file {0}. - - No se encuentra el archivo {0}. - - - Host debugging is enabled. Please attach debugger to testhost process to continue. - Host, testhost are key words, it should not be localized - La depuración host está habilitada. Asocie el depurador al proceso de host de prueba para continuar. - - - Ignoring the test executor corresponding to test discoverer {0} because the discoverer does not have the DefaultExecutorUri attribute . You might need to re-install the test adapter add-in. - - Se omitirá el ejecutor de pruebas correspondiente al programa de detección de pruebas {0}, porque este último no tiene el atributo DefaultExecutorUri. Puede ser necesario reinstalar el complemento del adaptador de prueba. - - - Failed to initialize client proxy: could not connect to test process. - - No se pudo inicializar el proxy de cliente: no se puede conectar al proceso de prueba. - - - This operation is not allowed in the context of a non-debug run. - - Esta operación no se permite en el contexto de una ejecución que no sea de depuración. - - - Could not find test executor with URI '{0}'. Make sure that the test executor is installed and supports .net runtime version {1}. - {0} - Executor uri String {1}- Version - .net Version Eg:-2.0.50727.00 - No se encuentra el ejecutor de pruebas con el URI '{0}'. Asegúrese de que el ejecutor de pruebas está instalado y admite el entorno de ejecución .NET, versión {1}. - - - None of the specified source(s) '{0}' is valid. Fix the above errors/warnings and then try again. - - Ninguno de los orígenes especificados ({0}) es válido. Corrija los errores o advertencias y vuelva a intentarlo. - - - , - - , - - - No tests matched the filter because it contains one or more properties that are not valid ({0}). Specify filter expression containing valid properties ({1}). - - Ninguna prueba coincide con el filtro porque contiene una o varias propiedades no válidas ({0}). Especifique una expresión de filtro que contenga propiedades válidas ({1}). - - - Could not find {0}. Make sure that the dotnet is installed on the machine. - No se pudo encontrar {0}. Asegúrese de que dotnet esté instalado en la máquina. - - - - Testhost process exited with error: {0}. Please check the diagnostic logs for more information. - El proceso del host de prueba finalizó con el siguiente error: {0}. Consulte los registros de diagnóstico para obtener más información. - - - - DataCollector debugging is enabled. Please attach debugger to datacollector process to continue. - La depuración del recopilador de datos está habilitada. Asocie el depurador al proceso del recopilador de datos para continuar. - - - - No test is available in {0}. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again. - No hay ninguna prueba disponible en {0}. Asegúrese de que los detectores y ejecutores de pruebas están registrados y de que la configuración de versión de la plataforma y de Framework es correcta y vuelva a intentarlo. - - - - Logging TestHost Diagnostics in file: {0} - Registrando diagnóstico de TestHost en el archivo: {0} - - - - Failed to launch testhost with error: {0} - No se pudo iniciar el host de prueba con el error: {0} - - - - ExecutionThreadApartmentState option not supported for framework: {0}. - Opción ExecutionThreadApartmentState de ejecución no admitida para el marco: {0}. - - - - You are using an older version of Microsoft.NET.Test.Sdk. Kindly move to a version equal or greater than 15.3.0. - Está utilizando una versión anterior de Microsoft.NET.Test.Sdk. Cámbiese a una versión igual o superior a 15.3.0. - - - - Could not find extensions: {0} - No se pudieron encontrar las extensiones {0}. - - - - Adapter lookup is being changed, please follow https://github.com/Microsoft/vstest-docs/blob/main/RFCs/0022-User-Specified-TestAdapter-Lookup.md#roadmap for more details. - Se está cambiando la búsqueda de adaptador. Siga https://github.com/Microsoft/vstest-docs/blob/main/RFCs/0022-User-Specified-TestAdapter-Lookup.md#roadmap para obtener más detalles. - - - - No test matches the given testcase filter `{0}` in {1} - Ninguna prueba coincide con el filtro de casos de prueba proporcionado "{0}" en {1} - - - - Discovery of tests cancelled. - Se ha cancelado la detección de las pruebas. - - - - Cannot attach the debugger to the default test host with process ID: {0}. - No se puede asociar el depurador al host de prueba predeterminado con el id. de proceso: {0}. - - - - {0} Access denied while trying to create "TestResults" folder in mentioned location. You are getting this exception because you are running vstest.console.exe from a folder which requires having write access. To solve the issue: please run vstest.console.exe from a folder where you have write privileges. - {0} Se denegó el acceso al intentar crear la carpeta "TestResults" en la ubicación mencionada. Está recibiendo esta excepción porque está ejecutando vstest.console.exe desde una carpeta que requiere acceso de escritura. Para solucionar la incidencia: ejecute vstest.console.exe desde una carpeta en la que tenga privilegios de escritura. - - - - Could not find an available proxy to deque. - No se encontró ningún proxy disponible para quitar de la cola. - - - - Proxy with id {0} is not managed by the current session manager. - El administrador de la sesión actual no administra el proxy con el identificador {0}. - - - - Proxy with id {0} is already available and cannot be re-enqueued. - El proxy con el identificador {0} ya está disponible y no se puede volver a poner en cola. - - - - No suitable test runtime provider found for this run. - No suitable test runtime provider found for this run. - - - - Could not find an available proxy to match the original run settings. - Could not find an available proxy to match the original run settings. - - - - - + + + + + + Exception occurred while instantiating discoverer : {0} + + Se produjo una excepción al crear una instancia del programa de detección: {0} + + + Multiple test adapters with the same uri '{0}' were found. Ignoring adapter '{1}'. Please uninstall the conflicting adapter(s) to avoid this warning. + {0} is the unique identifier of test adapter. {1} is the name of the test adapter that shares a unique identifier with a previously loaded adapter. + Se han encontrado varios adaptadores de prueba con el mismo URI ({0}). Se omitirá el adaptador '{1}'. Desinstale los adaptadores que están en conflicto para evitar esta advertencia. + + + Ignoring the specified duplicate source '{0}'. + + Se omitirá el origen duplicado especificado ({0}). + + + An exception occurred while test discoverer '{0}' was loading tests. Exception: {1} + + Se produjo una excepción cuando el programa de detección de pruebas '{0}' estaba cargando pruebas. Excepción: {1} + + + An exception occurred while invoking executor '{0}': {1} + + Se produjo una excepción al invocar al ejecutor '{0}': {1} + + + Could not find file {0}. + + No se encuentra el archivo {0}. + + + Host debugging is enabled. Please attach debugger to testhost process to continue. + Host, testhost are key words, it should not be localized + La depuración host está habilitada. Asocie el depurador al proceso de host de prueba para continuar. + + + Ignoring the test executor corresponding to test discoverer {0} because the discoverer does not have the DefaultExecutorUri attribute . You might need to re-install the test adapter add-in. + + Se omitirá el ejecutor de pruebas correspondiente al programa de detección de pruebas {0}, porque este último no tiene el atributo DefaultExecutorUri. Puede ser necesario reinstalar el complemento del adaptador de prueba. + + + Failed to initialize client proxy: could not connect to test process. + + No se pudo inicializar el proxy de cliente: no se puede conectar al proceso de prueba. + + + This operation is not allowed in the context of a non-debug run. + + Esta operación no se permite en el contexto de una ejecución que no sea de depuración. + + + Could not find test executor with URI '{0}'. Make sure that the test executor is installed and supports .net runtime version {1}. + {0} - Executor uri String {1}- Version - .net Version Eg:-2.0.50727.00 + No se encuentra el ejecutor de pruebas con el URI '{0}'. Asegúrese de que el ejecutor de pruebas está instalado y admite el entorno de ejecución .NET, versión {1}. + + + None of the specified source(s) '{0}' is valid. Fix the above errors/warnings and then try again. + + Ninguno de los orígenes especificados ({0}) es válido. Corrija los errores o advertencias y vuelva a intentarlo. + + + , + + , + + + No tests matched the filter because it contains one or more properties that are not valid ({0}). Specify filter expression containing valid properties ({1}). + + Ninguna prueba coincide con el filtro porque contiene una o varias propiedades no válidas ({0}). Especifique una expresión de filtro que contenga propiedades válidas ({1}). + + + Could not find {0}. Make sure that the dotnet is installed on the machine. + No se pudo encontrar {0}. Asegúrese de que dotnet esté instalado en la máquina. + + + + Testhost process exited with error: {0}. Please check the diagnostic logs for more information. + El proceso del host de prueba finalizó con el siguiente error: {0}. Consulte los registros de diagnóstico para obtener más información. + + + + DataCollector debugging is enabled. Please attach debugger to datacollector process to continue. + La depuración del recopilador de datos está habilitada. Asocie el depurador al proceso del recopilador de datos para continuar. + + + + No test is available in {0}. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again. + No hay ninguna prueba disponible en {0}. Asegúrese de que los detectores y ejecutores de pruebas están registrados y de que la configuración de versión de la plataforma y de Framework es correcta y vuelva a intentarlo. + + + + Logging TestHost Diagnostics in file: {0} + Registrando diagnóstico de TestHost en el archivo: {0} + + + + Failed to launch testhost with error: {0} + No se pudo iniciar el host de prueba con el error: {0} + + + + ExecutionThreadApartmentState option not supported for framework: {0}. + Opción ExecutionThreadApartmentState de ejecución no admitida para el marco: {0}. + + + + You are using an older version of Microsoft.NET.Test.Sdk. Kindly move to a version equal or greater than 15.3.0. + Está utilizando una versión anterior de Microsoft.NET.Test.Sdk. Cámbiese a una versión igual o superior a 15.3.0. + + + + Could not find extensions: {0} + No se pudieron encontrar las extensiones {0}. + + + + Adapter lookup is being changed, please follow https://github.com/Microsoft/vstest-docs/blob/main/RFCs/0022-User-Specified-TestAdapter-Lookup.md#roadmap for more details. + Se está cambiando la búsqueda de adaptador. Siga https://github.com/Microsoft/vstest-docs/blob/main/RFCs/0022-User-Specified-TestAdapter-Lookup.md#roadmap para obtener más detalles. + + + + No test matches the given testcase filter `{0}` in {1} + Ninguna prueba coincide con el filtro de casos de prueba proporcionado "{0}" en {1} + + + + Discovery of tests cancelled. + Se ha cancelado la detección de las pruebas. + + + + Cannot attach the debugger to the default test host with process ID: {0}. + No se puede asociar el depurador al host de prueba predeterminado con el id. de proceso: {0}. + + + + {0} Access denied while trying to create "TestResults" folder in mentioned location. You are getting this exception because you are running vstest.console.exe from a folder which requires having write access. To solve the issue: please run vstest.console.exe from a folder where you have write privileges. + {0} Se denegó el acceso al intentar crear la carpeta "TestResults" en la ubicación mencionada. Está recibiendo esta excepción porque está ejecutando vstest.console.exe desde una carpeta que requiere acceso de escritura. Para solucionar la incidencia: ejecute vstest.console.exe desde una carpeta en la que tenga privilegios de escritura. + + + + Could not find an available proxy to deque. + No se encontró ningún proxy disponible para quitar de la cola. + + + + Proxy with id {0} is not managed by the current session manager. + El administrador de la sesión actual no administra el proxy con el identificador {0}. + + + + Proxy with id {0} is already available and cannot be re-enqueued. + El proxy con el identificador {0} ya está disponible y no se puede volver a poner en cola. + + + + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.fr.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.fr.xlf index 146bd62237..68f17b5385 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.fr.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.fr.xlf @@ -1,172 +1,162 @@ - - - - - - Exception occurred while instantiating discoverer : {0} - - Une exception s'est produite durant l'instanciation du découvreur : {0} - - - Multiple test adapters with the same uri '{0}' were found. Ignoring adapter '{1}'. Please uninstall the conflicting adapter(s) to avoid this warning. - {0} is the unique identifier of test adapter. {1} is the name of the test adapter that shares a unique identifier with a previously loaded adapter. - Plusieurs adaptateurs de tests ayant le même URI '{0}' ont été trouvés. Adaptateur '{1}' ignoré. Désinstallez les adaptateurs en conflit pour éviter cet avertissement. - - - Ignoring the specified duplicate source '{0}'. - - La source dupliquée spécifiée '{0}' est ignorée. - - - An exception occurred while test discoverer '{0}' was loading tests. Exception: {1} - - Une exception s'est produite durant le chargement des tests par le découvreur de tests '{0}'. Exception : {1} - - - An exception occurred while invoking executor '{0}': {1} - - Une exception s'est produite durant l'appel de l'exécuteur '{0}' : {1} - - - Could not find file {0}. - - Fichier {0} introuvable. - - - Host debugging is enabled. Please attach debugger to testhost process to continue. - Host, testhost are key words, it should not be localized - Le débogage de l'hôte est activé. Attachez le débogueur au processus testhost pour continuer. - - - Ignoring the test executor corresponding to test discoverer {0} because the discoverer does not have the DefaultExecutorUri attribute . You might need to re-install the test adapter add-in. - - L'exécuteur de tests correspondant au découvreur de tests {0} est ignoré, car le découvreur n'a pas l'attribut DefaultExecutorUri. Vous devrez peut-être réinstaller le complément d'adaptateur de test. - - - Failed to initialize client proxy: could not connect to test process. - - Échec d'initialisation du proxy client : connexion impossible au processus de test. - - - This operation is not allowed in the context of a non-debug run. - - Cette opération n'est pas autorisée dans le contexte d'une exécution qui ne sert pas au débogage. - - - Could not find test executor with URI '{0}'. Make sure that the test executor is installed and supports .net runtime version {1}. - {0} - Executor uri String {1}- Version - .net Version Eg:-2.0.50727.00 - L'exécuteur de tests ayant l'URI '{0}' est introuvable. Vérifiez que l'exécuteur de tests est installé et qu'il prend en charge le runtime .NET version {1}. - - - None of the specified source(s) '{0}' is valid. Fix the above errors/warnings and then try again. - - Aucune des sources spécifiées '{0}' n'est valide. Corrigez les erreurs/avertissements ci-dessus, puis réessayez. - - - , - - , - - - No tests matched the filter because it contains one or more properties that are not valid ({0}). Specify filter expression containing valid properties ({1}). - - Aucun test ne correspond au filtre, car il contient une ou plusieurs propriétés non valides ({0}). Spécifiez une expression de filtre contenant des propriétés valides ({1}). - - - Could not find {0}. Make sure that the dotnet is installed on the machine. - {0} est introuvable. Vérifiez que le dotnet est installé sur la machine. - - - - Testhost process exited with error: {0}. Please check the diagnostic logs for more information. - Le processus Testhost s'est arrêté. Erreur : {0}. Pour plus d'informations, consultez les journaux de diagnostic. - - - - DataCollector debugging is enabled. Please attach debugger to datacollector process to continue. - Le débogage de collecteur de données est activé. Attachez le débogueur au processus datacollector pour continuer. - - - - No test is available in {0}. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again. - Aucun test n'est disponible dans {0}. Vérifiez que les découvreurs et exécuteurs de tests sont inscrits. Vérifiez également que les paramètres de version de plateforme et de framework sont appropriés, puis réessayez. - - - - Logging TestHost Diagnostics in file: {0} - Journalisation des diagnostics TestHost dans le fichier : {0} - - - - Failed to launch testhost with error: {0} - Échec du lancement de l'hôte de test. Erreur : {0} - - - - ExecutionThreadApartmentState option not supported for framework: {0}. - L'option ExecutionThreadApartmentState n'est pas prise en charge pour le framework : {0}. - - - - You are using an older version of Microsoft.NET.Test.Sdk. Kindly move to a version equal or greater than 15.3.0. - Vous utilisez une ancienne version de Microsoft.NET.Test.Sdk. Passez à une version égale ou supérieure à la version 15.3.0. - - - - Could not find extensions: {0} - Extensions introuvables : {0} - - - - Adapter lookup is being changed, please follow https://github.com/Microsoft/vstest-docs/blob/main/RFCs/0022-User-Specified-TestAdapter-Lookup.md#roadmap for more details. - La fonctionnalité de recherche d’adaptateur fait actuellement l’objet de modifications. Pour plus d’informations, veuillez consulter https://github.com/Microsoft/vstest-docs/blob/main/RFCs/0022-User-Specified-TestAdapter-Lookup.md#roadmap. - - - - No test matches the given testcase filter `{0}` in {1} - Aucun test ne correspond au filtre testcase donné `{0}` dans {1} - - - - Discovery of tests cancelled. - Découverte de tests annulée. - - - - Cannot attach the debugger to the default test host with process ID: {0}. - Impossible d'attacher le débogueur à l'hôte de test par défaut ayant l'ID de processus : {0}. - - - - {0} Access denied while trying to create "TestResults" folder in mentioned location. You are getting this exception because you are running vstest.console.exe from a folder which requires having write access. To solve the issue: please run vstest.console.exe from a folder where you have write privileges. - {0} Accès refusé durant la tentative de création du dossier "TestResults" à l'emplacement indiqué. Vous obtenez cette exception, car vous exécutez vstest.console.exe à partir d'un dossier qui nécessite un accès en écriture. Pour résoudre le problème, exécutez vstest.console.exe à partir d'un dossier sur lequel vous disposez de privilèges d'accès en écriture. - - - - Could not find an available proxy to deque. - Impossible de localiser un proxy disponible à dépiler. - - - - Proxy with id {0} is not managed by the current session manager. - Le proxy ayant l'ID {0} n'est pas géré par le gestionnaire de session actuel. - - - - Proxy with id {0} is already available and cannot be re-enqueued. - Le proxy ayant l'ID {0} est déjà disponible et ne peut pas être empilé à nouveau. - - - - No suitable test runtime provider found for this run. - No suitable test runtime provider found for this run. - - - - Could not find an available proxy to match the original run settings. - Could not find an available proxy to match the original run settings. - - - - - + + + + + + Exception occurred while instantiating discoverer : {0} + + Une exception s'est produite durant l'instanciation du découvreur : {0} + + + Multiple test adapters with the same uri '{0}' were found. Ignoring adapter '{1}'. Please uninstall the conflicting adapter(s) to avoid this warning. + {0} is the unique identifier of test adapter. {1} is the name of the test adapter that shares a unique identifier with a previously loaded adapter. + Plusieurs adaptateurs de tests ayant le même URI '{0}' ont été trouvés. Adaptateur '{1}' ignoré. Désinstallez les adaptateurs en conflit pour éviter cet avertissement. + + + Ignoring the specified duplicate source '{0}'. + + La source dupliquée spécifiée '{0}' est ignorée. + + + An exception occurred while test discoverer '{0}' was loading tests. Exception: {1} + + Une exception s'est produite durant le chargement des tests par le découvreur de tests '{0}'. Exception : {1} + + + An exception occurred while invoking executor '{0}': {1} + + Une exception s'est produite durant l'appel de l'exécuteur '{0}' : {1} + + + Could not find file {0}. + + Fichier {0} introuvable. + + + Host debugging is enabled. Please attach debugger to testhost process to continue. + Host, testhost are key words, it should not be localized + Le débogage de l'hôte est activé. Attachez le débogueur au processus testhost pour continuer. + + + Ignoring the test executor corresponding to test discoverer {0} because the discoverer does not have the DefaultExecutorUri attribute . You might need to re-install the test adapter add-in. + + L'exécuteur de tests correspondant au découvreur de tests {0} est ignoré, car le découvreur n'a pas l'attribut DefaultExecutorUri. Vous devrez peut-être réinstaller le complément d'adaptateur de test. + + + Failed to initialize client proxy: could not connect to test process. + + Échec d'initialisation du proxy client : connexion impossible au processus de test. + + + This operation is not allowed in the context of a non-debug run. + + Cette opération n'est pas autorisée dans le contexte d'une exécution qui ne sert pas au débogage. + + + Could not find test executor with URI '{0}'. Make sure that the test executor is installed and supports .net runtime version {1}. + {0} - Executor uri String {1}- Version - .net Version Eg:-2.0.50727.00 + L'exécuteur de tests ayant l'URI '{0}' est introuvable. Vérifiez que l'exécuteur de tests est installé et qu'il prend en charge le runtime .NET version {1}. + + + None of the specified source(s) '{0}' is valid. Fix the above errors/warnings and then try again. + + Aucune des sources spécifiées '{0}' n'est valide. Corrigez les erreurs/avertissements ci-dessus, puis réessayez. + + + , + + , + + + No tests matched the filter because it contains one or more properties that are not valid ({0}). Specify filter expression containing valid properties ({1}). + + Aucun test ne correspond au filtre, car il contient une ou plusieurs propriétés non valides ({0}). Spécifiez une expression de filtre contenant des propriétés valides ({1}). + + + Could not find {0}. Make sure that the dotnet is installed on the machine. + {0} est introuvable. Vérifiez que le dotnet est installé sur la machine. + + + + Testhost process exited with error: {0}. Please check the diagnostic logs for more information. + Le processus Testhost s'est arrêté. Erreur : {0}. Pour plus d'informations, consultez les journaux de diagnostic. + + + + DataCollector debugging is enabled. Please attach debugger to datacollector process to continue. + Le débogage de collecteur de données est activé. Attachez le débogueur au processus datacollector pour continuer. + + + + No test is available in {0}. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again. + Aucun test n'est disponible dans {0}. Vérifiez que les découvreurs et exécuteurs de tests sont inscrits. Vérifiez également que les paramètres de version de plateforme et de framework sont appropriés, puis réessayez. + + + + Logging TestHost Diagnostics in file: {0} + Journalisation des diagnostics TestHost dans le fichier : {0} + + + + Failed to launch testhost with error: {0} + Échec du lancement de l'hôte de test. Erreur : {0} + + + + ExecutionThreadApartmentState option not supported for framework: {0}. + L'option ExecutionThreadApartmentState n'est pas prise en charge pour le framework : {0}. + + + + You are using an older version of Microsoft.NET.Test.Sdk. Kindly move to a version equal or greater than 15.3.0. + Vous utilisez une ancienne version de Microsoft.NET.Test.Sdk. Passez à une version égale ou supérieure à la version 15.3.0. + + + + Could not find extensions: {0} + Extensions introuvables : {0} + + + + Adapter lookup is being changed, please follow https://github.com/Microsoft/vstest-docs/blob/main/RFCs/0022-User-Specified-TestAdapter-Lookup.md#roadmap for more details. + La fonctionnalité de recherche d’adaptateur fait actuellement l’objet de modifications. Pour plus d’informations, veuillez consulter https://github.com/Microsoft/vstest-docs/blob/main/RFCs/0022-User-Specified-TestAdapter-Lookup.md#roadmap. + + + + No test matches the given testcase filter `{0}` in {1} + Aucun test ne correspond au filtre testcase donné `{0}` dans {1} + + + + Discovery of tests cancelled. + Découverte de tests annulée. + + + + Cannot attach the debugger to the default test host with process ID: {0}. + Impossible d'attacher le débogueur à l'hôte de test par défaut ayant l'ID de processus : {0}. + + + + {0} Access denied while trying to create "TestResults" folder in mentioned location. You are getting this exception because you are running vstest.console.exe from a folder which requires having write access. To solve the issue: please run vstest.console.exe from a folder where you have write privileges. + {0} Accès refusé durant la tentative de création du dossier "TestResults" à l'emplacement indiqué. Vous obtenez cette exception, car vous exécutez vstest.console.exe à partir d'un dossier qui nécessite un accès en écriture. Pour résoudre le problème, exécutez vstest.console.exe à partir d'un dossier sur lequel vous disposez de privilèges d'accès en écriture. + + + + Could not find an available proxy to deque. + Impossible de localiser un proxy disponible à dépiler. + + + + Proxy with id {0} is not managed by the current session manager. + Le proxy ayant l'ID {0} n'est pas géré par le gestionnaire de session actuel. + + + + Proxy with id {0} is already available and cannot be re-enqueued. + Le proxy ayant l'ID {0} est déjà disponible et ne peut pas être empilé à nouveau. + + + + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.it.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.it.xlf index d73c3f43b2..ff566e5f5b 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.it.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.it.xlf @@ -1,172 +1,162 @@ - - - - - - Exception occurred while instantiating discoverer : {0} - - Si è verificata un'eccezione durante la creazione dell'istanza dell'agente di individuazione: {0} - - - Multiple test adapters with the same uri '{0}' were found. Ignoring adapter '{1}'. Please uninstall the conflicting adapter(s) to avoid this warning. - {0} is the unique identifier of test adapter. {1} is the name of the test adapter that shares a unique identifier with a previously loaded adapter. - Sono stati trovati più adattatori di test con lo stesso URI '{0}'. L'adattatore '{1}' verrà ignorato. Per evitare che venga visualizzato questo avviso, disinstallare gli adattatori in conflitto. - - - Ignoring the specified duplicate source '{0}'. - - L'origine duplicata specificata verrà ignorata: '{0}'. - - - An exception occurred while test discoverer '{0}' was loading tests. Exception: {1} - - Si è verificata un'eccezione durante il caricamento dei test da parte dell'agente di individuazione test '{0}'. Eccezione: {1} - - - An exception occurred while invoking executor '{0}': {1} - - Si è verificata un'eccezione durante la chiamata dell'executor '{0}': {1} - - - Could not find file {0}. - - Il file {0} non è stato trovato. - - - Host debugging is enabled. Please attach debugger to testhost process to continue. - Host, testhost are key words, it should not be localized - Il debug dell'host è abilitato. Per continuare, collegare il debugger al processo testhost. - - - Ignoring the test executor corresponding to test discoverer {0} because the discoverer does not have the DefaultExecutorUri attribute . You might need to re-install the test adapter add-in. - - L'executor di test corrispondente all'agente di individuazione del test {0} verrà ignorato perché manca l'attributo DefaultExecutorUri dell'agente di individuazione. Potrebbe essere necessario reinstallare il componente aggiuntivo dell'adattatore di test. - - - Failed to initialize client proxy: could not connect to test process. - - Inizializzazione del proxy client non riuscita: non è stato possibile connettersi al processo di test. - - - This operation is not allowed in the context of a non-debug run. - - Questa operazione non è consentita nel contesto di un'esecuzione non di debug. - - - Could not find test executor with URI '{0}'. Make sure that the test executor is installed and supports .net runtime version {1}. - {0} - Executor uri String {1}- Version - .net Version Eg:-2.0.50727.00 - Non è stato trovato alcun executor di test con URI '{0}'. Verificare che l'executor di test sia installato e supporti la versione {1} di .NET Runtime. - - - None of the specified source(s) '{0}' is valid. Fix the above errors/warnings and then try again. - - Nessuna delle origini specificate '{0}' è valida. Correggere gli errori/avvisi precedenti e riprovare. - - - , - - , - - - No tests matched the filter because it contains one or more properties that are not valid ({0}). Specify filter expression containing valid properties ({1}). - - Nessun test corrisponde al filtro perché contiene una o più proprietà non valide ({0}). Specificare un'espressione di filtro contenente proprietà valide ({1}). - - - Could not find {0}. Make sure that the dotnet is installed on the machine. - {0} non è stato trovato. Assicurarsi che dotnet sia installato nel computer. - - - - Testhost process exited with error: {0}. Please check the diagnostic logs for more information. - Il processo testhost è terminato con l'errore {0}. Per altre informazioni, vedere i log di diagnostica. - - - - DataCollector debugging is enabled. Please attach debugger to datacollector process to continue. - Il debug dell'agente di raccolta dati è abilitato. Per continuare, collegare il debugger al processo dell'agente di raccolta dati. - - - - No test is available in {0}. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again. - Non ci sono test disponibili in {0}. Assicurarsi che l'agente di individuazione test e gli executor di test siano registrati e che le impostazioni delle versioni di piattaforma e framework siano appropriate, quindi riprovare. - - - - Logging TestHost Diagnostics in file: {0} - Registrazione della diagnostica di TestHost nel file: {0} - - - - Failed to launch testhost with error: {0} - Non è stato possibile avviare testhost. Errore: {0} - - - - ExecutionThreadApartmentState option not supported for framework: {0}. - L'opzione ExecutionThreadApartmentState non è supportata per il framework: {0}. - - - - You are using an older version of Microsoft.NET.Test.Sdk. Kindly move to a version equal or greater than 15.3.0. - La versione di Microsoft.NET.Test.Sdk è obsoleta. Passare alla versione 15.3.0 o a una versione successiva. - - - - Could not find extensions: {0} - Non è stato possibile trovare le estensioni: {0} - - - - Adapter lookup is being changed, please follow https://github.com/Microsoft/vstest-docs/blob/main/RFCs/0022-User-Specified-TestAdapter-Lookup.md#roadmap for more details. - La ricerca degli adattatori verrà modificata a breve. Per maggiori dettagli, vedere https://github.com/Microsoft/vstest-docs/blob/main/RFCs/0022-User-Specified-TestAdapter-Lookup.md#roadmap. - - - - No test matches the given testcase filter `{0}` in {1} - Nessun test corrisponde al filtro di test case specificato `{0}` in {1} - - - - Discovery of tests cancelled. - Individuazione dei test annullata. - - - - Cannot attach the debugger to the default test host with process ID: {0}. - Non è possibile collegare il debugger all'host di test predefinito con ID processo {0}. - - - - {0} Access denied while trying to create "TestResults" folder in mentioned location. You are getting this exception because you are running vstest.console.exe from a folder which requires having write access. To solve the issue: please run vstest.console.exe from a folder where you have write privileges. - {0} Accesso negato durante il tentativo di creare la cartella "TestResults" nel percorso indicato. Si riceve questa eccezione perché si esegue vstest.console.exe da una cartella per cui è necessario l'accesso in scrittura. Per risolvere il problema, eseguire vstest.console.exe da una cartella per cui si hanno privilegi di scrittura. - - - - Could not find an available proxy to deque. - Non è stato possibile trovare un proxy disponibile da rimuovere dalla coda. - - - - Proxy with id {0} is not managed by the current session manager. - Il proxy con ID {0} non è gestito dallo strumento di gestione sessioni corrente. - - - - Proxy with id {0} is already available and cannot be re-enqueued. - Il proxy con ID {0} è già disponibile e non può essere riaccodato. - - - - No suitable test runtime provider found for this run. - No suitable test runtime provider found for this run. - - - - Could not find an available proxy to match the original run settings. - Could not find an available proxy to match the original run settings. - - - - - + + + + + + Exception occurred while instantiating discoverer : {0} + + Si è verificata un'eccezione durante la creazione dell'istanza dell'agente di individuazione: {0} + + + Multiple test adapters with the same uri '{0}' were found. Ignoring adapter '{1}'. Please uninstall the conflicting adapter(s) to avoid this warning. + {0} is the unique identifier of test adapter. {1} is the name of the test adapter that shares a unique identifier with a previously loaded adapter. + Sono stati trovati più adattatori di test con lo stesso URI '{0}'. L'adattatore '{1}' verrà ignorato. Per evitare che venga visualizzato questo avviso, disinstallare gli adattatori in conflitto. + + + Ignoring the specified duplicate source '{0}'. + + L'origine duplicata specificata verrà ignorata: '{0}'. + + + An exception occurred while test discoverer '{0}' was loading tests. Exception: {1} + + Si è verificata un'eccezione durante il caricamento dei test da parte dell'agente di individuazione test '{0}'. Eccezione: {1} + + + An exception occurred while invoking executor '{0}': {1} + + Si è verificata un'eccezione durante la chiamata dell'executor '{0}': {1} + + + Could not find file {0}. + + Il file {0} non è stato trovato. + + + Host debugging is enabled. Please attach debugger to testhost process to continue. + Host, testhost are key words, it should not be localized + Il debug dell'host è abilitato. Per continuare, collegare il debugger al processo testhost. + + + Ignoring the test executor corresponding to test discoverer {0} because the discoverer does not have the DefaultExecutorUri attribute . You might need to re-install the test adapter add-in. + + L'executor di test corrispondente all'agente di individuazione del test {0} verrà ignorato perché manca l'attributo DefaultExecutorUri dell'agente di individuazione. Potrebbe essere necessario reinstallare il componente aggiuntivo dell'adattatore di test. + + + Failed to initialize client proxy: could not connect to test process. + + Inizializzazione del proxy client non riuscita: non è stato possibile connettersi al processo di test. + + + This operation is not allowed in the context of a non-debug run. + + Questa operazione non è consentita nel contesto di un'esecuzione non di debug. + + + Could not find test executor with URI '{0}'. Make sure that the test executor is installed and supports .net runtime version {1}. + {0} - Executor uri String {1}- Version - .net Version Eg:-2.0.50727.00 + Non è stato trovato alcun executor di test con URI '{0}'. Verificare che l'executor di test sia installato e supporti la versione {1} di .NET Runtime. + + + None of the specified source(s) '{0}' is valid. Fix the above errors/warnings and then try again. + + Nessuna delle origini specificate '{0}' è valida. Correggere gli errori/avvisi precedenti e riprovare. + + + , + + , + + + No tests matched the filter because it contains one or more properties that are not valid ({0}). Specify filter expression containing valid properties ({1}). + + Nessun test corrisponde al filtro perché contiene una o più proprietà non valide ({0}). Specificare un'espressione di filtro contenente proprietà valide ({1}). + + + Could not find {0}. Make sure that the dotnet is installed on the machine. + {0} non è stato trovato. Assicurarsi che dotnet sia installato nel computer. + + + + Testhost process exited with error: {0}. Please check the diagnostic logs for more information. + Il processo testhost è terminato con l'errore {0}. Per altre informazioni, vedere i log di diagnostica. + + + + DataCollector debugging is enabled. Please attach debugger to datacollector process to continue. + Il debug dell'agente di raccolta dati è abilitato. Per continuare, collegare il debugger al processo dell'agente di raccolta dati. + + + + No test is available in {0}. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again. + Non ci sono test disponibili in {0}. Assicurarsi che l'agente di individuazione test e gli executor di test siano registrati e che le impostazioni delle versioni di piattaforma e framework siano appropriate, quindi riprovare. + + + + Logging TestHost Diagnostics in file: {0} + Registrazione della diagnostica di TestHost nel file: {0} + + + + Failed to launch testhost with error: {0} + Non è stato possibile avviare testhost. Errore: {0} + + + + ExecutionThreadApartmentState option not supported for framework: {0}. + L'opzione ExecutionThreadApartmentState non è supportata per il framework: {0}. + + + + You are using an older version of Microsoft.NET.Test.Sdk. Kindly move to a version equal or greater than 15.3.0. + La versione di Microsoft.NET.Test.Sdk è obsoleta. Passare alla versione 15.3.0 o a una versione successiva. + + + + Could not find extensions: {0} + Non è stato possibile trovare le estensioni: {0} + + + + Adapter lookup is being changed, please follow https://github.com/Microsoft/vstest-docs/blob/main/RFCs/0022-User-Specified-TestAdapter-Lookup.md#roadmap for more details. + La ricerca degli adattatori verrà modificata a breve. Per maggiori dettagli, vedere https://github.com/Microsoft/vstest-docs/blob/main/RFCs/0022-User-Specified-TestAdapter-Lookup.md#roadmap. + + + + No test matches the given testcase filter `{0}` in {1} + Nessun test corrisponde al filtro di test case specificato `{0}` in {1} + + + + Discovery of tests cancelled. + Individuazione dei test annullata. + + + + Cannot attach the debugger to the default test host with process ID: {0}. + Non è possibile collegare il debugger all'host di test predefinito con ID processo {0}. + + + + {0} Access denied while trying to create "TestResults" folder in mentioned location. You are getting this exception because you are running vstest.console.exe from a folder which requires having write access. To solve the issue: please run vstest.console.exe from a folder where you have write privileges. + {0} Accesso negato durante il tentativo di creare la cartella "TestResults" nel percorso indicato. Si riceve questa eccezione perché si esegue vstest.console.exe da una cartella per cui è necessario l'accesso in scrittura. Per risolvere il problema, eseguire vstest.console.exe da una cartella per cui si hanno privilegi di scrittura. + + + + Could not find an available proxy to deque. + Non è stato possibile trovare un proxy disponibile da rimuovere dalla coda. + + + + Proxy with id {0} is not managed by the current session manager. + Il proxy con ID {0} non è gestito dallo strumento di gestione sessioni corrente. + + + + Proxy with id {0} is already available and cannot be re-enqueued. + Il proxy con ID {0} è già disponibile e non può essere riaccodato. + + + + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ja.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ja.xlf index 66823db7ef..09c4c63d8b 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ja.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ja.xlf @@ -1,172 +1,162 @@ - - - - - - Exception occurred while instantiating discoverer : {0} - - 探索プログラムのインスタンス化中に例外が発生しました: {0} - - - Multiple test adapters with the same uri '{0}' were found. Ignoring adapter '{1}'. Please uninstall the conflicting adapter(s) to avoid this warning. - {0} is the unique identifier of test adapter. {1} is the name of the test adapter that shares a unique identifier with a previously loaded adapter. - 同じ URI '{0}' を持つ複数のテスト アダプターが見つかりました。アダプター '{1}' を無視します。この警告が表示されないようにするには、競合するアダプターをアンインストールしてください。 - - - Ignoring the specified duplicate source '{0}'. - - 指定された重複データ ソース '{0}' を無視します。 - - - An exception occurred while test discoverer '{0}' was loading tests. Exception: {1} - - テスト探索プログラム '{0}' がテストを読み込んでいるときに例外が発生しました。例外: {1} - - - An exception occurred while invoking executor '{0}': {1} - - 実行プログラム '{0}' の呼び出し中に例外が発生しました: {1} - - - Could not find file {0}. - - ファイル {0} は見つかりませんでした。 - - - Host debugging is enabled. Please attach debugger to testhost process to continue. - Host, testhost are key words, it should not be localized - ホスト デバッグが有効です。続行するにはデバッガーをテスト ホスト プロセスにアタッチしてください。 - - - Ignoring the test executor corresponding to test discoverer {0} because the discoverer does not have the DefaultExecutorUri attribute . You might need to re-install the test adapter add-in. - - テスト探索プログラム {0} には DefaultExecutorUri 属性が含まれていないため、このテスト探索プログラムに対応するテスト実行プログラムを無視しています。テスト アダプター アドインの再インストールが必要になる場合があります。 - - - Failed to initialize client proxy: could not connect to test process. - - クライアント プロキシを初期化できませんでした。テスト プロセスに接続できませんでした。 - - - This operation is not allowed in the context of a non-debug run. - - この操作は、非デバッグ実行のコンテキストでは許可されていません。 - - - Could not find test executor with URI '{0}'. Make sure that the test executor is installed and supports .net runtime version {1}. - {0} - Executor uri String {1}- Version - .net Version Eg:-2.0.50727.00 - URI が '{0}' のテスト実行プログラムが見つかりませんでした。テスト実行プログラムがインストールされ、.net ランタイム バージョン {1} をサポートしていることをご確認ください。 - - - None of the specified source(s) '{0}' is valid. Fix the above errors/warnings and then try again. - - 指定されたソース '{0}' がいずれも有効ではありません。上記のエラーおよび警告を修正してから、もう一度お試しください。 - - - , - - , - - - No tests matched the filter because it contains one or more properties that are not valid ({0}). Specify filter expression containing valid properties ({1}). - - フィルターに一致するテストがありません。フィルターに無効なプロパティが 1 つ以上含まれています ({0})。有効なプロパティを含むフィルター式 ({1}) を指定してください。 - - - Could not find {0}. Make sure that the dotnet is installed on the machine. - {0} が見つかりませんでした。dotnet がマシンにインストールされていることを確認してください。 - - - - Testhost process exited with error: {0}. Please check the diagnostic logs for more information. - Testhost プロセスがエラーで終了しました: {0}。詳細については、診断ログを確認してください。 - - - - DataCollector debugging is enabled. Please attach debugger to datacollector process to continue. - DataCollector のデバッグが有効です。続行するにはデバッガーを datacollector プロセスにアタッチしてください。 - - - - No test is available in {0}. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again. - {0} で使用できるテストはありません。テスト探索プログラムおよび実行プログラムが登録されており、プラットフォームおよびフレームワークのバージョン設定が適切であることを確認してから、もう一度お試しください。 - - - - Logging TestHost Diagnostics in file: {0} - 次のファイルで TestHost 診断をログ記録しています: {0} - - - - Failed to launch testhost with error: {0} - エラーが発生したため、TestHost を起動できませんでした: {0} - - - - ExecutionThreadApartmentState option not supported for framework: {0}. - フレームワークでの ThreadApartmentState オプションの実行はサポートされていません: {0}。 - - - - You are using an older version of Microsoft.NET.Test.Sdk. Kindly move to a version equal or greater than 15.3.0. - Microsoft.NET.Test.Sdk の古いバージョンを使用しています。15.3.0 以降のバージョンに移行することをお勧めします。 - - - - Could not find extensions: {0} - 拡張機能が見つかりませんでした: {0} - - - - Adapter lookup is being changed, please follow https://github.com/Microsoft/vstest-docs/blob/main/RFCs/0022-User-Specified-TestAdapter-Lookup.md#roadmap for more details. - アダプター検索は変更中です。詳細については、https://github.com/Microsoft/vstest-docs/blob/main/RFCs/0022-User-Specified-TestAdapter-Lookup.md#roadmap をご覧ください。 - - - - No test matches the given testcase filter `{0}` in {1} - 指定のテストケース フィルター `{0}` に一致するテストは {1} にありません - - - - Discovery of tests cancelled. - テストの検出が取り消されました。 - - - - Cannot attach the debugger to the default test host with process ID: {0}. - デバッガーをプロセス ID: {0} の既定のテスト ホストにアタッチできません。 - - - - {0} Access denied while trying to create "TestResults" folder in mentioned location. You are getting this exception because you are running vstest.console.exe from a folder which requires having write access. To solve the issue: please run vstest.console.exe from a folder where you have write privileges. - {0} 記載した場所に "TestResults" フォルダーを作成しようとしたときにアクセスが拒否されました。書き込みアクセスを必要とするフォルダーから vstest.console.exe を実行しているため、この例外が発生しています。この問題を解決するには、書き込み特権のあるフォルダーから vstest.console.exe を実行してください。 - - - - Could not find an available proxy to deque. - デキューするために使用できるプロキシが見つかりませんでした。 - - - - Proxy with id {0} is not managed by the current session manager. - ID が {0} のプロキシは、現在のセッション マネージャーで管理されません。 - - - - Proxy with id {0} is already available and cannot be re-enqueued. - ID が {0} のプロキシは、既に使用可能になっているため、再度エンキューすることはできません。 - - - - No suitable test runtime provider found for this run. - No suitable test runtime provider found for this run. - - - - Could not find an available proxy to match the original run settings. - Could not find an available proxy to match the original run settings. - - - - - + + + + + + Exception occurred while instantiating discoverer : {0} + + 探索プログラムのインスタンス化中に例外が発生しました: {0} + + + Multiple test adapters with the same uri '{0}' were found. Ignoring adapter '{1}'. Please uninstall the conflicting adapter(s) to avoid this warning. + {0} is the unique identifier of test adapter. {1} is the name of the test adapter that shares a unique identifier with a previously loaded adapter. + 同じ URI '{0}' を持つ複数のテスト アダプターが見つかりました。アダプター '{1}' を無視します。この警告が表示されないようにするには、競合するアダプターをアンインストールしてください。 + + + Ignoring the specified duplicate source '{0}'. + + 指定された重複データ ソース '{0}' を無視します。 + + + An exception occurred while test discoverer '{0}' was loading tests. Exception: {1} + + テスト探索プログラム '{0}' がテストを読み込んでいるときに例外が発生しました。例外: {1} + + + An exception occurred while invoking executor '{0}': {1} + + 実行プログラム '{0}' の呼び出し中に例外が発生しました: {1} + + + Could not find file {0}. + + ファイル {0} は見つかりませんでした。 + + + Host debugging is enabled. Please attach debugger to testhost process to continue. + Host, testhost are key words, it should not be localized + ホスト デバッグが有効です。続行するにはデバッガーをテスト ホスト プロセスにアタッチしてください。 + + + Ignoring the test executor corresponding to test discoverer {0} because the discoverer does not have the DefaultExecutorUri attribute . You might need to re-install the test adapter add-in. + + テスト探索プログラム {0} には DefaultExecutorUri 属性が含まれていないため、このテスト探索プログラムに対応するテスト実行プログラムを無視しています。テスト アダプター アドインの再インストールが必要になる場合があります。 + + + Failed to initialize client proxy: could not connect to test process. + + クライアント プロキシを初期化できませんでした。テスト プロセスに接続できませんでした。 + + + This operation is not allowed in the context of a non-debug run. + + この操作は、非デバッグ実行のコンテキストでは許可されていません。 + + + Could not find test executor with URI '{0}'. Make sure that the test executor is installed and supports .net runtime version {1}. + {0} - Executor uri String {1}- Version - .net Version Eg:-2.0.50727.00 + URI が '{0}' のテスト実行プログラムが見つかりませんでした。テスト実行プログラムがインストールされ、.net ランタイム バージョン {1} をサポートしていることをご確認ください。 + + + None of the specified source(s) '{0}' is valid. Fix the above errors/warnings and then try again. + + 指定されたソース '{0}' がいずれも有効ではありません。上記のエラーおよび警告を修正してから、もう一度お試しください。 + + + , + + , + + + No tests matched the filter because it contains one or more properties that are not valid ({0}). Specify filter expression containing valid properties ({1}). + + フィルターに一致するテストがありません。フィルターに無効なプロパティが 1 つ以上含まれています ({0})。有効なプロパティを含むフィルター式 ({1}) を指定してください。 + + + Could not find {0}. Make sure that the dotnet is installed on the machine. + {0} が見つかりませんでした。dotnet がマシンにインストールされていることを確認してください。 + + + + Testhost process exited with error: {0}. Please check the diagnostic logs for more information. + Testhost プロセスがエラーで終了しました: {0}。詳細については、診断ログを確認してください。 + + + + DataCollector debugging is enabled. Please attach debugger to datacollector process to continue. + DataCollector のデバッグが有効です。続行するにはデバッガーを datacollector プロセスにアタッチしてください。 + + + + No test is available in {0}. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again. + {0} で使用できるテストはありません。テスト探索プログラムおよび実行プログラムが登録されており、プラットフォームおよびフレームワークのバージョン設定が適切であることを確認してから、もう一度お試しください。 + + + + Logging TestHost Diagnostics in file: {0} + 次のファイルで TestHost 診断をログ記録しています: {0} + + + + Failed to launch testhost with error: {0} + エラーが発生したため、TestHost を起動できませんでした: {0} + + + + ExecutionThreadApartmentState option not supported for framework: {0}. + フレームワークでの ThreadApartmentState オプションの実行はサポートされていません: {0}。 + + + + You are using an older version of Microsoft.NET.Test.Sdk. Kindly move to a version equal or greater than 15.3.0. + Microsoft.NET.Test.Sdk の古いバージョンを使用しています。15.3.0 以降のバージョンに移行することをお勧めします。 + + + + Could not find extensions: {0} + 拡張機能が見つかりませんでした: {0} + + + + Adapter lookup is being changed, please follow https://github.com/Microsoft/vstest-docs/blob/main/RFCs/0022-User-Specified-TestAdapter-Lookup.md#roadmap for more details. + アダプター検索は変更中です。詳細については、https://github.com/Microsoft/vstest-docs/blob/main/RFCs/0022-User-Specified-TestAdapter-Lookup.md#roadmap をご覧ください。 + + + + No test matches the given testcase filter `{0}` in {1} + 指定のテストケース フィルター `{0}` に一致するテストは {1} にありません + + + + Discovery of tests cancelled. + テストの検出が取り消されました。 + + + + Cannot attach the debugger to the default test host with process ID: {0}. + デバッガーをプロセス ID: {0} の既定のテスト ホストにアタッチできません。 + + + + {0} Access denied while trying to create "TestResults" folder in mentioned location. You are getting this exception because you are running vstest.console.exe from a folder which requires having write access. To solve the issue: please run vstest.console.exe from a folder where you have write privileges. + {0} 記載した場所に "TestResults" フォルダーを作成しようとしたときにアクセスが拒否されました。書き込みアクセスを必要とするフォルダーから vstest.console.exe を実行しているため、この例外が発生しています。この問題を解決するには、書き込み特権のあるフォルダーから vstest.console.exe を実行してください。 + + + + Could not find an available proxy to deque. + デキューするために使用できるプロキシが見つかりませんでした。 + + + + Proxy with id {0} is not managed by the current session manager. + ID が {0} のプロキシは、現在のセッション マネージャーで管理されません。 + + + + Proxy with id {0} is already available and cannot be re-enqueued. + ID が {0} のプロキシは、既に使用可能になっているため、再度エンキューすることはできません。 + + + + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ko.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ko.xlf index f88ef37e04..cfbb3628b0 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ko.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ko.xlf @@ -1,172 +1,162 @@ - - - - - - Exception occurred while instantiating discoverer : {0} - - {0} Discoverer를 인스턴스화하는 중 예외가 발생했습니다. - - - Multiple test adapters with the same uri '{0}' were found. Ignoring adapter '{1}'. Please uninstall the conflicting adapter(s) to avoid this warning. - {0} is the unique identifier of test adapter. {1} is the name of the test adapter that shares a unique identifier with a previously loaded adapter. - 동일한 URI '{0}'을(를) 가진 테스트 어댑터가 여러 개 있습니다. '{1}' 어댑터를 무시합니다. 이 경고가 발생하지 않게 하려면 충돌하는 어댑터를 제거하세요. - - - Ignoring the specified duplicate source '{0}'. - - 지정한 중복되는 '{0}' 소스를 무시합니다. - - - An exception occurred while test discoverer '{0}' was loading tests. Exception: {1} - - 테스트 Discoverer '{0}'에서 테스트를 로드하는 동안 예외가 발생했습니다. 예외: {1} - - - An exception occurred while invoking executor '{0}': {1} - - '{0}' Executor를 호출하는 동안 예외가 발생했습니다. {1} - - - Could not find file {0}. - - {0} 파일을 찾을 수 없습니다. - - - Host debugging is enabled. Please attach debugger to testhost process to continue. - Host, testhost are key words, it should not be localized - 호스트 디버깅을 사용하도록 설정했습니다. testhost 프로세스를 계속하려면 디버거를 연결하세요. - - - Ignoring the test executor corresponding to test discoverer {0} because the discoverer does not have the DefaultExecutorUri attribute . You might need to re-install the test adapter add-in. - - Discoverer에 DefaultExecutorUri 특성이 없으므로 테스트 Discoverer {0}에 해당하는 테스트 Executor를 무시합니다. 테스트 어댑터 추가 기능을 다시 설치해야 할 수 있습니다. - - - Failed to initialize client proxy: could not connect to test process. - - 클라이언트 프록시를 초기화하지 못했습니다. 테스트 프로세스에 연결할 수 없습니다. - - - This operation is not allowed in the context of a non-debug run. - - 디버그가 아닌 실행의 컨텍스트에서는 이 작업을 수행할 수 없습니다. - - - Could not find test executor with URI '{0}'. Make sure that the test executor is installed and supports .net runtime version {1}. - {0} - Executor uri String {1}- Version - .net Version Eg:-2.0.50727.00 - URI가 '{0}'인 테스트 Executor를 찾을 수 없습니다. 테스트 Executor가 설치되어 있고 .NET 런타임 버전 {1}을(를) 지원하는지 확인하세요. - - - None of the specified source(s) '{0}' is valid. Fix the above errors/warnings and then try again. - - 지정한 '{0}' 소스가 올바르지 않습니다. 위의 오류/경고를 해결한 후 다시 시도하세요. - - - , - - , - - - No tests matched the filter because it contains one or more properties that are not valid ({0}). Specify filter expression containing valid properties ({1}). - - 필터에 잘못된 속성({0})이 하나 이상 포함되어 있으므로 해당 필터와 일치하는 테스트가 없습니다. 유효한 속성({1})을 포함하는 필터 식을 지정하세요. - - - Could not find {0}. Make sure that the dotnet is installed on the machine. - {0}을(를) 찾을 수 없습니다. 컴퓨터에 dotnet이 설치되어 있는지 확인하세요. - - - - Testhost process exited with error: {0}. Please check the diagnostic logs for more information. - Testhost 프로세스가 종료되었습니다(오류: {0}). 자세한 내용은 진단 로그를 확인하세요. - - - - DataCollector debugging is enabled. Please attach debugger to datacollector process to continue. - DataCollector 디버깅을 사용하도록 설정했습니다. datacollector 프로세스를 계속하려면 디버거를 연결하세요. - - - - No test is available in {0}. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again. - {0}에서 테스트를 사용할 수 없습니다. 테스트 Discoverer 및 Executor가 등록되고 플랫폼 및 프레임워크 버전 설정이 적절한지 확인하고 다시 시도하세요. - - - - Logging TestHost Diagnostics in file: {0} - {0} 파일에 TestHost Diagnostics 로깅 중 - - - - Failed to launch testhost with error: {0} - Testhost를 시작하지 못했습니다(오류: {0}). - - - - ExecutionThreadApartmentState option not supported for framework: {0}. - 프레임워크 {0}에 대해 ExecutionThreadApartmentState 옵션이 지원되지 않습니다. - - - - You are using an older version of Microsoft.NET.Test.Sdk. Kindly move to a version equal or greater than 15.3.0. - 이전 버전의 Microsoft.NET.Test.Sdk를 사용하고 있습니다. 15.3.0 이상 버전으로 이동하세요. - - - - Could not find extensions: {0} - 확장을 찾을 수 없음: {0} - - - - Adapter lookup is being changed, please follow https://github.com/Microsoft/vstest-docs/blob/main/RFCs/0022-User-Specified-TestAdapter-Lookup.md#roadmap for more details. - 어댑터 조회가 변경됩니다. 자세한 내용은 https://github.com/Microsoft/vstest-docs/blob/main/RFCs/0022-User-Specified-TestAdapter-Lookup.md#roadmap을 참조하세요. - - - - No test matches the given testcase filter `{0}` in {1} - {1}에 지정된 테스트 사례 필터 `{0}`과(와) 일치하는 테스트가 없습니다. - - - - Discovery of tests cancelled. - 테스트 검색이 취소되었습니다. - - - - Cannot attach the debugger to the default test host with process ID: {0}. - 프로세스 ID가 {0}인 기본 테스트 호스트에 디버거를 연결할 수 없습니다. - - - - {0} Access denied while trying to create "TestResults" folder in mentioned location. You are getting this exception because you are running vstest.console.exe from a folder which requires having write access. To solve the issue: please run vstest.console.exe from a folder where you have write privileges. - {0} "TestResults" 폴더를 언급된 위치에 만드는 동안 액세스가 거부되었습니다. 쓰기 권한이 필요한 폴더에서 vstest.console.exe를 실행하고 있으므로 이 예외가 발생했습니다. 이 문제를 해결하려면 쓰기 권한이 있는 폴더에서 vstest.console.exe를 실행하세요. - - - - Could not find an available proxy to deque. - 큐에서 제거하기 위해 사용할 수 있는 프록시를 찾을 수 없습니다. - - - - Proxy with id {0} is not managed by the current session manager. - ID가 {0}인 프록시가 현재 세션 관리자에서 관리되지 않습니다. - - - - Proxy with id {0} is already available and cannot be re-enqueued. - ID가 {0}인 프록시를 이미 사용할 수 있으며 큐에 다시 넣을 수 없습니다. - - - - No suitable test runtime provider found for this run. - No suitable test runtime provider found for this run. - - - - Could not find an available proxy to match the original run settings. - Could not find an available proxy to match the original run settings. - - - - - + + + + + + Exception occurred while instantiating discoverer : {0} + + {0} Discoverer를 인스턴스화하는 중 예외가 발생했습니다. + + + Multiple test adapters with the same uri '{0}' were found. Ignoring adapter '{1}'. Please uninstall the conflicting adapter(s) to avoid this warning. + {0} is the unique identifier of test adapter. {1} is the name of the test adapter that shares a unique identifier with a previously loaded adapter. + 동일한 URI '{0}'을(를) 가진 테스트 어댑터가 여러 개 있습니다. '{1}' 어댑터를 무시합니다. 이 경고가 발생하지 않게 하려면 충돌하는 어댑터를 제거하세요. + + + Ignoring the specified duplicate source '{0}'. + + 지정한 중복되는 '{0}' 소스를 무시합니다. + + + An exception occurred while test discoverer '{0}' was loading tests. Exception: {1} + + 테스트 Discoverer '{0}'에서 테스트를 로드하는 동안 예외가 발생했습니다. 예외: {1} + + + An exception occurred while invoking executor '{0}': {1} + + '{0}' Executor를 호출하는 동안 예외가 발생했습니다. {1} + + + Could not find file {0}. + + {0} 파일을 찾을 수 없습니다. + + + Host debugging is enabled. Please attach debugger to testhost process to continue. + Host, testhost are key words, it should not be localized + 호스트 디버깅을 사용하도록 설정했습니다. testhost 프로세스를 계속하려면 디버거를 연결하세요. + + + Ignoring the test executor corresponding to test discoverer {0} because the discoverer does not have the DefaultExecutorUri attribute . You might need to re-install the test adapter add-in. + + Discoverer에 DefaultExecutorUri 특성이 없으므로 테스트 Discoverer {0}에 해당하는 테스트 Executor를 무시합니다. 테스트 어댑터 추가 기능을 다시 설치해야 할 수 있습니다. + + + Failed to initialize client proxy: could not connect to test process. + + 클라이언트 프록시를 초기화하지 못했습니다. 테스트 프로세스에 연결할 수 없습니다. + + + This operation is not allowed in the context of a non-debug run. + + 디버그가 아닌 실행의 컨텍스트에서는 이 작업을 수행할 수 없습니다. + + + Could not find test executor with URI '{0}'. Make sure that the test executor is installed and supports .net runtime version {1}. + {0} - Executor uri String {1}- Version - .net Version Eg:-2.0.50727.00 + URI가 '{0}'인 테스트 Executor를 찾을 수 없습니다. 테스트 Executor가 설치되어 있고 .NET 런타임 버전 {1}을(를) 지원하는지 확인하세요. + + + None of the specified source(s) '{0}' is valid. Fix the above errors/warnings and then try again. + + 지정한 '{0}' 소스가 올바르지 않습니다. 위의 오류/경고를 해결한 후 다시 시도하세요. + + + , + + , + + + No tests matched the filter because it contains one or more properties that are not valid ({0}). Specify filter expression containing valid properties ({1}). + + 필터에 잘못된 속성({0})이 하나 이상 포함되어 있으므로 해당 필터와 일치하는 테스트가 없습니다. 유효한 속성({1})을 포함하는 필터 식을 지정하세요. + + + Could not find {0}. Make sure that the dotnet is installed on the machine. + {0}을(를) 찾을 수 없습니다. 컴퓨터에 dotnet이 설치되어 있는지 확인하세요. + + + + Testhost process exited with error: {0}. Please check the diagnostic logs for more information. + Testhost 프로세스가 종료되었습니다(오류: {0}). 자세한 내용은 진단 로그를 확인하세요. + + + + DataCollector debugging is enabled. Please attach debugger to datacollector process to continue. + DataCollector 디버깅을 사용하도록 설정했습니다. datacollector 프로세스를 계속하려면 디버거를 연결하세요. + + + + No test is available in {0}. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again. + {0}에서 테스트를 사용할 수 없습니다. 테스트 Discoverer 및 Executor가 등록되고 플랫폼 및 프레임워크 버전 설정이 적절한지 확인하고 다시 시도하세요. + + + + Logging TestHost Diagnostics in file: {0} + {0} 파일에 TestHost Diagnostics 로깅 중 + + + + Failed to launch testhost with error: {0} + Testhost를 시작하지 못했습니다(오류: {0}). + + + + ExecutionThreadApartmentState option not supported for framework: {0}. + 프레임워크 {0}에 대해 ExecutionThreadApartmentState 옵션이 지원되지 않습니다. + + + + You are using an older version of Microsoft.NET.Test.Sdk. Kindly move to a version equal or greater than 15.3.0. + 이전 버전의 Microsoft.NET.Test.Sdk를 사용하고 있습니다. 15.3.0 이상 버전으로 이동하세요. + + + + Could not find extensions: {0} + 확장을 찾을 수 없음: {0} + + + + Adapter lookup is being changed, please follow https://github.com/Microsoft/vstest-docs/blob/main/RFCs/0022-User-Specified-TestAdapter-Lookup.md#roadmap for more details. + 어댑터 조회가 변경됩니다. 자세한 내용은 https://github.com/Microsoft/vstest-docs/blob/main/RFCs/0022-User-Specified-TestAdapter-Lookup.md#roadmap을 참조하세요. + + + + No test matches the given testcase filter `{0}` in {1} + {1}에 지정된 테스트 사례 필터 `{0}`과(와) 일치하는 테스트가 없습니다. + + + + Discovery of tests cancelled. + 테스트 검색이 취소되었습니다. + + + + Cannot attach the debugger to the default test host with process ID: {0}. + 프로세스 ID가 {0}인 기본 테스트 호스트에 디버거를 연결할 수 없습니다. + + + + {0} Access denied while trying to create "TestResults" folder in mentioned location. You are getting this exception because you are running vstest.console.exe from a folder which requires having write access. To solve the issue: please run vstest.console.exe from a folder where you have write privileges. + {0} "TestResults" 폴더를 언급된 위치에 만드는 동안 액세스가 거부되었습니다. 쓰기 권한이 필요한 폴더에서 vstest.console.exe를 실행하고 있으므로 이 예외가 발생했습니다. 이 문제를 해결하려면 쓰기 권한이 있는 폴더에서 vstest.console.exe를 실행하세요. + + + + Could not find an available proxy to deque. + 큐에서 제거하기 위해 사용할 수 있는 프록시를 찾을 수 없습니다. + + + + Proxy with id {0} is not managed by the current session manager. + ID가 {0}인 프록시가 현재 세션 관리자에서 관리되지 않습니다. + + + + Proxy with id {0} is already available and cannot be re-enqueued. + ID가 {0}인 프록시를 이미 사용할 수 있으며 큐에 다시 넣을 수 없습니다. + + + + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.pl.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.pl.xlf index 8206e85d64..e4f0dde140 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.pl.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.pl.xlf @@ -1,172 +1,162 @@ - - - - - - Exception occurred while instantiating discoverer : {0} - - Wystąpił wyjątek podczas tworzenia wystąpienia wykrywacza: {0} - - - Multiple test adapters with the same uri '{0}' were found. Ignoring adapter '{1}'. Please uninstall the conflicting adapter(s) to avoid this warning. - {0} is the unique identifier of test adapter. {1} is the name of the test adapter that shares a unique identifier with a previously loaded adapter. - Znaleziono wiele adapterów testowych z takim samym identyfikatorem URI „{0}”. Adapter „{1}” zostanie zignorowany. Aby uniknąć tego ostrzeżenia, odinstaluj adaptery powodujące konflikt. - - - Ignoring the specified duplicate source '{0}'. - - Określone zduplikowane źródło „{0}” zostanie zignorowane. - - - An exception occurred while test discoverer '{0}' was loading tests. Exception: {1} - - Wystąpił wyjątek podczas ładowania testów przez wykrywacz testów „{0}”. Wyjątek: {1} - - - An exception occurred while invoking executor '{0}': {1} - - Wystąpił wyjątek podczas wywoływania modułu wykonywania „{0}”: {1} - - - Could not find file {0}. - - Nie można odnaleźć pliku {0}. - - - Host debugging is enabled. Please attach debugger to testhost process to continue. - Host, testhost are key words, it should not be localized - Debugowanie hosta zostało włączone. Dołącz debuger do procesu testhost, aby kontynuować. - - - Ignoring the test executor corresponding to test discoverer {0} because the discoverer does not have the DefaultExecutorUri attribute . You might need to re-install the test adapter add-in. - - Moduł wykonywania testów odpowiadający wykrywaczowi testów {0} zostanie zignorowany, ponieważ wykrywacz nie ma atrybutu DefaultExecutorUri. Konieczna może być ponowna instalacja dodatku adaptera testowego. - - - Failed to initialize client proxy: could not connect to test process. - - Zainicjowanie serwera proxy klienta nie powiodło się: nie można nawiązać połączenia z procesem testowania. - - - This operation is not allowed in the context of a non-debug run. - - Ta operacja jest niedozwolona w kontekście uruchamiania bez debugowania. - - - Could not find test executor with URI '{0}'. Make sure that the test executor is installed and supports .net runtime version {1}. - {0} - Executor uri String {1}- Version - .net Version Eg:-2.0.50727.00 - Nie można odnaleźć modułu wykonywania testów o identyfikatorze URI „{0}”. Upewnij się, że moduł wykonywania testów został zainstalowany i obsługuje środowisko uruchomieniowe platformy .NET w wersji {1}. - - - None of the specified source(s) '{0}' is valid. Fix the above errors/warnings and then try again. - - Wszystkie określone źródła „{0}” są nieprawidłowe. Napraw powyższe błędy/ostrzeżenia i spróbuj ponownie. - - - , - - , - - - No tests matched the filter because it contains one or more properties that are not valid ({0}). Specify filter expression containing valid properties ({1}). - - Brak testów zgodnych z filtrem, ponieważ zawiera on co najmniej jedną nieprawidłową właściwość ({0}). Określ wyrażenie filtru zawierające prawidłowe właściwości ({1}). - - - Could not find {0}. Make sure that the dotnet is installed on the machine. - Nie znaleziono elementu {0}. Upewnij się, że program dotnet jest zainstalowany na maszynie. - - - - Testhost process exited with error: {0}. Please check the diagnostic logs for more information. - Zakończono proces testhost z powodu błędu: {0}. Sprawdź dzienniki diagnostyczne, aby uzyskać więcej informacji. - - - - DataCollector debugging is enabled. Please attach debugger to datacollector process to continue. - Debugowanie modułu zbierającego dane zostało włączone. Dołącz debuger do procesu datacollector, aby kontynuować. - - - - No test is available in {0}. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again. - W elemencie {0} nie są dostępne żadne testy. Upewnij się, że wykrywacze i moduły wykonywania testów są zarejestrowane oraz że ustawienia wersji platformy i struktury są odpowiednie, a następnie spróbuj ponownie. - - - - Logging TestHost Diagnostics in file: {0} - Rejestrowanie diagnostyki TestHost w pliku: {0} - - - - Failed to launch testhost with error: {0} - Nie można uruchomić hosta testów. Błąd: {0} - - - - ExecutionThreadApartmentState option not supported for framework: {0}. - Opcja ExecutionThreadApartmentState nie jest obsługiwana dla platformy: {0}. - - - - You are using an older version of Microsoft.NET.Test.Sdk. Kindly move to a version equal or greater than 15.3.0. - Używamy starszej wersji zestawu Microsoft.NET.Test.Sdk. Przejdź na wersję 15.3.0 lub nowszą. - - - - Could not find extensions: {0} - Nie można znaleźć rozszerzeń: {0} - - - - Adapter lookup is being changed, please follow https://github.com/Microsoft/vstest-docs/blob/main/RFCs/0022-User-Specified-TestAdapter-Lookup.md#roadmap for more details. - Wyszukiwanie adaptera jest zmieniane. Aby uzyskać więcej szczegółów, przejdź do strony https://github.com/Microsoft/vstest-docs/blob/main/RFCs/0022-User-Specified-TestAdapter-Lookup.md#roadmap. - - - - No test matches the given testcase filter `{0}` in {1} - Żaden test nie jest zgodny z podanym filtrem przypadku testowego „{0}” w elemencie {1} - - - - Discovery of tests cancelled. - Odnajdywanie testów zostało anulowane. - - - - Cannot attach the debugger to the default test host with process ID: {0}. - Nie można dołączyć debugera do domyślnego hosta testowego z identyfikatorem procesu: {0}. - - - - {0} Access denied while trying to create "TestResults" folder in mentioned location. You are getting this exception because you are running vstest.console.exe from a folder which requires having write access. To solve the issue: please run vstest.console.exe from a folder where you have write privileges. - {0} Odmowa dostępu podczas próby utworzenia folderu „TestResults” w określonej lokalizacji. Widzisz ten wyjątek, ponieważ program vstest.console.exe został uruchomiony z folderu wymagającego dostępu do zapisu. Aby rozwiązać ten problem: uruchom program vstest.console.exe z folderu, w którym masz uprawnienia do zapisu. - - - - Could not find an available proxy to deque. - Nie można było znaleźć dostępnego serwera proxy do umieszczenia w kolejce dwukierunkowej. - - - - Proxy with id {0} is not managed by the current session manager. - Serwer proxy o identyfikatorze {0} nie jest zarządzany przez bieżącego menedżera sesji. - - - - Proxy with id {0} is already available and cannot be re-enqueued. - Serwer proxy o identyfikatorze {0} jest już dostępny i nie można go ponownie umieścić w kolejce. - - - - No suitable test runtime provider found for this run. - No suitable test runtime provider found for this run. - - - - Could not find an available proxy to match the original run settings. - Could not find an available proxy to match the original run settings. - - - - - + + + + + + Exception occurred while instantiating discoverer : {0} + + Wystąpił wyjątek podczas tworzenia wystąpienia wykrywacza: {0} + + + Multiple test adapters with the same uri '{0}' were found. Ignoring adapter '{1}'. Please uninstall the conflicting adapter(s) to avoid this warning. + {0} is the unique identifier of test adapter. {1} is the name of the test adapter that shares a unique identifier with a previously loaded adapter. + Znaleziono wiele adapterów testowych z takim samym identyfikatorem URI „{0}”. Adapter „{1}” zostanie zignorowany. Aby uniknąć tego ostrzeżenia, odinstaluj adaptery powodujące konflikt. + + + Ignoring the specified duplicate source '{0}'. + + Określone zduplikowane źródło „{0}” zostanie zignorowane. + + + An exception occurred while test discoverer '{0}' was loading tests. Exception: {1} + + Wystąpił wyjątek podczas ładowania testów przez wykrywacz testów „{0}”. Wyjątek: {1} + + + An exception occurred while invoking executor '{0}': {1} + + Wystąpił wyjątek podczas wywoływania modułu wykonywania „{0}”: {1} + + + Could not find file {0}. + + Nie można odnaleźć pliku {0}. + + + Host debugging is enabled. Please attach debugger to testhost process to continue. + Host, testhost are key words, it should not be localized + Debugowanie hosta zostało włączone. Dołącz debuger do procesu testhost, aby kontynuować. + + + Ignoring the test executor corresponding to test discoverer {0} because the discoverer does not have the DefaultExecutorUri attribute . You might need to re-install the test adapter add-in. + + Moduł wykonywania testów odpowiadający wykrywaczowi testów {0} zostanie zignorowany, ponieważ wykrywacz nie ma atrybutu DefaultExecutorUri. Konieczna może być ponowna instalacja dodatku adaptera testowego. + + + Failed to initialize client proxy: could not connect to test process. + + Zainicjowanie serwera proxy klienta nie powiodło się: nie można nawiązać połączenia z procesem testowania. + + + This operation is not allowed in the context of a non-debug run. + + Ta operacja jest niedozwolona w kontekście uruchamiania bez debugowania. + + + Could not find test executor with URI '{0}'. Make sure that the test executor is installed and supports .net runtime version {1}. + {0} - Executor uri String {1}- Version - .net Version Eg:-2.0.50727.00 + Nie można odnaleźć modułu wykonywania testów o identyfikatorze URI „{0}”. Upewnij się, że moduł wykonywania testów został zainstalowany i obsługuje środowisko uruchomieniowe platformy .NET w wersji {1}. + + + None of the specified source(s) '{0}' is valid. Fix the above errors/warnings and then try again. + + Wszystkie określone źródła „{0}” są nieprawidłowe. Napraw powyższe błędy/ostrzeżenia i spróbuj ponownie. + + + , + + , + + + No tests matched the filter because it contains one or more properties that are not valid ({0}). Specify filter expression containing valid properties ({1}). + + Brak testów zgodnych z filtrem, ponieważ zawiera on co najmniej jedną nieprawidłową właściwość ({0}). Określ wyrażenie filtru zawierające prawidłowe właściwości ({1}). + + + Could not find {0}. Make sure that the dotnet is installed on the machine. + Nie znaleziono elementu {0}. Upewnij się, że program dotnet jest zainstalowany na maszynie. + + + + Testhost process exited with error: {0}. Please check the diagnostic logs for more information. + Zakończono proces testhost z powodu błędu: {0}. Sprawdź dzienniki diagnostyczne, aby uzyskać więcej informacji. + + + + DataCollector debugging is enabled. Please attach debugger to datacollector process to continue. + Debugowanie modułu zbierającego dane zostało włączone. Dołącz debuger do procesu datacollector, aby kontynuować. + + + + No test is available in {0}. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again. + W elemencie {0} nie są dostępne żadne testy. Upewnij się, że wykrywacze i moduły wykonywania testów są zarejestrowane oraz że ustawienia wersji platformy i struktury są odpowiednie, a następnie spróbuj ponownie. + + + + Logging TestHost Diagnostics in file: {0} + Rejestrowanie diagnostyki TestHost w pliku: {0} + + + + Failed to launch testhost with error: {0} + Nie można uruchomić hosta testów. Błąd: {0} + + + + ExecutionThreadApartmentState option not supported for framework: {0}. + Opcja ExecutionThreadApartmentState nie jest obsługiwana dla platformy: {0}. + + + + You are using an older version of Microsoft.NET.Test.Sdk. Kindly move to a version equal or greater than 15.3.0. + Używamy starszej wersji zestawu Microsoft.NET.Test.Sdk. Przejdź na wersję 15.3.0 lub nowszą. + + + + Could not find extensions: {0} + Nie można znaleźć rozszerzeń: {0} + + + + Adapter lookup is being changed, please follow https://github.com/Microsoft/vstest-docs/blob/main/RFCs/0022-User-Specified-TestAdapter-Lookup.md#roadmap for more details. + Wyszukiwanie adaptera jest zmieniane. Aby uzyskać więcej szczegółów, przejdź do strony https://github.com/Microsoft/vstest-docs/blob/main/RFCs/0022-User-Specified-TestAdapter-Lookup.md#roadmap. + + + + No test matches the given testcase filter `{0}` in {1} + Żaden test nie jest zgodny z podanym filtrem przypadku testowego „{0}” w elemencie {1} + + + + Discovery of tests cancelled. + Odnajdywanie testów zostało anulowane. + + + + Cannot attach the debugger to the default test host with process ID: {0}. + Nie można dołączyć debugera do domyślnego hosta testowego z identyfikatorem procesu: {0}. + + + + {0} Access denied while trying to create "TestResults" folder in mentioned location. You are getting this exception because you are running vstest.console.exe from a folder which requires having write access. To solve the issue: please run vstest.console.exe from a folder where you have write privileges. + {0} Odmowa dostępu podczas próby utworzenia folderu „TestResults” w określonej lokalizacji. Widzisz ten wyjątek, ponieważ program vstest.console.exe został uruchomiony z folderu wymagającego dostępu do zapisu. Aby rozwiązać ten problem: uruchom program vstest.console.exe z folderu, w którym masz uprawnienia do zapisu. + + + + Could not find an available proxy to deque. + Nie można było znaleźć dostępnego serwera proxy do umieszczenia w kolejce dwukierunkowej. + + + + Proxy with id {0} is not managed by the current session manager. + Serwer proxy o identyfikatorze {0} nie jest zarządzany przez bieżącego menedżera sesji. + + + + Proxy with id {0} is already available and cannot be re-enqueued. + Serwer proxy o identyfikatorze {0} jest już dostępny i nie można go ponownie umieścić w kolejce. + + + + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.pt-BR.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.pt-BR.xlf index 551c063e0e..1778f2925c 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.pt-BR.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.pt-BR.xlf @@ -1,172 +1,162 @@ - - - - - - Exception occurred while instantiating discoverer : {0} - - Ocorreu uma exceção ao criar uma instância do discoverer: {0} - - - Multiple test adapters with the same uri '{0}' were found. Ignoring adapter '{1}'. Please uninstall the conflicting adapter(s) to avoid this warning. - {0} is the unique identifier of test adapter. {1} is the name of the test adapter that shares a unique identifier with a previously loaded adapter. - Foram encontrados vários adaptadores de teste com o mesmo URI '{0}'. Ignorando o adaptador '{1}'. Desinstale os adaptadores conflitantes para evitar este aviso. - - - Ignoring the specified duplicate source '{0}'. - - Ignorando a fonte duplicada especificada '{0}'. - - - An exception occurred while test discoverer '{0}' was loading tests. Exception: {1} - - Ocorreu uma exceção enquanto o discoverer de testes '{0}' estava carregando testes. Exceção: {1} - - - An exception occurred while invoking executor '{0}': {1} - - Ocorreu uma exceção ao chamar o executor '{0}': {1} - - - Could not find file {0}. - - Não foi possível localizar o arquivo {0}. - - - Host debugging is enabled. Please attach debugger to testhost process to continue. - Host, testhost are key words, it should not be localized - O host de depuração está habilitado. Anexe o depurador ao processo de testhost para continuar. - - - Ignoring the test executor corresponding to test discoverer {0} because the discoverer does not have the DefaultExecutorUri attribute . You might need to re-install the test adapter add-in. - - Ignorando o executor de teste correspondente ao discoverer de teste {0} porque o discoverer não tem o atributo DefaultExecutorUri. Talvez seja necessário instalar novamente o suplemento do adaptador de teste. - - - Failed to initialize client proxy: could not connect to test process. - - Falha ao inicializar o proxy do cliente: não foi possível se conectar ao processo de teste. - - - This operation is not allowed in the context of a non-debug run. - - Esta operação não é permitida no contexto de uma execução sem depuração. - - - Could not find test executor with URI '{0}'. Make sure that the test executor is installed and supports .net runtime version {1}. - {0} - Executor uri String {1}- Version - .net Version Eg:-2.0.50727.00 - Não foi possível localizar o executor de teste com o URI '{0}'. Verifique se o executor de teste está instalado e oferece suporte à versão de runtime do .net {1}. - - - None of the specified source(s) '{0}' is valid. Fix the above errors/warnings and then try again. - - Nenhuma das fontes especificadas '{0}' é válida. Corrija os erros/avisos acima e tente novamente. - - - , - - , - - - No tests matched the filter because it contains one or more properties that are not valid ({0}). Specify filter expression containing valid properties ({1}). - - Nenhum teste correspondeu ao filtro porque ele contém uma ou mais propriedades que não são válidas ({0}). Especifique a expressão de filtro contendo as propriedades válidas ({1}). - - - Could not find {0}. Make sure that the dotnet is installed on the machine. - Não foi possível localizar {0}. Certifique-se de que o dotnet esteja instalado no computador. - - - - Testhost process exited with error: {0}. Please check the diagnostic logs for more information. - O processo do testhost foi encerrado com o erro: {0}. Verifique os logs de diagnóstico para obter mais informações. - - - - DataCollector debugging is enabled. Please attach debugger to datacollector process to continue. - A depuração do DataCollector está habilitada. Anexe o depurador ao processo datacollector para continuar. - - - - No test is available in {0}. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again. - Não há nenhum teste disponível em {0}. Verifique se o detector e os executores de teste estão registrados e se as configurações de versão da estrutura da plataforma & são apropriadas e tente novamente. - - - - Logging TestHost Diagnostics in file: {0} - Registro em log do diagnóstico TestHost no arquivo: {0} - - - - Failed to launch testhost with error: {0} - Falha ao iniciar o host de teste com o erro: {0} - - - - ExecutionThreadApartmentState option not supported for framework: {0}. - A opção ExecutionThreadApartmentState não tem suporte para a estrutura: {0}. - - - - You are using an older version of Microsoft.NET.Test.Sdk. Kindly move to a version equal or greater than 15.3.0. - Você está usando uma versão mais antiga do Microsoft.NET.Test.Sdk. Mude para uma versão igual ou maior que 15.3.0. - - - - Could not find extensions: {0} - Não foi possível encontrar as extensões: {0} - - - - Adapter lookup is being changed, please follow https://github.com/Microsoft/vstest-docs/blob/main/RFCs/0022-User-Specified-TestAdapter-Lookup.md#roadmap for more details. - A pesquisa do adaptador está sendo alterada, siga https://github.com/Microsoft/vstest-docs/blob/main/RFCs/0022-User-Specified-TestAdapter-Lookup.md#roadmap para obter mais detalhes. - - - - No test matches the given testcase filter `{0}` in {1} - Nenhum teste corresponde ao filtro de testcase `{0}` determinado no {1} - - - - Discovery of tests cancelled. - Descoberta de testes cancelada. - - - - Cannot attach the debugger to the default test host with process ID: {0}. - Não é possível anexar o depurador ao host de teste padrão com a ID de processo: {0}. - - - - {0} Access denied while trying to create "TestResults" folder in mentioned location. You are getting this exception because you are running vstest.console.exe from a folder which requires having write access. To solve the issue: please run vstest.console.exe from a folder where you have write privileges. - {0} Acesso negado ao tentar criar a pasta "TestResults" no local mencionado. Você está recebendo esta exceção porque está executando o vstest.console.exe em uma pasta que requer acesso para gravação. Para resolver o problema: execute vstest.console.exe em uma pasta na qual você tenha privilégios de gravação. - - - - Could not find an available proxy to deque. - Não foi possível encontrar um proxy disponível para deque. - - - - Proxy with id {0} is not managed by the current session manager. - O proxy com a ID {0} não é gerenciado pelo gerenciador de sessão atual. - - - - Proxy with id {0} is already available and cannot be re-enqueued. - O proxy com a ID {0} já está disponível e não pode ser enfileirado novamente. - - - - No suitable test runtime provider found for this run. - No suitable test runtime provider found for this run. - - - - Could not find an available proxy to match the original run settings. - Could not find an available proxy to match the original run settings. - - - - - + + + + + + Exception occurred while instantiating discoverer : {0} + + Ocorreu uma exceção ao criar uma instância do discoverer: {0} + + + Multiple test adapters with the same uri '{0}' were found. Ignoring adapter '{1}'. Please uninstall the conflicting adapter(s) to avoid this warning. + {0} is the unique identifier of test adapter. {1} is the name of the test adapter that shares a unique identifier with a previously loaded adapter. + Foram encontrados vários adaptadores de teste com o mesmo URI '{0}'. Ignorando o adaptador '{1}'. Desinstale os adaptadores conflitantes para evitar este aviso. + + + Ignoring the specified duplicate source '{0}'. + + Ignorando a fonte duplicada especificada '{0}'. + + + An exception occurred while test discoverer '{0}' was loading tests. Exception: {1} + + Ocorreu uma exceção enquanto o discoverer de testes '{0}' estava carregando testes. Exceção: {1} + + + An exception occurred while invoking executor '{0}': {1} + + Ocorreu uma exceção ao chamar o executor '{0}': {1} + + + Could not find file {0}. + + Não foi possível localizar o arquivo {0}. + + + Host debugging is enabled. Please attach debugger to testhost process to continue. + Host, testhost are key words, it should not be localized + O host de depuração está habilitado. Anexe o depurador ao processo de testhost para continuar. + + + Ignoring the test executor corresponding to test discoverer {0} because the discoverer does not have the DefaultExecutorUri attribute . You might need to re-install the test adapter add-in. + + Ignorando o executor de teste correspondente ao discoverer de teste {0} porque o discoverer não tem o atributo DefaultExecutorUri. Talvez seja necessário instalar novamente o suplemento do adaptador de teste. + + + Failed to initialize client proxy: could not connect to test process. + + Falha ao inicializar o proxy do cliente: não foi possível se conectar ao processo de teste. + + + This operation is not allowed in the context of a non-debug run. + + Esta operação não é permitida no contexto de uma execução sem depuração. + + + Could not find test executor with URI '{0}'. Make sure that the test executor is installed and supports .net runtime version {1}. + {0} - Executor uri String {1}- Version - .net Version Eg:-2.0.50727.00 + Não foi possível localizar o executor de teste com o URI '{0}'. Verifique se o executor de teste está instalado e oferece suporte à versão de runtime do .net {1}. + + + None of the specified source(s) '{0}' is valid. Fix the above errors/warnings and then try again. + + Nenhuma das fontes especificadas '{0}' é válida. Corrija os erros/avisos acima e tente novamente. + + + , + + , + + + No tests matched the filter because it contains one or more properties that are not valid ({0}). Specify filter expression containing valid properties ({1}). + + Nenhum teste correspondeu ao filtro porque ele contém uma ou mais propriedades que não são válidas ({0}). Especifique a expressão de filtro contendo as propriedades válidas ({1}). + + + Could not find {0}. Make sure that the dotnet is installed on the machine. + Não foi possível localizar {0}. Certifique-se de que o dotnet esteja instalado no computador. + + + + Testhost process exited with error: {0}. Please check the diagnostic logs for more information. + O processo do testhost foi encerrado com o erro: {0}. Verifique os logs de diagnóstico para obter mais informações. + + + + DataCollector debugging is enabled. Please attach debugger to datacollector process to continue. + A depuração do DataCollector está habilitada. Anexe o depurador ao processo datacollector para continuar. + + + + No test is available in {0}. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again. + Não há nenhum teste disponível em {0}. Verifique se o detector e os executores de teste estão registrados e se as configurações de versão da estrutura da plataforma & são apropriadas e tente novamente. + + + + Logging TestHost Diagnostics in file: {0} + Registro em log do diagnóstico TestHost no arquivo: {0} + + + + Failed to launch testhost with error: {0} + Falha ao iniciar o host de teste com o erro: {0} + + + + ExecutionThreadApartmentState option not supported for framework: {0}. + A opção ExecutionThreadApartmentState não tem suporte para a estrutura: {0}. + + + + You are using an older version of Microsoft.NET.Test.Sdk. Kindly move to a version equal or greater than 15.3.0. + Você está usando uma versão mais antiga do Microsoft.NET.Test.Sdk. Mude para uma versão igual ou maior que 15.3.0. + + + + Could not find extensions: {0} + Não foi possível encontrar as extensões: {0} + + + + Adapter lookup is being changed, please follow https://github.com/Microsoft/vstest-docs/blob/main/RFCs/0022-User-Specified-TestAdapter-Lookup.md#roadmap for more details. + A pesquisa do adaptador está sendo alterada, siga https://github.com/Microsoft/vstest-docs/blob/main/RFCs/0022-User-Specified-TestAdapter-Lookup.md#roadmap para obter mais detalhes. + + + + No test matches the given testcase filter `{0}` in {1} + Nenhum teste corresponde ao filtro de testcase `{0}` determinado no {1} + + + + Discovery of tests cancelled. + Descoberta de testes cancelada. + + + + Cannot attach the debugger to the default test host with process ID: {0}. + Não é possível anexar o depurador ao host de teste padrão com a ID de processo: {0}. + + + + {0} Access denied while trying to create "TestResults" folder in mentioned location. You are getting this exception because you are running vstest.console.exe from a folder which requires having write access. To solve the issue: please run vstest.console.exe from a folder where you have write privileges. + {0} Acesso negado ao tentar criar a pasta "TestResults" no local mencionado. Você está recebendo esta exceção porque está executando o vstest.console.exe em uma pasta que requer acesso para gravação. Para resolver o problema: execute vstest.console.exe em uma pasta na qual você tenha privilégios de gravação. + + + + Could not find an available proxy to deque. + Não foi possível encontrar um proxy disponível para deque. + + + + Proxy with id {0} is not managed by the current session manager. + O proxy com a ID {0} não é gerenciado pelo gerenciador de sessão atual. + + + + Proxy with id {0} is already available and cannot be re-enqueued. + O proxy com a ID {0} já está disponível e não pode ser enfileirado novamente. + + + + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ru.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ru.xlf index d0a7b54853..c8ae0e2a0a 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ru.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ru.xlf @@ -1,172 +1,162 @@ - - - - - - Exception occurred while instantiating discoverer : {0} - - При создании экземпляра средства обнаружения возникло исключение: {0} - - - Multiple test adapters with the same uri '{0}' were found. Ignoring adapter '{1}'. Please uninstall the conflicting adapter(s) to avoid this warning. - {0} is the unique identifier of test adapter. {1} is the name of the test adapter that shares a unique identifier with a previously loaded adapter. - Найдено несколько адаптеров тестов с одинаковым URI "{0}". Адаптер "{1}" пропускается. Чтобы избежать этого предупреждения, удалите все конфликтующие адаптеры. - - - Ignoring the specified duplicate source '{0}'. - - Указанный повторяющийся источник "{0}" игнорируется. - - - An exception occurred while test discoverer '{0}' was loading tests. Exception: {1} - - При загрузке тестов средством обнаружения тестов "{0}" возникло исключение. Исключение: {1} - - - An exception occurred while invoking executor '{0}': {1} - - При вызове исполнителя "{0}" возникло исключение: {1} - - - Could not find file {0}. - - Не удалось найти файл {0}. - - - Host debugging is enabled. Please attach debugger to testhost process to continue. - Host, testhost are key words, it should not be localized - Включена отладка узла. Для продолжения подключите отладчик к процессу testhost. - - - Ignoring the test executor corresponding to test discoverer {0} because the discoverer does not have the DefaultExecutorUri attribute . You might need to re-install the test adapter add-in. - - Исполнитель теста, соответствующий средству обнаружения тестов {0}, пропускается, так как у средства обнаружения нет атрибута DefaultExecutorUri. Возможно, необходимо переустановить надстройку адаптера теста. - - - Failed to initialize client proxy: could not connect to test process. - - Не удалось инициализировать прокси клиента: не удалось подключиться к процессу теста. - - - This operation is not allowed in the context of a non-debug run. - - Эта операция запрещена в контексте неотладочного запуска. - - - Could not find test executor with URI '{0}'. Make sure that the test executor is installed and supports .net runtime version {1}. - {0} - Executor uri String {1}- Version - .net Version Eg:-2.0.50727.00 - Не удалось найти исполнитель тестов с URI "{0}". Убедитесь, что исполнитель тестов установлен и поддерживает версию среды выполнения .NET {1}. - - - None of the specified source(s) '{0}' is valid. Fix the above errors/warnings and then try again. - - Ни один из указанных источников "{0}" не является допустимым. Исправьте эти ошибки и предупреждения и повторите попытку. - - - , - - , - - - No tests matched the filter because it contains one or more properties that are not valid ({0}). Specify filter expression containing valid properties ({1}). - - Соответствующих фильтру тестов нет, так как фильтр содержит одно недопустимое свойство или несколько ({0}). Укажите выражение фильтра, содержащее допустимые свойства ({1}). - - - Could not find {0}. Make sure that the dotnet is installed on the machine. - Не удалось найти {0}. Убедитесь, что dotnet установлен на компьютере. - - - - Testhost process exited with error: {0}. Please check the diagnostic logs for more information. - Процесс testhost завершился с ошибкой: {0}. Дополнительные сведения см. в журналах диагностики. - - - - DataCollector debugging is enabled. Please attach debugger to datacollector process to continue. - Включена отладка datacollector. Для продолжения подключите отладчик к процессу datacollector. - - - - No test is available in {0}. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again. - В {0} нет доступных тестов. Убедитесь, что средства обнаружения и выполнения тестов зарегистрированы, а также проверьте правильность параметров платформы и версии платформы, после чего повторите попытку. - - - - Logging TestHost Diagnostics in file: {0} - Ведение журналов диагностики TestHost в файле: {0} - - - - Failed to launch testhost with error: {0} - Не удалось запустить хост для тестов с ошибкой: {0} - - - - ExecutionThreadApartmentState option not supported for framework: {0}. - Параметр ExecutionThreadApartmentState не поддерживается для платформы: {0}. - - - - You are using an older version of Microsoft.NET.Test.Sdk. Kindly move to a version equal or greater than 15.3.0. - Вы используете более старую версию Microsoft.NET.Test.Sdk. Перейдите на версию 15.3.0 или более позднюю. - - - - Could not find extensions: {0} - Не удалось найти расширения: {0} - - - - Adapter lookup is being changed, please follow https://github.com/Microsoft/vstest-docs/blob/main/RFCs/0022-User-Specified-TestAdapter-Lookup.md#roadmap for more details. - Изменяется поиск адаптеров. Дополнительные сведения: https://github.com/Microsoft/vstest-docs/blob/main/RFCs/0022-User-Specified-TestAdapter-Lookup.md#roadmap. - - - - No test matches the given testcase filter `{0}` in {1} - Нет тестов, соответствующих указанному фильтру тестовых случаев "{0}" в {1} - - - - Discovery of tests cancelled. - Обнаружение тестов отменено. - - - - Cannot attach the debugger to the default test host with process ID: {0}. - Не удается подключить отладчик к узлу тестирования по умолчанию с идентификатором процесса {0}. - - - - {0} Access denied while trying to create "TestResults" folder in mentioned location. You are getting this exception because you are running vstest.console.exe from a folder which requires having write access. To solve the issue: please run vstest.console.exe from a folder where you have write privileges. - {0} Отказано в доступе при попытке создания папки "TestResults" в указанном расположении. Это исключение возникло, так как вы запускаете файл vstest.console.exe из папки, для которой требуется доступ на запись. Чтобы устранить эту проблему, запустите vstest.console.exe из папки, для которой у вас есть разрешения на запись. - - - - Could not find an available proxy to deque. - Не удалось найти доступный прокси-сервер для двусторонней очереди. - - - - Proxy with id {0} is not managed by the current session manager. - Прокси-сервер с идентификатором {0} не управляется текущим диспетчером сеансов. - - - - Proxy with id {0} is already available and cannot be re-enqueued. - Прокси-сервер с идентификатором {0} уже доступен и не может быть повторно поставлен в очередь. - - - - No suitable test runtime provider found for this run. - No suitable test runtime provider found for this run. - - - - Could not find an available proxy to match the original run settings. - Could not find an available proxy to match the original run settings. - - - - - + + + + + + Exception occurred while instantiating discoverer : {0} + + При создании экземпляра средства обнаружения возникло исключение: {0} + + + Multiple test adapters with the same uri '{0}' were found. Ignoring adapter '{1}'. Please uninstall the conflicting adapter(s) to avoid this warning. + {0} is the unique identifier of test adapter. {1} is the name of the test adapter that shares a unique identifier with a previously loaded adapter. + Найдено несколько адаптеров тестов с одинаковым URI "{0}". Адаптер "{1}" пропускается. Чтобы избежать этого предупреждения, удалите все конфликтующие адаптеры. + + + Ignoring the specified duplicate source '{0}'. + + Указанный повторяющийся источник "{0}" игнорируется. + + + An exception occurred while test discoverer '{0}' was loading tests. Exception: {1} + + При загрузке тестов средством обнаружения тестов "{0}" возникло исключение. Исключение: {1} + + + An exception occurred while invoking executor '{0}': {1} + + При вызове исполнителя "{0}" возникло исключение: {1} + + + Could not find file {0}. + + Не удалось найти файл {0}. + + + Host debugging is enabled. Please attach debugger to testhost process to continue. + Host, testhost are key words, it should not be localized + Включена отладка узла. Для продолжения подключите отладчик к процессу testhost. + + + Ignoring the test executor corresponding to test discoverer {0} because the discoverer does not have the DefaultExecutorUri attribute . You might need to re-install the test adapter add-in. + + Исполнитель теста, соответствующий средству обнаружения тестов {0}, пропускается, так как у средства обнаружения нет атрибута DefaultExecutorUri. Возможно, необходимо переустановить надстройку адаптера теста. + + + Failed to initialize client proxy: could not connect to test process. + + Не удалось инициализировать прокси клиента: не удалось подключиться к процессу теста. + + + This operation is not allowed in the context of a non-debug run. + + Эта операция запрещена в контексте неотладочного запуска. + + + Could not find test executor with URI '{0}'. Make sure that the test executor is installed and supports .net runtime version {1}. + {0} - Executor uri String {1}- Version - .net Version Eg:-2.0.50727.00 + Не удалось найти исполнитель тестов с URI "{0}". Убедитесь, что исполнитель тестов установлен и поддерживает версию среды выполнения .NET {1}. + + + None of the specified source(s) '{0}' is valid. Fix the above errors/warnings and then try again. + + Ни один из указанных источников "{0}" не является допустимым. Исправьте эти ошибки и предупреждения и повторите попытку. + + + , + + , + + + No tests matched the filter because it contains one or more properties that are not valid ({0}). Specify filter expression containing valid properties ({1}). + + Соответствующих фильтру тестов нет, так как фильтр содержит одно недопустимое свойство или несколько ({0}). Укажите выражение фильтра, содержащее допустимые свойства ({1}). + + + Could not find {0}. Make sure that the dotnet is installed on the machine. + Не удалось найти {0}. Убедитесь, что dotnet установлен на компьютере. + + + + Testhost process exited with error: {0}. Please check the diagnostic logs for more information. + Процесс testhost завершился с ошибкой: {0}. Дополнительные сведения см. в журналах диагностики. + + + + DataCollector debugging is enabled. Please attach debugger to datacollector process to continue. + Включена отладка datacollector. Для продолжения подключите отладчик к процессу datacollector. + + + + No test is available in {0}. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again. + В {0} нет доступных тестов. Убедитесь, что средства обнаружения и выполнения тестов зарегистрированы, а также проверьте правильность параметров платформы и версии платформы, после чего повторите попытку. + + + + Logging TestHost Diagnostics in file: {0} + Ведение журналов диагностики TestHost в файле: {0} + + + + Failed to launch testhost with error: {0} + Не удалось запустить хост для тестов с ошибкой: {0} + + + + ExecutionThreadApartmentState option not supported for framework: {0}. + Параметр ExecutionThreadApartmentState не поддерживается для платформы: {0}. + + + + You are using an older version of Microsoft.NET.Test.Sdk. Kindly move to a version equal or greater than 15.3.0. + Вы используете более старую версию Microsoft.NET.Test.Sdk. Перейдите на версию 15.3.0 или более позднюю. + + + + Could not find extensions: {0} + Не удалось найти расширения: {0} + + + + Adapter lookup is being changed, please follow https://github.com/Microsoft/vstest-docs/blob/main/RFCs/0022-User-Specified-TestAdapter-Lookup.md#roadmap for more details. + Изменяется поиск адаптеров. Дополнительные сведения: https://github.com/Microsoft/vstest-docs/blob/main/RFCs/0022-User-Specified-TestAdapter-Lookup.md#roadmap. + + + + No test matches the given testcase filter `{0}` in {1} + Нет тестов, соответствующих указанному фильтру тестовых случаев "{0}" в {1} + + + + Discovery of tests cancelled. + Обнаружение тестов отменено. + + + + Cannot attach the debugger to the default test host with process ID: {0}. + Не удается подключить отладчик к узлу тестирования по умолчанию с идентификатором процесса {0}. + + + + {0} Access denied while trying to create "TestResults" folder in mentioned location. You are getting this exception because you are running vstest.console.exe from a folder which requires having write access. To solve the issue: please run vstest.console.exe from a folder where you have write privileges. + {0} Отказано в доступе при попытке создания папки "TestResults" в указанном расположении. Это исключение возникло, так как вы запускаете файл vstest.console.exe из папки, для которой требуется доступ на запись. Чтобы устранить эту проблему, запустите vstest.console.exe из папки, для которой у вас есть разрешения на запись. + + + + Could not find an available proxy to deque. + Не удалось найти доступный прокси-сервер для двусторонней очереди. + + + + Proxy with id {0} is not managed by the current session manager. + Прокси-сервер с идентификатором {0} не управляется текущим диспетчером сеансов. + + + + Proxy with id {0} is already available and cannot be re-enqueued. + Прокси-сервер с идентификатором {0} уже доступен и не может быть повторно поставлен в очередь. + + + + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.tr.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.tr.xlf index f33b30d4f2..0bd92e7c0f 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.tr.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.tr.xlf @@ -1,172 +1,162 @@ - - - - - - Exception occurred while instantiating discoverer : {0} - - Bulucu örneği oluşturulurken özel durum oluştu: {0} - - - Multiple test adapters with the same uri '{0}' were found. Ignoring adapter '{1}'. Please uninstall the conflicting adapter(s) to avoid this warning. - {0} is the unique identifier of test adapter. {1} is the name of the test adapter that shares a unique identifier with a previously loaded adapter. - Aynı '{0}' URI’sine sahip birden fazla test bağdaştırıcısı bulundu. '{1}' bağdaştırıcısı yoksayılıyor. Bu uyarıyı önlemek için lütfen çakışan bağdaştırıcıları kaldırın. - - - Ignoring the specified duplicate source '{0}'. - - Belirtilen '{0}' yinelenen kaynağı yoksayılıyor. - - - An exception occurred while test discoverer '{0}' was loading tests. Exception: {1} - - '{0}' test bulucusu testleri yüklerken bir özel durum oluştu. Özel durum: {1} - - - An exception occurred while invoking executor '{0}': {1} - - '{0}' yürütücüsü çağrılırken bir özel durum oluştu: {1} - - - Could not find file {0}. - - {0} dosyası bulunamadı. - - - Host debugging is enabled. Please attach debugger to testhost process to continue. - Host, testhost are key words, it should not be localized - Konak hata ayıklaması etkin. Devam etmek için lütfen hata ayıklayıcısını testhost işlemine ekleyin. - - - Ignoring the test executor corresponding to test discoverer {0} because the discoverer does not have the DefaultExecutorUri attribute . You might need to re-install the test adapter add-in. - - Bulucu DefaultExecutorUri özniteliğine sahip olmadığından {0} test bulucusuna karşılık gelen test yürütücüsü yoksayılıyor. Test bağdaştırıcısı eklentisini yeniden yüklemeniz gerekebilir. - - - Failed to initialize client proxy: could not connect to test process. - - İstemci ara sunucusu başlatılamadı: Test işlemine bağlanılamadı. - - - This operation is not allowed in the context of a non-debug run. - - Bu işlem hata ayıklama dışındaki bir çalıştırmanın bağlamında yapılamaz. - - - Could not find test executor with URI '{0}'. Make sure that the test executor is installed and supports .net runtime version {1}. - {0} - Executor uri String {1}- Version - .net Version Eg:-2.0.50727.00 - URI’si '{0}' olan test yürütücüsü bulunamadı. Test yürütücüsünün yüklendiğinden ve .NET çalışma zamanı {1} sürümünü desteklediğinden emin olun. - - - None of the specified source(s) '{0}' is valid. Fix the above errors/warnings and then try again. - - Belirtilen '{0}' kaynaklarının hiçbiri geçerli değil. Yukarıdaki hataları/uyarıları düzeltin ve yeniden deneyin. - - - , - - , - - - No tests matched the filter because it contains one or more properties that are not valid ({0}). Specify filter expression containing valid properties ({1}). - - Geçerli olmayan bir veya daha fazla özellik içerdiğinden filtre ile eşleşen test yok ({0}). Geçerli değerleri ({1}) içeren bir filtre ifadesi belirtin. - - - Could not find {0}. Make sure that the dotnet is installed on the machine. - {0} bulunamadı. Makinede dotnet’in yüklü olduğundan emin olun. - - - - Testhost process exited with error: {0}. Please check the diagnostic logs for more information. - Testhost işleminden şu hatayla çıkıldı: {0}. Daha fazla bilgi için lütfen tanılama günlüklerine bakın. - - - - DataCollector debugging is enabled. Please attach debugger to datacollector process to continue. - DataCollector hata ayıklaması etkin. Devam etmek için lütfen hata ayıklayıcısını datacollector işlemine ekleyin. - - - - No test is available in {0}. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again. - {0} içinde hiç test yok. Test bulucuları ile yürütücülerinin kayıtlı olduğundan ve platform ile çerçeve sürümü ayarlarının uygun olduğundan emin olun ve yeniden deneyin. - - - - Logging TestHost Diagnostics in file: {0} - TestHost Tanılamaları şu dosyadaki günlüğe kaydediliyor: {0} - - - - Failed to launch testhost with error: {0} - Testhost başlatılamadı. Şu hata alındı: {0} - - - - ExecutionThreadApartmentState option not supported for framework: {0}. - ExecutionThreadApartmentState seçeneği {0} çerçevesi için desteklenmiyor. - - - - You are using an older version of Microsoft.NET.Test.Sdk. Kindly move to a version equal or greater than 15.3.0. - Eski bir Microsoft.NET.Test.Sdk sürümü kullanıyorsunuz. Lütfen 15.3.0 veya daha yeni bir sürüme geçin. - - - - Could not find extensions: {0} - Dosya uzantıları bulunamadı: {0} - - - - Adapter lookup is being changed, please follow https://github.com/Microsoft/vstest-docs/blob/main/RFCs/0022-User-Specified-TestAdapter-Lookup.md#roadmap for more details. - Bağdaştırıcı arama değiştiriliyor. Ayrıntılar için lütfen https://github.com/Microsoft/vstest-docs/blob/main/RFCs/0022-User-Specified-TestAdapter-Lookup.md#roadmap sayfasını takip edin. - - - - No test matches the given testcase filter `{0}` in {1} - {1} içinde sunulan test çalışması filtresi `{0}` ile eşleşen test yok - - - - Discovery of tests cancelled. - Test bulma iptal edildi. - - - - Cannot attach the debugger to the default test host with process ID: {0}. - Hata ayıklayıcı, {0} işlem kimliğine sahip varsayılan test ana bilgisayarına eklenemiyor. - - - - {0} Access denied while trying to create "TestResults" folder in mentioned location. You are getting this exception because you are running vstest.console.exe from a folder which requires having write access. To solve the issue: please run vstest.console.exe from a folder where you have write privileges. - {0} Belirtilen konumda "TestResults" klasörü oluşturulmaya çalışılırken erişim engellendi. Yazma erişimi gerektiren bir klasörden vstest.console.exe çalıştırdığınız için bu özel durumu aldınız. Sorunu çözmek için lütfen yazma ayrıcalıklarına sahip olduğunuz bir klasörden vstest.console.exe dosyasını çalıştırın. - - - - Could not find an available proxy to deque. - İki uçtan erişimli kuyruğa yönelik kullanılabilir ara sunucu bulunamadı. - - - - Proxy with id {0} is not managed by the current session manager. - {0} kimliğine sahip ara sunucu, geçerli oturum yöneticisi tarafından yönetilmiyor. - - - - Proxy with id {0} is already available and cannot be re-enqueued. - {0} kimliğine sahip ara sunucu zaten var ve yeniden kuyruğa alınamaz. - - - - No suitable test runtime provider found for this run. - No suitable test runtime provider found for this run. - - - - Could not find an available proxy to match the original run settings. - Could not find an available proxy to match the original run settings. - - - - - + + + + + + Exception occurred while instantiating discoverer : {0} + + Bulucu örneği oluşturulurken özel durum oluştu: {0} + + + Multiple test adapters with the same uri '{0}' were found. Ignoring adapter '{1}'. Please uninstall the conflicting adapter(s) to avoid this warning. + {0} is the unique identifier of test adapter. {1} is the name of the test adapter that shares a unique identifier with a previously loaded adapter. + Aynı '{0}' URI’sine sahip birden fazla test bağdaştırıcısı bulundu. '{1}' bağdaştırıcısı yoksayılıyor. Bu uyarıyı önlemek için lütfen çakışan bağdaştırıcıları kaldırın. + + + Ignoring the specified duplicate source '{0}'. + + Belirtilen '{0}' yinelenen kaynağı yoksayılıyor. + + + An exception occurred while test discoverer '{0}' was loading tests. Exception: {1} + + '{0}' test bulucusu testleri yüklerken bir özel durum oluştu. Özel durum: {1} + + + An exception occurred while invoking executor '{0}': {1} + + '{0}' yürütücüsü çağrılırken bir özel durum oluştu: {1} + + + Could not find file {0}. + + {0} dosyası bulunamadı. + + + Host debugging is enabled. Please attach debugger to testhost process to continue. + Host, testhost are key words, it should not be localized + Konak hata ayıklaması etkin. Devam etmek için lütfen hata ayıklayıcısını testhost işlemine ekleyin. + + + Ignoring the test executor corresponding to test discoverer {0} because the discoverer does not have the DefaultExecutorUri attribute . You might need to re-install the test adapter add-in. + + Bulucu DefaultExecutorUri özniteliğine sahip olmadığından {0} test bulucusuna karşılık gelen test yürütücüsü yoksayılıyor. Test bağdaştırıcısı eklentisini yeniden yüklemeniz gerekebilir. + + + Failed to initialize client proxy: could not connect to test process. + + İstemci ara sunucusu başlatılamadı: Test işlemine bağlanılamadı. + + + This operation is not allowed in the context of a non-debug run. + + Bu işlem hata ayıklama dışındaki bir çalıştırmanın bağlamında yapılamaz. + + + Could not find test executor with URI '{0}'. Make sure that the test executor is installed and supports .net runtime version {1}. + {0} - Executor uri String {1}- Version - .net Version Eg:-2.0.50727.00 + URI’si '{0}' olan test yürütücüsü bulunamadı. Test yürütücüsünün yüklendiğinden ve .NET çalışma zamanı {1} sürümünü desteklediğinden emin olun. + + + None of the specified source(s) '{0}' is valid. Fix the above errors/warnings and then try again. + + Belirtilen '{0}' kaynaklarının hiçbiri geçerli değil. Yukarıdaki hataları/uyarıları düzeltin ve yeniden deneyin. + + + , + + , + + + No tests matched the filter because it contains one or more properties that are not valid ({0}). Specify filter expression containing valid properties ({1}). + + Geçerli olmayan bir veya daha fazla özellik içerdiğinden filtre ile eşleşen test yok ({0}). Geçerli değerleri ({1}) içeren bir filtre ifadesi belirtin. + + + Could not find {0}. Make sure that the dotnet is installed on the machine. + {0} bulunamadı. Makinede dotnet’in yüklü olduğundan emin olun. + + + + Testhost process exited with error: {0}. Please check the diagnostic logs for more information. + Testhost işleminden şu hatayla çıkıldı: {0}. Daha fazla bilgi için lütfen tanılama günlüklerine bakın. + + + + DataCollector debugging is enabled. Please attach debugger to datacollector process to continue. + DataCollector hata ayıklaması etkin. Devam etmek için lütfen hata ayıklayıcısını datacollector işlemine ekleyin. + + + + No test is available in {0}. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again. + {0} içinde hiç test yok. Test bulucuları ile yürütücülerinin kayıtlı olduğundan ve platform ile çerçeve sürümü ayarlarının uygun olduğundan emin olun ve yeniden deneyin. + + + + Logging TestHost Diagnostics in file: {0} + TestHost Tanılamaları şu dosyadaki günlüğe kaydediliyor: {0} + + + + Failed to launch testhost with error: {0} + Testhost başlatılamadı. Şu hata alındı: {0} + + + + ExecutionThreadApartmentState option not supported for framework: {0}. + ExecutionThreadApartmentState seçeneği {0} çerçevesi için desteklenmiyor. + + + + You are using an older version of Microsoft.NET.Test.Sdk. Kindly move to a version equal or greater than 15.3.0. + Eski bir Microsoft.NET.Test.Sdk sürümü kullanıyorsunuz. Lütfen 15.3.0 veya daha yeni bir sürüme geçin. + + + + Could not find extensions: {0} + Dosya uzantıları bulunamadı: {0} + + + + Adapter lookup is being changed, please follow https://github.com/Microsoft/vstest-docs/blob/main/RFCs/0022-User-Specified-TestAdapter-Lookup.md#roadmap for more details. + Bağdaştırıcı arama değiştiriliyor. Ayrıntılar için lütfen https://github.com/Microsoft/vstest-docs/blob/main/RFCs/0022-User-Specified-TestAdapter-Lookup.md#roadmap sayfasını takip edin. + + + + No test matches the given testcase filter `{0}` in {1} + {1} içinde sunulan test çalışması filtresi `{0}` ile eşleşen test yok + + + + Discovery of tests cancelled. + Test bulma iptal edildi. + + + + Cannot attach the debugger to the default test host with process ID: {0}. + Hata ayıklayıcı, {0} işlem kimliğine sahip varsayılan test ana bilgisayarına eklenemiyor. + + + + {0} Access denied while trying to create "TestResults" folder in mentioned location. You are getting this exception because you are running vstest.console.exe from a folder which requires having write access. To solve the issue: please run vstest.console.exe from a folder where you have write privileges. + {0} Belirtilen konumda "TestResults" klasörü oluşturulmaya çalışılırken erişim engellendi. Yazma erişimi gerektiren bir klasörden vstest.console.exe çalıştırdığınız için bu özel durumu aldınız. Sorunu çözmek için lütfen yazma ayrıcalıklarına sahip olduğunuz bir klasörden vstest.console.exe dosyasını çalıştırın. + + + + Could not find an available proxy to deque. + İki uçtan erişimli kuyruğa yönelik kullanılabilir ara sunucu bulunamadı. + + + + Proxy with id {0} is not managed by the current session manager. + {0} kimliğine sahip ara sunucu, geçerli oturum yöneticisi tarafından yönetilmiyor. + + + + Proxy with id {0} is already available and cannot be re-enqueued. + {0} kimliğine sahip ara sunucu zaten var ve yeniden kuyruğa alınamaz. + + + + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.zh-Hans.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.zh-Hans.xlf index cc7a9355bf..5dc7ea0ba2 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.zh-Hans.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.zh-Hans.xlf @@ -1,172 +1,162 @@ - - - - - - Exception occurred while instantiating discoverer : {0} - - 实例化发现器时发生异常: {0} - - - Multiple test adapters with the same uri '{0}' were found. Ignoring adapter '{1}'. Please uninstall the conflicting adapter(s) to avoid this warning. - {0} is the unique identifier of test adapter. {1} is the name of the test adapter that shares a unique identifier with a previously loaded adapter. - 找到了多个具有同一 URI“{0}”的测试适配器。忽略适配器“{1}”。请卸载冲突的适配器以避免此警告。 - - - Ignoring the specified duplicate source '{0}'. - - 忽略指定的重复源“{0}”。 - - - An exception occurred while test discoverer '{0}' was loading tests. Exception: {1} - - 测试发现器“{0}”加载测试时发生异常。异常: {1} - - - An exception occurred while invoking executor '{0}': {1} - - 调用的执行器“{0}”时发生异常: {1} - - - Could not find file {0}. - - 找不到文件 {0}。 - - - Host debugging is enabled. Please attach debugger to testhost process to continue. - Host, testhost are key words, it should not be localized - 启用主机调试。请将调试器附加到 testhost 进程以继续。 - - - Ignoring the test executor corresponding to test discoverer {0} because the discoverer does not have the DefaultExecutorUri attribute . You might need to re-install the test adapter add-in. - - 忽略与测试发现器 {0} 对应的测试执行器,因为该发现器不具有 DefaultExecutorUri 特性。可能需要重新安装测试适配器外接程序。 - - - Failed to initialize client proxy: could not connect to test process. - - 未能初始化客户端代理: 无法连接到测试过程。 - - - This operation is not allowed in the context of a non-debug run. - - 非调试运行的上下文中不允许此操作。 - - - Could not find test executor with URI '{0}'. Make sure that the test executor is installed and supports .net runtime version {1}. - {0} - Executor uri String {1}- Version - .net Version Eg:-2.0.50727.00 - 找不到 URI 为“{0}”的测试执行器。请确保安装了测试执行器且该执行器支持.net 运行时版本 {1}。 - - - None of the specified source(s) '{0}' is valid. Fix the above errors/warnings and then try again. - - 无有效的指定源“{0}”。请修复以上错误/警告,然后重试。 - - - , - - - - - No tests matched the filter because it contains one or more properties that are not valid ({0}). Specify filter expression containing valid properties ({1}). - - 没有与筛选器匹配的测试,因为该筛选器包含一个或多个无效属性 ({0})。请指定包含有效属性 ({1}) 的筛选器表达式。 - - - Could not find {0}. Make sure that the dotnet is installed on the machine. - 找不到 {0}。请确保计算机上安装了 dotnet。 - - - - Testhost process exited with error: {0}. Please check the diagnostic logs for more information. - Testhost 进程已退出,但出现错误: {0}。请查看诊断日志了解详细信息。 - - - - DataCollector debugging is enabled. Please attach debugger to datacollector process to continue. - 启用 DataCollector 调试。请将调试器附加到 datacollector 进程以继续。 - - - - No test is available in {0}. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again. - {0} 中没有可用测试。请确保已注册测试发现器和执行器且平台和框架版本设置合理,然后重试。 - - - - Logging TestHost Diagnostics in file: {0} - 在文件 {0} 中记录 TestHost 诊断 - - - - Failed to launch testhost with error: {0} - 未能启动测试主机,错误为 {0} - - - - ExecutionThreadApartmentState option not supported for framework: {0}. - 框架 {0} 不支持 ExecutionThreadApartmentState 选项。 - - - - You are using an older version of Microsoft.NET.Test.Sdk. Kindly move to a version equal or greater than 15.3.0. - 你使用的是旧版 Microsoft.NET.Test.Sdk。请迁移到 15.3.0 及更高版本。 - - - - Could not find extensions: {0} - 找不到扩展名: {0} - - - - Adapter lookup is being changed, please follow https://github.com/Microsoft/vstest-docs/blob/main/RFCs/0022-User-Specified-TestAdapter-Lookup.md#roadmap for more details. - 适配器查找正在发生更改,请转到 https://github.com/Microsoft/vstest-docs/blob/main/RFCs/0022-User-Specified-TestAdapter-Lookup.md#roadmap 以了解详细信息。 - - - - No test matches the given testcase filter `{0}` in {1} - 没有测试匹配 {1} 中的给定用例测试筛选器“{0}” - - - - Discovery of tests cancelled. - 已取消测试发现。 - - - - Cannot attach the debugger to the default test host with process ID: {0}. - 无法将调试程序附加到进程 ID 为“{0}”的默认测试主机。 - - - - {0} Access denied while trying to create "TestResults" folder in mentioned location. You are getting this exception because you are running vstest.console.exe from a folder which requires having write access. To solve the issue: please run vstest.console.exe from a folder where you have write privileges. - {0} 尝试在所述位置创建 "TestResults" 文件夹时,访问被拒。你收到此异常是因为你正在从需要具有写入权限的文件夹运行 vstest.console.exe。若要解决此问题,请从你具有写入权限的文件夹运行 vstest.console.exe。 - - - - Could not find an available proxy to deque. - 找不到用于取消排队的可用代理。 - - - - Proxy with id {0} is not managed by the current session manager. - ID 为 {0} 的代理不受当前会话管理器管理。 - - - - Proxy with id {0} is already available and cannot be re-enqueued. - ID 为 {0} 的代理已可用,无法重新排队。 - - - - No suitable test runtime provider found for this run. - No suitable test runtime provider found for this run. - - - - Could not find an available proxy to match the original run settings. - Could not find an available proxy to match the original run settings. - - - - - + + + + + + Exception occurred while instantiating discoverer : {0} + + 实例化发现器时发生异常: {0} + + + Multiple test adapters with the same uri '{0}' were found. Ignoring adapter '{1}'. Please uninstall the conflicting adapter(s) to avoid this warning. + {0} is the unique identifier of test adapter. {1} is the name of the test adapter that shares a unique identifier with a previously loaded adapter. + 找到了多个具有同一 URI“{0}”的测试适配器。忽略适配器“{1}”。请卸载冲突的适配器以避免此警告。 + + + Ignoring the specified duplicate source '{0}'. + + 忽略指定的重复源“{0}”。 + + + An exception occurred while test discoverer '{0}' was loading tests. Exception: {1} + + 测试发现器“{0}”加载测试时发生异常。异常: {1} + + + An exception occurred while invoking executor '{0}': {1} + + 调用的执行器“{0}”时发生异常: {1} + + + Could not find file {0}. + + 找不到文件 {0}。 + + + Host debugging is enabled. Please attach debugger to testhost process to continue. + Host, testhost are key words, it should not be localized + 启用主机调试。请将调试器附加到 testhost 进程以继续。 + + + Ignoring the test executor corresponding to test discoverer {0} because the discoverer does not have the DefaultExecutorUri attribute . You might need to re-install the test adapter add-in. + + 忽略与测试发现器 {0} 对应的测试执行器,因为该发现器不具有 DefaultExecutorUri 特性。可能需要重新安装测试适配器外接程序。 + + + Failed to initialize client proxy: could not connect to test process. + + 未能初始化客户端代理: 无法连接到测试过程。 + + + This operation is not allowed in the context of a non-debug run. + + 非调试运行的上下文中不允许此操作。 + + + Could not find test executor with URI '{0}'. Make sure that the test executor is installed and supports .net runtime version {1}. + {0} - Executor uri String {1}- Version - .net Version Eg:-2.0.50727.00 + 找不到 URI 为“{0}”的测试执行器。请确保安装了测试执行器且该执行器支持.net 运行时版本 {1}。 + + + None of the specified source(s) '{0}' is valid. Fix the above errors/warnings and then try again. + + 无有效的指定源“{0}”。请修复以上错误/警告,然后重试。 + + + , + + + + + No tests matched the filter because it contains one or more properties that are not valid ({0}). Specify filter expression containing valid properties ({1}). + + 没有与筛选器匹配的测试,因为该筛选器包含一个或多个无效属性 ({0})。请指定包含有效属性 ({1}) 的筛选器表达式。 + + + Could not find {0}. Make sure that the dotnet is installed on the machine. + 找不到 {0}。请确保计算机上安装了 dotnet。 + + + + Testhost process exited with error: {0}. Please check the diagnostic logs for more information. + Testhost 进程已退出,但出现错误: {0}。请查看诊断日志了解详细信息。 + + + + DataCollector debugging is enabled. Please attach debugger to datacollector process to continue. + 启用 DataCollector 调试。请将调试器附加到 datacollector 进程以继续。 + + + + No test is available in {0}. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again. + {0} 中没有可用测试。请确保已注册测试发现器和执行器且平台和框架版本设置合理,然后重试。 + + + + Logging TestHost Diagnostics in file: {0} + 在文件 {0} 中记录 TestHost 诊断 + + + + Failed to launch testhost with error: {0} + 未能启动测试主机,错误为 {0} + + + + ExecutionThreadApartmentState option not supported for framework: {0}. + 框架 {0} 不支持 ExecutionThreadApartmentState 选项。 + + + + You are using an older version of Microsoft.NET.Test.Sdk. Kindly move to a version equal or greater than 15.3.0. + 你使用的是旧版 Microsoft.NET.Test.Sdk。请迁移到 15.3.0 及更高版本。 + + + + Could not find extensions: {0} + 找不到扩展名: {0} + + + + Adapter lookup is being changed, please follow https://github.com/Microsoft/vstest-docs/blob/main/RFCs/0022-User-Specified-TestAdapter-Lookup.md#roadmap for more details. + 适配器查找正在发生更改,请转到 https://github.com/Microsoft/vstest-docs/blob/main/RFCs/0022-User-Specified-TestAdapter-Lookup.md#roadmap 以了解详细信息。 + + + + No test matches the given testcase filter `{0}` in {1} + 没有测试匹配 {1} 中的给定用例测试筛选器“{0}” + + + + Discovery of tests cancelled. + 已取消测试发现。 + + + + Cannot attach the debugger to the default test host with process ID: {0}. + 无法将调试程序附加到进程 ID 为“{0}”的默认测试主机。 + + + + {0} Access denied while trying to create "TestResults" folder in mentioned location. You are getting this exception because you are running vstest.console.exe from a folder which requires having write access. To solve the issue: please run vstest.console.exe from a folder where you have write privileges. + {0} 尝试在所述位置创建 "TestResults" 文件夹时,访问被拒。你收到此异常是因为你正在从需要具有写入权限的文件夹运行 vstest.console.exe。若要解决此问题,请从你具有写入权限的文件夹运行 vstest.console.exe。 + + + + Could not find an available proxy to deque. + 找不到用于取消排队的可用代理。 + + + + Proxy with id {0} is not managed by the current session manager. + ID 为 {0} 的代理不受当前会话管理器管理。 + + + + Proxy with id {0} is already available and cannot be re-enqueued. + ID 为 {0} 的代理已可用,无法重新排队。 + + + + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.zh-Hant.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.zh-Hant.xlf index 3d274ed428..71b24f022a 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.zh-Hant.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.zh-Hant.xlf @@ -1,172 +1,162 @@ - - - - - - Exception occurred while instantiating discoverer : {0} - - 將探索程式具現化時發生例外狀況: {0} - - - Multiple test adapters with the same uri '{0}' were found. Ignoring adapter '{1}'. Please uninstall the conflicting adapter(s) to avoid this warning. - {0} is the unique identifier of test adapter. {1} is the name of the test adapter that shares a unique identifier with a previously loaded adapter. - 找到多個具有相同 URI '{0}' 的測試配接器。忽略配接器 '{1}'。請將衝突的配接器解除安裝,以避免這項警告。 - - - Ignoring the specified duplicate source '{0}'. - - 忽略指定的重複來源 '{0}'。 - - - An exception occurred while test discoverer '{0}' was loading tests. Exception: {1} - - 測試探索程式 '{0}' 載入測試時發生例外狀況。例外狀況: {1} - - - An exception occurred while invoking executor '{0}': {1} - - 叫用執行程式 '{0}' 時發生例外狀況: {1} - - - Could not find file {0}. - - 找不到檔案 {0}。 - - - Host debugging is enabled. Please attach debugger to testhost process to continue. - Host, testhost are key words, it should not be localized - 已啟用主機偵錯。請將偵錯工具附加到 testhost 處理序以繼續進行。 - - - Ignoring the test executor corresponding to test discoverer {0} because the discoverer does not have the DefaultExecutorUri attribute . You might need to re-install the test adapter add-in. - - 忽略對應到測試探索程式 {0} 的測試執行程式,因為探索程式沒有 DefaultExecutorUri 屬性。您可能必須重新安裝測試配接器增益集。 - - - Failed to initialize client proxy: could not connect to test process. - - 無法將用戶端 Proxy 初始化: 無法連接到測試處理序 - - - This operation is not allowed in the context of a non-debug run. - - 這項作業不能用於非偵錯回合的內容中。 - - - Could not find test executor with URI '{0}'. Make sure that the test executor is installed and supports .net runtime version {1}. - {0} - Executor uri String {1}- Version - .net Version Eg:-2.0.50727.00 - 找不到具有 URI '{0}' 的測試執行程式。請確定已安裝測試執行程式,且其支援 .NET 執行階段版本 {1}。 - - - None of the specified source(s) '{0}' is valid. Fix the above errors/warnings and then try again. - - 指定的來源 '{0}' 皆無效。請修正上述錯誤/警告,並再試一次。 - - - , - - - - - No tests matched the filter because it contains one or more properties that are not valid ({0}). Specify filter expression containing valid properties ({1}). - - 因為篩選包含一或多個無效的屬性 ({0}),所以沒有符合篩選的測試。請指定包含有效屬性 ({1}) 的篩選運算式。 - - - Could not find {0}. Make sure that the dotnet is installed on the machine. - 找不到 {0}。請確定電腦上安裝了 .NET。 - - - - Testhost process exited with error: {0}. Please check the diagnostic logs for more information. - Testhost 處理序已結束。錯誤: {0}。如需詳細資訊,請查看診斷記錄。 - - - - DataCollector debugging is enabled. Please attach debugger to datacollector process to continue. - DataCollector 已啟用。若要繼續,請將偵錯工具連結到 datacollector 處理序。 - - - - No test is available in {0}. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again. - {0} 中未提供任何測試。請確定已登錄了測試探索程式與執行程式,且平台與 Framework 版本設定皆正確,然後再試一次。 - - - - Logging TestHost Diagnostics in file: {0} - 在檔案 {0} 中記錄 TestHost 診斷 - - - - Failed to launch testhost with error: {0} - 無法啟動測試主機。錯誤: {0} - - - - ExecutionThreadApartmentState option not supported for framework: {0}. - 架構 {0} 不支援 ExecutionThreadApartmentState 選項。 - - - - You are using an older version of Microsoft.NET.Test.Sdk. Kindly move to a version equal or greater than 15.3.0. - 您正使用較舊版的 Microsoft.NET.Test.Sdk。請移到等於或大於 15.3.0 的版本。 - - - - Could not find extensions: {0} - 找不到延伸模組: {0} - - - - Adapter lookup is being changed, please follow https://github.com/Microsoft/vstest-docs/blob/main/RFCs/0022-User-Specified-TestAdapter-Lookup.md#roadmap for more details. - 目前正在變更配接器查閱,請遵循 https://github.com/Microsoft/vstest-docs/blob/main/RFCs/0022-User-Specified-TestAdapter-Lookup.md#roadmap,以取得詳細資料。 - - - - No test matches the given testcase filter `{0}` in {1} - 沒有任何測試符合 {1} 中的指定 testcase 篩選 `{0}` - - - - Discovery of tests cancelled. - 已取消測試的探索。 - - - - Cannot attach the debugger to the default test host with process ID: {0}. - 無法將偵錯工具連結到處理序識別碼為 {0} 的預設測試主機。 - - - - {0} Access denied while trying to create "TestResults" folder in mentioned location. You are getting this exception because you are running vstest.console.exe from a folder which requires having write access. To solve the issue: please run vstest.console.exe from a folder where you have write privileges. - {0} 當嘗試在提及的位置上建立 "TestResults" 資料夾時存取被拒。因為您正從需要寫入存取權的資料夾執行 vstest.console.exe,所以收到此例外狀況。若要解決此問題: 請從您有權寫入的資料夾執行 vstest.console.exe。 - - - - Could not find an available proxy to deque. - 找不到任何要排除於佇列外的 Proxy。 - - - - Proxy with id {0} is not managed by the current session manager. - 識別碼為 {0} 的 Proxy 並非由目前的工作階段管理員所管理。 - - - - Proxy with id {0} is already available and cannot be re-enqueued. - 識別碼為 {0} 的 Proxy 已可供使用,但無法重新加入佇列。 - - - - No suitable test runtime provider found for this run. - No suitable test runtime provider found for this run. - - - - Could not find an available proxy to match the original run settings. - Could not find an available proxy to match the original run settings. - - - - - + + + + + + Exception occurred while instantiating discoverer : {0} + + 將探索程式具現化時發生例外狀況: {0} + + + Multiple test adapters with the same uri '{0}' were found. Ignoring adapter '{1}'. Please uninstall the conflicting adapter(s) to avoid this warning. + {0} is the unique identifier of test adapter. {1} is the name of the test adapter that shares a unique identifier with a previously loaded adapter. + 找到多個具有相同 URI '{0}' 的測試配接器。忽略配接器 '{1}'。請將衝突的配接器解除安裝,以避免這項警告。 + + + Ignoring the specified duplicate source '{0}'. + + 忽略指定的重複來源 '{0}'。 + + + An exception occurred while test discoverer '{0}' was loading tests. Exception: {1} + + 測試探索程式 '{0}' 載入測試時發生例外狀況。例外狀況: {1} + + + An exception occurred while invoking executor '{0}': {1} + + 叫用執行程式 '{0}' 時發生例外狀況: {1} + + + Could not find file {0}. + + 找不到檔案 {0}。 + + + Host debugging is enabled. Please attach debugger to testhost process to continue. + Host, testhost are key words, it should not be localized + 已啟用主機偵錯。請將偵錯工具附加到 testhost 處理序以繼續進行。 + + + Ignoring the test executor corresponding to test discoverer {0} because the discoverer does not have the DefaultExecutorUri attribute . You might need to re-install the test adapter add-in. + + 忽略對應到測試探索程式 {0} 的測試執行程式,因為探索程式沒有 DefaultExecutorUri 屬性。您可能必須重新安裝測試配接器增益集。 + + + Failed to initialize client proxy: could not connect to test process. + + 無法將用戶端 Proxy 初始化: 無法連接到測試處理序 + + + This operation is not allowed in the context of a non-debug run. + + 這項作業不能用於非偵錯回合的內容中。 + + + Could not find test executor with URI '{0}'. Make sure that the test executor is installed and supports .net runtime version {1}. + {0} - Executor uri String {1}- Version - .net Version Eg:-2.0.50727.00 + 找不到具有 URI '{0}' 的測試執行程式。請確定已安裝測試執行程式,且其支援 .NET 執行階段版本 {1}。 + + + None of the specified source(s) '{0}' is valid. Fix the above errors/warnings and then try again. + + 指定的來源 '{0}' 皆無效。請修正上述錯誤/警告,並再試一次。 + + + , + + + + + No tests matched the filter because it contains one or more properties that are not valid ({0}). Specify filter expression containing valid properties ({1}). + + 因為篩選包含一或多個無效的屬性 ({0}),所以沒有符合篩選的測試。請指定包含有效屬性 ({1}) 的篩選運算式。 + + + Could not find {0}. Make sure that the dotnet is installed on the machine. + 找不到 {0}。請確定電腦上安裝了 .NET。 + + + + Testhost process exited with error: {0}. Please check the diagnostic logs for more information. + Testhost 處理序已結束。錯誤: {0}。如需詳細資訊,請查看診斷記錄。 + + + + DataCollector debugging is enabled. Please attach debugger to datacollector process to continue. + DataCollector 已啟用。若要繼續,請將偵錯工具連結到 datacollector 處理序。 + + + + No test is available in {0}. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again. + {0} 中未提供任何測試。請確定已登錄了測試探索程式與執行程式,且平台與 Framework 版本設定皆正確,然後再試一次。 + + + + Logging TestHost Diagnostics in file: {0} + 在檔案 {0} 中記錄 TestHost 診斷 + + + + Failed to launch testhost with error: {0} + 無法啟動測試主機。錯誤: {0} + + + + ExecutionThreadApartmentState option not supported for framework: {0}. + 架構 {0} 不支援 ExecutionThreadApartmentState 選項。 + + + + You are using an older version of Microsoft.NET.Test.Sdk. Kindly move to a version equal or greater than 15.3.0. + 您正使用較舊版的 Microsoft.NET.Test.Sdk。請移到等於或大於 15.3.0 的版本。 + + + + Could not find extensions: {0} + 找不到延伸模組: {0} + + + + Adapter lookup is being changed, please follow https://github.com/Microsoft/vstest-docs/blob/main/RFCs/0022-User-Specified-TestAdapter-Lookup.md#roadmap for more details. + 目前正在變更配接器查閱,請遵循 https://github.com/Microsoft/vstest-docs/blob/main/RFCs/0022-User-Specified-TestAdapter-Lookup.md#roadmap,以取得詳細資料。 + + + + No test matches the given testcase filter `{0}` in {1} + 沒有任何測試符合 {1} 中的指定 testcase 篩選 `{0}` + + + + Discovery of tests cancelled. + 已取消測試的探索。 + + + + Cannot attach the debugger to the default test host with process ID: {0}. + 無法將偵錯工具連結到處理序識別碼為 {0} 的預設測試主機。 + + + + {0} Access denied while trying to create "TestResults" folder in mentioned location. You are getting this exception because you are running vstest.console.exe from a folder which requires having write access. To solve the issue: please run vstest.console.exe from a folder where you have write privileges. + {0} 當嘗試在提及的位置上建立 "TestResults" 資料夾時存取被拒。因為您正從需要寫入存取權的資料夾執行 vstest.console.exe,所以收到此例外狀況。若要解決此問題: 請從您有權寫入的資料夾執行 vstest.console.exe。 + + + + Could not find an available proxy to deque. + 找不到任何要排除於佇列外的 Proxy。 + + + + Proxy with id {0} is not managed by the current session manager. + 識別碼為 {0} 的 Proxy 並非由目前的工作階段管理員所管理。 + + + + Proxy with id {0} is already available and cannot be re-enqueued. + 識別碼為 {0} 的 Proxy 已可供使用,但無法重新加入佇列。 + + + + + \ No newline at end of file From b3953b0bf0bae598a871c5e7bb73aba63132b5e5 Mon Sep 17 00:00:00 2001 From: Codrin Poienaru Date: Wed, 8 Sep 2021 13:56:53 +0200 Subject: [PATCH 16/26] Adjusted the number of testhosts to be spawned --- .../TestEngine.cs | 5 ++++- .../TestSession/ProxyTestSessionManager.cs | 16 ++++++++++------ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/TestEngine.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/TestEngine.cs index 7a5840f901..a1fc90b97c 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/TestEngine.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/TestEngine.cs @@ -302,7 +302,10 @@ public IProxyTestSessionManager GetTestSessionManager( }; }; - return new ProxyTestSessionManager(testSessionCriteria, parallelLevel, proxyCreator); + var testhostManager = this.testHostProviderManager.GetTestHostManagerByRunConfiguration(testSessionCriteria.RunSettings); + var testhostCount = testhostManager.Shared ? 1 : testSessionCriteria.Sources.Count; + + return new ProxyTestSessionManager(testSessionCriteria, testhostCount, proxyCreator); } /// diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/TestSession/ProxyTestSessionManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/TestSession/ProxyTestSessionManager.cs index f648f437fc..47ff59b3fb 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/TestSession/ProxyTestSessionManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/TestSession/ProxyTestSessionManager.cs @@ -22,7 +22,7 @@ public class ProxyTestSessionManager : IProxyTestSessionManager { private readonly object lockObject = new object(); private StartTestSessionCriteria testSessionCriteria; - private int parallelLevel; + private int testhostCount; private bool skipDefaultAdapters; private TestSessionInfo testSessionInfo; private Func proxyCreator; @@ -34,15 +34,15 @@ public class ProxyTestSessionManager : IProxyTestSessionManager /// /// /// The test session criteria. - /// The parallel level. + /// The testhost count. /// The proxy creator. public ProxyTestSessionManager( StartTestSessionCriteria criteria, - int parallelLevel, + int testhostCount, Func proxyCreator) { this.testSessionCriteria = criteria; - this.parallelLevel = parallelLevel; + this.testhostCount = testhostCount; this.proxyCreator = proxyCreator; this.availableProxyQueue = new Queue(); @@ -65,10 +65,10 @@ public void StartSession(ITestSessionEventsHandler eventsHandler) this.testSessionInfo = new TestSessionInfo(); - var taskList = new Task[this.parallelLevel]; + var taskList = new Task[this.testhostCount]; // Create all the proxies in parallel, one task per proxy. - for (int i = 0; i < this.parallelLevel; ++i) + for (int i = 0; i < this.testhostCount; ++i) { taskList[i] = Task.Factory.StartNew(() => { @@ -76,6 +76,10 @@ public void StartSession(ITestSessionEventsHandler eventsHandler) { // Create and cache the proxy. var operationManagerProxy = this.proxyCreator(); + if (operationManagerProxy == null) + { + return; + } // Initialize the proxy. operationManagerProxy.Initialize(this.skipDefaultAdapters); From 58fd909a57af33c53a8c262fa8c153a2ded93a87 Mon Sep 17 00:00:00 2001 From: Codrin Poienaru Date: Thu, 16 Sep 2021 14:11:13 +0200 Subject: [PATCH 17/26] Fixed test container to test host association --- .../TestPlatform.cs | 1 - .../IProxyTestSessionManager.cs | 7 - .../Client/ProxyDiscoveryManager.cs | 101 ++++++-- .../Client/ProxyExecutionManager.cs | 139 ++++++++--- .../Client/ProxyOperationManager.cs | 5 +- .../TestEngine.cs | 96 +++----- .../TestSession/ProxyTestSessionManager.cs | 223 ++++++++++-------- .../TestSession/TestSessionPool.cs | 6 +- 8 files changed, 362 insertions(+), 216 deletions(-) diff --git a/src/Microsoft.TestPlatform.Client/TestPlatform.cs b/src/Microsoft.TestPlatform.Client/TestPlatform.cs index 4ec9e5644e..3f34331750 100644 --- a/src/Microsoft.TestPlatform.Client/TestPlatform.cs +++ b/src/Microsoft.TestPlatform.Client/TestPlatform.cs @@ -186,7 +186,6 @@ public void StartTestSession( return; } - testSessionManager.Initialize(false); testSessionManager.StartSession(eventsHandler); } diff --git a/src/Microsoft.TestPlatform.Common/Interfaces/Engine/ClientProtocol/IProxyTestSessionManager.cs b/src/Microsoft.TestPlatform.Common/Interfaces/Engine/ClientProtocol/IProxyTestSessionManager.cs index 154e5c6781..4a7919d8f3 100644 --- a/src/Microsoft.TestPlatform.Common/Interfaces/Engine/ClientProtocol/IProxyTestSessionManager.cs +++ b/src/Microsoft.TestPlatform.Common/Interfaces/Engine/ClientProtocol/IProxyTestSessionManager.cs @@ -11,13 +11,6 @@ namespace Microsoft.VisualStudio.TestPlatform.ObjectModel.Engine /// public interface IProxyTestSessionManager { - /// - /// Initialize the proxy. - /// - /// - /// Skip default adapters flag. - void Initialize(bool skipDefaultAdapters); - /// /// Starts the test session based on the test session criteria. /// diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyDiscoveryManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyDiscoveryManager.cs index 807c2bb2f0..fcb6fd39fe 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyDiscoveryManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyDiscoveryManager.cs @@ -6,6 +6,7 @@ namespace Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client using System; using System.Collections.Generic; using System.Linq; + using System.Threading; using Microsoft.VisualStudio.TestPlatform.Common; using Microsoft.VisualStudio.TestPlatform.Common.ExtensionFramework; @@ -25,15 +26,22 @@ namespace Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client /// public class ProxyDiscoveryManager : IProxyDiscoveryManager, IBaseProxy, ITestDiscoveryEventsHandler2 { - private readonly ITestRuntimeProvider testHostManager; - private readonly IFileHelper fileHelper; + private readonly TestSessionInfo testSessionInfo = null; + private readonly string runSettings; + private readonly IRequestData backupRequestData; + private readonly ITestRequestSender backupTestRequestSender; + private readonly ITestRuntimeProvider backupTestHostManager; - private IDataSerializer dataSerializer; + private ITestRuntimeProvider testHostManager; private IRequestData requestData; - private ITestDiscoveryEventsHandler2 baseTestDiscoveryEventsHandler; - private TestSessionInfo testSessionInfo = null; - private ProxyOperationManager proxyOperationManager; + + private readonly IFileHelper fileHelper; + private readonly IDataSerializer dataSerializer; private bool isCommunicationEstablished; + + private ManualResetEvent proxyOperationManagerInitializedEvent = new ManualResetEvent(false); + private ProxyOperationManager proxyOperationManager = null; + private ITestDiscoveryEventsHandler2 baseTestDiscoveryEventsHandler; private bool skipDefaultAdapters; #region Constructors @@ -44,19 +52,37 @@ public class ProxyDiscoveryManager : IProxyDiscoveryManager, IBaseProxy, ITestDi /// /// The test session info. /// The run settings. - public ProxyDiscoveryManager(TestSessionInfo testSessionInfo, string runSettings) + /// + /// The backup request data to be used to create a proxy operation manager should acquire + /// an existent proxy fail. + /// + /// + /// The backup test request sender to be used to create a proxy operation manager should + /// acquire an existent proxy fail. + /// + /// + /// The backup testhost manager to be used to create a proxy operation manager should + /// acquire an existent proxy fail. + /// + public ProxyDiscoveryManager( + TestSessionInfo testSessionInfo, + string runSettings, + IRequestData backupRequestData, + ITestRequestSender backupTestRequestSender, + ITestRuntimeProvider backupTestHostManager) { // Filling in test session info and proxy information. this.testSessionInfo = testSessionInfo; - this.proxyOperationManager = TestSessionPool.Instance.TakeProxy( - this.testSessionInfo, - runSettings); + this.runSettings = runSettings; + this.backupRequestData = backupRequestData; + this.backupTestRequestSender = backupTestRequestSender; + this.backupTestHostManager = backupTestHostManager; - this.testHostManager = this.proxyOperationManager.TestHostManager; + this.requestData = null; + this.testHostManager = null; this.dataSerializer = JsonDataSerializer.Instance; - this.isCommunicationEstablished = false; - this.requestData = this.proxyOperationManager.RequestData; this.fileHelper = new FileHelper(); + this.isCommunicationEstablished = false; } /// @@ -102,14 +128,16 @@ internal ProxyDiscoveryManager( IDataSerializer dataSerializer, IFileHelper fileHelper) { - this.dataSerializer = dataSerializer; - this.testHostManager = testHostManager; - this.isCommunicationEstablished = false; this.requestData = requestData; + this.testHostManager = testHostManager; + + this.dataSerializer = dataSerializer; this.fileHelper = fileHelper; + this.isCommunicationEstablished = false; // Create a new proxy operation manager. this.proxyOperationManager = new ProxyOperationManager(requestData, requestSender, testHostManager, this); + this.proxyOperationManagerInitializedEvent.Set(); } #endregion @@ -125,6 +153,41 @@ public void Initialize(bool skipDefaultAdapters) /// public void DiscoverTests(DiscoveryCriteria discoveryCriteria, ITestDiscoveryEventsHandler2 eventHandler) { + if (this.proxyOperationManager == null) + { + try + { + // In case we have an active test session, we always prefer the already + // created proxies instead of the ones that need to be created on the spot. + this.proxyOperationManager = TestSessionPool.Instance.TakeProxy( + this.testSessionInfo, + discoveryCriteria.Sources.First(), + runSettings); + } + catch (InvalidOperationException ex) + { + // If the proxy creation process based on test session info failed, then + // we'll proceed with the normal creation process as if no test session + // info was passed in in the first place. + // + // WARNING: This should not normally happen and it raises questions + // regarding the test session pool operation and consistency. + EqtTrace.Warning( + "ProxyDiscoveryManager creation with test session failed: {0}", + ex.ToString()); + + this.proxyOperationManager = new ProxyOperationManager( + this.backupRequestData, + this.backupTestRequestSender, + this.backupTestHostManager, + this); + } + + this.proxyOperationManagerInitializedEvent.Set(); + this.testHostManager = this.proxyOperationManager.TestHostManager; + this.requestData = this.proxyOperationManager.RequestData; + } + this.baseTestDiscoveryEventsHandler = eventHandler; try { @@ -170,6 +233,9 @@ public void DiscoverTests(DiscoveryCriteria discoveryCriteria, ITestDiscoveryEve /// public void Abort() { + // Make sure the proxy operation manager is initialized before anything. + this.proxyOperationManagerInitializedEvent.WaitOne(); + // Cancel fast, try to stop testhost deployment/launch this.proxyOperationManager.CancellationTokenSource.Cancel(); this.Close(); @@ -178,6 +244,9 @@ public void Abort() /// public void Close() { + // Make sure the proxy operation manager is initialized before anything. + this.proxyOperationManagerInitializedEvent.WaitOne(); + if (this.testSessionInfo == null) { this.proxyOperationManager.Close(); diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyExecutionManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyExecutionManager.cs index 24e51c49e3..4cc6bd0613 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyExecutionManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyExecutionManager.cs @@ -16,6 +16,7 @@ namespace Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.Interfaces; using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.ObjectModel; using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine; + using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Utilities; using Microsoft.VisualStudio.TestPlatform.ObjectModel; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Engine; @@ -30,16 +31,24 @@ namespace Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client /// internal class ProxyExecutionManager : IProxyExecutionManager, IBaseProxy, ITestRunEventsHandler2 { - private readonly ITestRuntimeProvider testHostManager; - private readonly IFileHelper fileHelper; + private readonly TestSessionInfo testSessionInfo = null; + private readonly string runSettings; + private readonly IRequestData backupRequestData; + private readonly ITestRequestSender backupTestRequestSender; + private readonly ITestRuntimeProvider backupTestHostManager; - private bool isCommunicationEstablished; - private bool skipDefaultAdapters; - private IDataSerializer dataSerializer; + private ITestRuntimeProvider testHostManager; private IRequestData requestData; + + private readonly IFileHelper fileHelper; + private readonly IDataSerializer dataSerializer; + private bool isCommunicationEstablished; + + private ManualResetEvent proxyOperationManagerInitializedEvent = new ManualResetEvent(false); + private ProxyOperationManager proxyOperationManager = null; private ITestRunEventsHandler baseTestRunEventsHandler; - private TestSessionInfo testSessionInfo = null; - private bool debugEnabledForTestSession = false; + private bool skipDefaultAdapters; + private readonly bool debugEnabledForTestSession = false; /// public bool IsInitialized { get; private set; } = false; @@ -49,11 +58,9 @@ internal class ProxyExecutionManager : IProxyExecutionManager, IBaseProxy, ITest /// public CancellationTokenSource CancellationTokenSource { - get { return this.ProxyOperationManager.CancellationTokenSource; } - set { this.ProxyOperationManager.CancellationTokenSource = value; } + get { return this.proxyOperationManager.CancellationTokenSource; } + set { this.proxyOperationManager.CancellationTokenSource = value; } } - - protected ProxyOperationManager ProxyOperationManager { get; set; } #region Constructors /// @@ -65,24 +72,40 @@ public CancellationTokenSource CancellationTokenSource /// /// A flag indicating if debugging should be enabled or not. /// + /// + /// The backup request data to be used to create a proxy operation manager should acquire + /// an existent proxy fail. + /// + /// + /// The backup test request sender to be used to create a proxy operation manager should + /// acquire an existent proxy fail. + /// + /// + /// The backup testhost manager to be used to create a proxy operation manager should + /// acquire an existent proxy fail. + /// public ProxyExecutionManager( TestSessionInfo testSessionInfo, string runSettings, - bool debugEnabledForTestSession) + bool debugEnabledForTestSession, + IRequestData backupRequestData, + ITestRequestSender backupTestRequestSender, + ITestRuntimeProvider backupTestHostManager) { // Filling in test session info and proxy information. this.testSessionInfo = testSessionInfo; - this.ProxyOperationManager = TestSessionPool.Instance.TakeProxy( - this.testSessionInfo, - runSettings); + this.runSettings = runSettings; // This should be set to enable debugging when we have test session info available. this.debugEnabledForTestSession = debugEnabledForTestSession; + this.backupRequestData = backupRequestData; + this.backupTestRequestSender = backupTestRequestSender; + this.backupTestHostManager = backupTestHostManager; - this.testHostManager = this.ProxyOperationManager.TestHostManager; + this.requestData = null; + this.testHostManager = null; this.dataSerializer = JsonDataSerializer.Instance; - this.isCommunicationEstablished = false; - this.requestData = this.ProxyOperationManager.RequestData; this.fileHelper = new FileHelper(); + this.isCommunicationEstablished = false; } /// @@ -134,7 +157,8 @@ internal ProxyExecutionManager( this.fileHelper = fileHelper; // Create a new proxy operation manager. - this.ProxyOperationManager = new ProxyOperationManager(requestData, requestSender, testHostManager, this); + this.proxyOperationManager = new ProxyOperationManager(requestData, requestSender, testHostManager, this); + this.proxyOperationManagerInitializedEvent.Set(); } #endregion @@ -151,8 +175,46 @@ public virtual void Initialize(bool skipDefaultAdapters) /// public virtual int StartTestRun(TestRunCriteria testRunCriteria, ITestRunEventsHandler eventHandler) { - this.baseTestRunEventsHandler = eventHandler; + if (this.proxyOperationManager == null) + { + try + { + // In case we have an active test session, we always prefer the already + // created proxies instead of the ones that need to be created on the spot. + var sources = testRunCriteria.HasSpecificTests + ? TestSourcesUtility.GetSources(testRunCriteria.Tests) + : testRunCriteria.Sources; + + this.proxyOperationManager = TestSessionPool.Instance.TakeProxy( + this.testSessionInfo, + sources.First(), + runSettings); + } + catch (InvalidOperationException ex) + { + // If the proxy creation process based on test session info failed, then + // we'll proceed with the normal creation process as if no test session + // info was passed in in the first place. + // + // WARNING: This should not normally happen and it raises questions + // regarding the test session pool operation and consistency. + EqtTrace.Warning( + "ProxyDiscoveryManager creation with test session failed: {0}", + ex.ToString()); + + this.proxyOperationManager = new ProxyOperationManager( + this.backupRequestData, + this.backupTestRequestSender, + this.backupTestHostManager, + this); + } + this.proxyOperationManagerInitializedEvent.Set(); + this.testHostManager = this.proxyOperationManager.TestHostManager; + this.requestData = this.proxyOperationManager.RequestData; + } + + this.baseTestRunEventsHandler = eventHandler; try { if (EqtTrace.IsVerboseEnabled) @@ -166,13 +228,13 @@ public virtual int StartTestRun(TestRunCriteria testRunCriteria, ITestRunEventsH // If the test execution is with a test filter, group them by sources. : testRunCriteria.Tests.GroupBy(tc => tc.Source).Select(g => g.Key)); - this.isCommunicationEstablished = this.ProxyOperationManager.SetupChannel( + this.isCommunicationEstablished = this.proxyOperationManager.SetupChannel( testSources, testRunCriteria.TestRunSettings); if (this.isCommunicationEstablished) { - this.ProxyOperationManager.CancellationTokenSource.Token.ThrowTestPlatformExceptionIfCancellationRequested(); + this.proxyOperationManager.CancellationTokenSource.Token.ThrowTestPlatformExceptionIfCancellationRequested(); this.InitializeExtensions(testSources); @@ -196,7 +258,7 @@ public virtual int StartTestRun(TestRunCriteria testRunCriteria, ITestRunEventsH filterOptions: testRunCriteria.FilterOptions); // This is workaround for the bug https://github.com/Microsoft/vstest/issues/970 - var runsettings = this.ProxyOperationManager.RemoveNodesFromRunsettingsIfRequired( + var runsettings = this.proxyOperationManager.RemoveNodesFromRunsettingsIfRequired( testRunCriteria.TestRunSettings, (testMessageLevel, message) => { this.LogMessage(testMessageLevel, message); }); @@ -207,7 +269,7 @@ public virtual int StartTestRun(TestRunCriteria testRunCriteria, ITestRunEventsH runsettings, executionContext, testSources); - this.ProxyOperationManager.RequestSender.StartTestRun(runRequest, this); + this.proxyOperationManager.RequestSender.StartTestRun(runRequest, this); } else { @@ -216,7 +278,7 @@ public virtual int StartTestRun(TestRunCriteria testRunCriteria, ITestRunEventsH runsettings, executionContext, testSources); - this.ProxyOperationManager.RequestSender.StartTestRun(runRequest, this); + this.proxyOperationManager.RequestSender.StartTestRun(runRequest, this); } } } @@ -261,11 +323,14 @@ public virtual void Cancel(ITestRunEventsHandler eventHandler) this.baseTestRunEventsHandler = eventHandler; } + // Make sure the proxy operation manager is initialized before anything. + this.proxyOperationManagerInitializedEvent.WaitOne(); + // Cancel fast, try to stop testhost deployment/launch. - this.ProxyOperationManager.CancellationTokenSource.Cancel(); + this.proxyOperationManager.CancellationTokenSource.Cancel(); if (this.isCommunicationEstablished) { - this.ProxyOperationManager.RequestSender.SendTestRunCancel(); + this.proxyOperationManager.RequestSender.SendTestRunCancel(); } } @@ -278,25 +343,31 @@ public void Abort(ITestRunEventsHandler eventHandler) this.baseTestRunEventsHandler = eventHandler; } + // Make sure the proxy operation manager is initialized before anything. + this.proxyOperationManagerInitializedEvent.WaitOne(); + // Cancel fast, try to stop testhost deployment/launch. - this.ProxyOperationManager.CancellationTokenSource.Cancel(); + this.proxyOperationManager.CancellationTokenSource.Cancel(); if (this.isCommunicationEstablished) { - this.ProxyOperationManager.RequestSender.SendTestRunAbort(); + this.proxyOperationManager.RequestSender.SendTestRunAbort(); } } /// public void Close() { + // Make sure the proxy operation manager is initialized before anything. + this.proxyOperationManagerInitializedEvent.WaitOne(); + if (this.testSessionInfo == null) { - this.ProxyOperationManager.Close(); + this.proxyOperationManager?.Close(); return; } - TestSessionPool.Instance.ReturnProxy(this.testSessionInfo, this.ProxyOperationManager.Id); + TestSessionPool.Instance.ReturnProxy(this.testSessionInfo, this.proxyOperationManager.Id); } /// @@ -349,7 +420,7 @@ public void HandleLogMessage(TestMessageLevel level, string message) public virtual TestProcessStartInfo UpdateTestProcessStartInfo(TestProcessStartInfo testProcessStartInfo) { // Update Telemetry Opt in status because by default in Test Host Telemetry is opted out - var telemetryOptedIn = this.ProxyOperationManager.RequestData.IsTelemetryOptedIn ? "true" : "false"; + var telemetryOptedIn = this.proxyOperationManager.RequestData.IsTelemetryOptedIn ? "true" : "false"; testProcessStartInfo.Arguments += " --telemetryoptedin " + telemetryOptedIn; return testProcessStartInfo; } @@ -368,7 +439,7 @@ public virtual TestProcessStartInfo UpdateTestProcessStartInfo(TestProcessStartI /// public virtual bool SetupChannel(IEnumerable sources, string runSettings) { - return this.ProxyOperationManager.SetupChannel(sources, runSettings); + return this.proxyOperationManager.SetupChannel(sources, runSettings); } private void LogMessage(TestMessageLevel testMessageLevel, string message) @@ -399,7 +470,7 @@ private void InitializeExtensions(IEnumerable sources) // Only send this if needed. if (platformExtensions.Any()) { - this.ProxyOperationManager.RequestSender.InitializeExecution(platformExtensions); + this.proxyOperationManager.RequestSender.InitializeExecution(platformExtensions); } } } diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyOperationManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyOperationManager.cs index 25ffa39859..001df9a710 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyOperationManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyOperationManager.cs @@ -35,7 +35,6 @@ public class ProxyOperationManager { private readonly string versionCheckPropertyName = "IsVersionCheckRequired"; private readonly string makeRunsettingsCompatiblePropertyName = "MakeRunsettingsCompatible"; - private readonly Guid id = Guid.NewGuid(); private readonly ManualResetEventSlim testHostExited = new ManualResetEventSlim(false); private readonly IProcessHelper processHelper; @@ -112,9 +111,9 @@ public ProxyOperationManager( public ITestRuntimeProvider TestHostManager { get; set; } /// - /// Gets the proxy operation manager id. + /// Gets the proxy operation manager id for proxy test session manager internal organization. /// - public Guid Id { get { return this.id; } } + public int Id { get; set; } = -1; /// /// Gets or sets the cancellation token source. diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/TestEngine.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/TestEngine.cs index a1fc90b97c..a063dc8164 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/TestEngine.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/TestEngine.cs @@ -80,46 +80,31 @@ public IProxyDiscoveryManager GetDiscoveryManager( Func proxyDiscoveryManagerCreator = () => { - if (discoveryCriteria.TestSessionInfo != null) - { - try - { - // In case we have an active test session, we always prefer the already - // created proxies instead of the ones that need to be created on the spot. - return new ProxyDiscoveryManager( - discoveryCriteria.TestSessionInfo, - discoveryCriteria.RunSettings); - } - catch (InvalidOperationException ex) - { - // If the proxy creation process based on test session info failed, then - // we'll proceed with the normal creation process as if no test session - // info was passed in in the first place. - // - // WARNING: This should not normally happen and it raises questions - // regarding the test session pool operation and consistency. - EqtTrace.Warning( - "ProxyDiscoveryManager creation with test session failed: {0}", - ex.ToString()); - } - } - var hostManager = this.testHostProviderManager.GetTestHostManagerByRunConfiguration(discoveryCriteria.RunSettings); hostManager?.Initialize(TestSessionMessageLogger.Instance, discoveryCriteria.RunSettings); - return new ProxyDiscoveryManager( - requestData, - new TestRequestSender(requestData.ProtocolConfig, hostManager), - hostManager); + // In case we have an active test session, we always prefer the already + // created proxies instead of the ones that need to be created on the spot. + return (discoveryCriteria.TestSessionInfo != null) + ? new ProxyDiscoveryManager( + discoveryCriteria.TestSessionInfo, + discoveryCriteria.RunSettings, + requestData, + new TestRequestSender(requestData.ProtocolConfig, hostManager), + hostManager) + : new ProxyDiscoveryManager( + requestData, + new TestRequestSender(requestData.ProtocolConfig, hostManager), + hostManager); }; - return testHostManager.Shared - ? proxyDiscoveryManagerCreator() - : new ParallelProxyDiscoveryManager( + return (parallelLevel > 1 || !testHostManager.Shared) + ? new ParallelProxyDiscoveryManager( requestData, proxyDiscoveryManagerCreator, parallelLevel, - sharedHosts: testHostManager.Shared); + sharedHosts: testHostManager.Shared) + : proxyDiscoveryManagerCreator(); } /// @@ -157,33 +142,6 @@ public IProxyExecutionManager GetExecutionManager( // specififed in run settings. Func proxyExecutionManagerCreator = () => { - if (testRunCriteria.TestSessionInfo != null) - { - try - { - // In case we have an active test session, data collection needs were - // already taken care of when first creating the session. As a consequence - // we always return this proxy instead of choosing between the vanilla - // execution proxy and the one with data collection enabled. - return new ProxyExecutionManager( - testRunCriteria.TestSessionInfo, - testRunCriteria.TestRunSettings, - testRunCriteria.DebugEnabledForTestSession); - } - catch (InvalidOperationException ex) - { - // If the proxy creation process based on test session info failed, then - // we'll proceed with the normal creation process as if no test session - // info was passed in in the first place. - // - // WARNING: This should not normally happen and it raises questions - // regarding the test session pool operation and consistency. - EqtTrace.Warning( - "ProxyExecutionManager creation with test session failed: {0}", - ex.ToString()); - } - } - // Create a new host manager, to be associated with individual // ProxyExecutionManager(&POM) var hostManager = this.testHostProviderManager.GetTestHostManagerByRunConfiguration(testRunCriteria.TestRunSettings); @@ -196,6 +154,21 @@ public IProxyExecutionManager GetExecutionManager( var requestSender = new TestRequestSender(requestData.ProtocolConfig, hostManager); + if (testRunCriteria.TestSessionInfo != null) + { + // In case we have an active test session, data collection needs were + // already taken care of when first creating the session. As a consequence + // we always return this proxy instead of choosing between the vanilla + // execution proxy and the one with data collection enabled. + return new ProxyExecutionManager( + testRunCriteria.TestSessionInfo, + testRunCriteria.TestRunSettings, + testRunCriteria.DebugEnabledForTestSession, + requestData, + requestSender, + hostManager); + } + return isDataCollectorEnabled ? new ProxyExecutionManagerWithDataCollection( requestData, @@ -303,7 +276,10 @@ public IProxyTestSessionManager GetTestSessionManager( }; var testhostManager = this.testHostProviderManager.GetTestHostManagerByRunConfiguration(testSessionCriteria.RunSettings); - var testhostCount = testhostManager.Shared ? 1 : testSessionCriteria.Sources.Count; + testhostManager.Initialize(TestSessionMessageLogger.Instance, testSessionCriteria.RunSettings); + var testhostCount = (parallelLevel > 1 || !testhostManager.Shared) + ? testSessionCriteria.Sources.Count + : 1; return new ProxyTestSessionManager(testSessionCriteria, testhostCount, proxyCreator); } diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/TestSession/ProxyTestSessionManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/TestSession/ProxyTestSessionManager.cs index 47ff59b3fb..50d1f43464 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/TestSession/ProxyTestSessionManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/TestSession/ProxyTestSessionManager.cs @@ -6,6 +6,7 @@ namespace Microsoft.VisualStudio.TestPlatform.CrossPlatEngine using System; using System.Collections.Generic; using System.Globalization; + using System.Linq; using System.Threading.Tasks; using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client; @@ -21,13 +22,13 @@ namespace Microsoft.VisualStudio.TestPlatform.CrossPlatEngine public class ProxyTestSessionManager : IProxyTestSessionManager { private readonly object lockObject = new object(); + private readonly object proxyOperationLockObject = new object(); private StartTestSessionCriteria testSessionCriteria; private int testhostCount; - private bool skipDefaultAdapters; private TestSessionInfo testSessionInfo; private Func proxyCreator; - private Queue availableProxyQueue; - private IDictionary proxyMap; + private IList proxyContainerList; + private IDictionary proxyMap; /// /// Initializes a new instance of the class. @@ -45,120 +46,110 @@ public ProxyTestSessionManager( this.testhostCount = testhostCount; this.proxyCreator = proxyCreator; - this.availableProxyQueue = new Queue(); - this.proxyMap = new Dictionary(); - } - - /// - public void Initialize(bool skipDefaultAdapters) - { - this.skipDefaultAdapters = skipDefaultAdapters; + this.proxyContainerList = new List(); + this.proxyMap = new Dictionary(); } /// public void StartSession(ITestSessionEventsHandler eventsHandler) { - if (this.testSessionInfo != null) + lock (this.lockObject) { - return; + if (this.testSessionInfo != null) + { + return; + } + this.testSessionInfo = new TestSessionInfo(); } - this.testSessionInfo = new TestSessionInfo(); - - var taskList = new Task[this.testhostCount]; - // Create all the proxies in parallel, one task per proxy. + var taskList = new Task[this.testhostCount]; for (int i = 0; i < this.testhostCount; ++i) { - taskList[i] = Task.Factory.StartNew(() => - { - try - { - // Create and cache the proxy. - var operationManagerProxy = this.proxyCreator(); - if (operationManagerProxy == null) - { - return; - } - - // Initialize the proxy. - operationManagerProxy.Initialize(this.skipDefaultAdapters); - - // Start the test host associated to the proxy. - operationManagerProxy.SetupChannel( - this.testSessionCriteria.Sources, - this.testSessionCriteria.RunSettings, - eventsHandler); - - this.EnqueueNewProxy(operationManagerProxy); - } - catch (Exception ex) - { - // Log & silently eat up the exception. It's a valid course of action to - // just forfeit proxy creation. This means that anyone wishing to get a - // proxy operation manager would have to create their own, on the spot, - // instead of getting one already created, and this case is handled - // gracefully already. - EqtTrace.Error( - "ProxyTestSessionManager.StartSession: Cannot create proxy. Error: {0}", - ex.ToString()); - return; - } - }); + // The testhost count is equal to 1 because one of the following conditions + // holds true: + // 1. we're dealing with a shared testhost (e.g.: .NET Framework testhost) + // that must process multiple sources within the same testhost process; + // 2. we're dealing with a single testhost (shared or not, it doesn't matter) + // that must process a single source; + // Either way, no further processing of the original test source list is needed + // in either of those cases. + // + // Consequentely, if the testhost count is greater than one it means that the + // testhost is not shared (e.g.: .NET Core testhost), in which case each test + // source must be processed by a dedicated testhost, which is the reason we + // create a list with a single element, i.e. the current source to be processed. + var sources = (this.testhostCount == 1) + ? this.testSessionCriteria.Sources + : new List() { this.testSessionCriteria.Sources[i] }; + + taskList[i] = Task.Factory.StartNew(() => this.SetupRawProxy( + sources, + this.testSessionCriteria.RunSettings, + eventsHandler)); } // Wait for proxy creation to be over. Task.WaitAll(taskList); // Make the session available. - TestSessionPool.Instance.AddSession(testSessionInfo, this); + TestSessionPool.Instance.AddSession(this.testSessionInfo, this); // Let the caller know the session has been created. - eventsHandler.HandleStartTestSessionComplete(testSessionInfo); + eventsHandler.HandleStartTestSessionComplete(this.testSessionInfo); } /// public void StopSession() { - if (this.testSessionInfo == null) + lock (this.lockObject) { - return; + if (this.testSessionInfo == null) + { + return; + } + this.testSessionInfo = null; } - int index = 0; - var taskList = new Task[this.proxyMap.Count]; - - // Dispose of all the proxies in parallel, one task per proxy. - foreach (var kvp in this.proxyMap) + lock (this.proxyOperationLockObject) { - taskList[index++] = Task.Factory.StartNew(() => + // Dispose of all the proxies in parallel, one task per proxy. + int index = 0; + var taskList = new Task[this.proxyContainerList.Count]; + foreach (var proxyContainer in this.proxyContainerList) { - // Initiate the end session handshake with the underlying testhost. - kvp.Value.Proxy.Close(); - }); - } + taskList[index++] = Task.Factory.StartNew(() => + { + // Initiate the end session handshake with the underlying testhost. + proxyContainer.Proxy.Close(); + }); + } - // Wait for proxy disposal to be over. - Task.WaitAll(taskList); + // Wait for proxy disposal to be over. + Task.WaitAll(taskList); - this.testSessionInfo = null; + this.proxyContainerList.Clear(); + this.proxyMap.Clear(); + } } /// /// Dequeues a proxy to be used either by discovery or execution. /// /// + /// The source to be associated to this proxy. /// The run settings. /// /// The dequeued proxy. - public ProxyOperationManager DequeueProxy(string runSettings) + public ProxyOperationManager DequeueProxy(string source, string runSettings) { ProxyOperationManagerContainer proxyContainer = null; - lock (this.lockObject) + lock (this.proxyOperationLockObject) { // No proxy available means the caller will have to create its own proxy. - if (this.availableProxyQueue.Count == 0) + if (!this.proxyMap.ContainsKey(source) + || !this.proxyContainerList[this.proxyMap[source]].IsAvailable) { throw new InvalidOperationException( string.Format( @@ -180,11 +171,8 @@ public ProxyOperationManager DequeueProxy(string runSettings) CrossPlatResources.NoProxyMatchesDescription)); } - // Get the proxy id from the available queue. - var proxyId = this.availableProxyQueue.Dequeue(); - // Get the actual proxy. - proxyContainer = this.proxyMap[proxyId]; + proxyContainer = this.proxyContainerList[this.proxyMap[source]]; // Mark the proxy as unavailable. proxyContainer.IsAvailable = false; @@ -198,12 +186,12 @@ public ProxyOperationManager DequeueProxy(string runSettings) /// /// /// The id of the proxy to be re-enqueued. - public void EnqueueProxy(Guid proxyId) + public void EnqueueProxy(int proxyId) { - lock (this.lockObject) + lock (this.proxyOperationLockObject) { // Check if the proxy exists. - if (!this.proxyMap.ContainsKey(proxyId)) + if (proxyId < 0 || proxyId >= this.proxyContainerList.Count) { throw new ArgumentException( string.Format( @@ -213,7 +201,7 @@ public void EnqueueProxy(Guid proxyId) } // Get the actual proxy. - var proxyContainer = this.proxyMap[proxyId]; + var proxyContainer = this.proxyContainerList[proxyId]; if (proxyContainer.IsAvailable) { throw new InvalidOperationException( @@ -225,25 +213,74 @@ public void EnqueueProxy(Guid proxyId) // Mark the proxy as available. proxyContainer.IsAvailable = true; + } + } + + private int EnqueueNewProxy( + IList sources, + ProxyOperationManagerContainer operationManagerContainer) + { + lock (this.proxyOperationLockObject) + { + var index = this.proxyContainerList.Count; + + // Add the proxy container to the proxy container list. + this.proxyContainerList.Add(operationManagerContainer); + + foreach (var source in sources) + { + // Add the proxy index to the map. + this.proxyMap.Add( + source, + index); + } - // Re-enqueue the proxy in the available queue. - this.availableProxyQueue.Enqueue(proxyId); + return index; } } - private void EnqueueNewProxy(ProxyOperationManager operationManagerProxy) + private void SetupRawProxy( + IList sources, + string runSettings, + ITestSessionEventsHandler eventsHandler) { - lock (this.lockObject) + try + { + // Create and cache the proxy. + var operationManagerProxy = this.proxyCreator(); + if (operationManagerProxy == null) + { + return; + } + + // Initialize the proxy. + operationManagerProxy.Initialize(skipDefaultAdapters: false); + + // Start the test host associated to the proxy. + operationManagerProxy.SetupChannel( + sources, + runSettings, + eventsHandler); + + // Associate each source in the source list with this new proxy operation + // container. + var operationManagerContainer = new ProxyOperationManagerContainer( + operationManagerProxy, + available: true); + + operationManagerContainer.Proxy.Id = this.EnqueueNewProxy(sources, operationManagerContainer); + } + catch (Exception ex) { - // Add the proxy to the map. - this.proxyMap.Add( - operationManagerProxy.Id, - new ProxyOperationManagerContainer( - operationManagerProxy, - available: true)); - - // Enqueue the proxy id in the available queue. - this.availableProxyQueue.Enqueue(operationManagerProxy.Id); + // Log & silently eat up the exception. It's a valid course of action to + // just forfeit proxy creation. This means that anyone wishing to get a + // proxy operation manager would have to create their own, on the spot, + // instead of getting one already created, and this case is handled + // gracefully already. + EqtTrace.Error( + "ProxyTestSessionManager.StartSession: Cannot create proxy. Error: {0}", + ex.ToString()); + return; } } } diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/TestSession/TestSessionPool.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/TestSession/TestSessionPool.cs index 5488c36af8..772dab9903 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/TestSession/TestSessionPool.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/TestSession/TestSessionPool.cs @@ -115,11 +115,13 @@ public bool KillSession(TestSessionInfo testSessionInfo) /// /// /// The test session info object. + /// The source to be associated to this proxy. /// The run settings. /// /// The proxy object. public ProxyOperationManager TakeProxy( TestSessionInfo testSessionInfo, + string source, string runSettings) { ProxyTestSessionManager sessionManager = null; @@ -133,7 +135,7 @@ public ProxyOperationManager TakeProxy( // // This can potentially throw, but let the caller handle this as it must recover from // this error by creating its own proxy. - return sessionManager.DequeueProxy(runSettings); + return sessionManager.DequeueProxy(source, runSettings); } /// @@ -142,7 +144,7 @@ public ProxyOperationManager TakeProxy( /// /// The test session info object. /// The proxy id to be returned. - public void ReturnProxy(TestSessionInfo testSessionInfo, Guid proxyId) + public void ReturnProxy(TestSessionInfo testSessionInfo, int proxyId) { ProxyTestSessionManager sessionManager = null; lock (this.lockObject) From 90170c50ebd4e385580229f39924cc61bfd476ea Mon Sep 17 00:00:00 2001 From: Codrin Poienaru Date: Thu, 16 Sep 2021 15:46:18 +0200 Subject: [PATCH 18/26] Fixed public API errors --- .../Client/DiscoveryCriteria.cs | 1 + .../Client/Payloads/DiscoveryRequestPayload.cs | 1 + .../PublicAPI/net45/PublicAPI.Unshipped.txt | 6 +++++- .../PublicAPI/net451/PublicAPI.Unshipped.txt | 6 +++++- .../PublicAPI/net6.0/PublicAPI.Unshipped.txt | 6 +++++- .../PublicAPI/netcoreapp1.0/PublicAPI.Unshipped.txt | 6 +++++- .../PublicAPI/netcoreapp2.1/PublicAPI.Unshipped.txt | 6 +++++- .../PublicAPI/netstandard1.0/PublicAPI.Unshipped.txt | 6 +++++- .../PublicAPI/netstandard1.3/PublicAPI.Unshipped.txt | 6 +++++- .../PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt | 6 +++++- .../PublicAPI/uap10.0/PublicAPI.Unshipped.txt | 6 +++++- 11 files changed, 47 insertions(+), 9 deletions(-) diff --git a/src/Microsoft.TestPlatform.ObjectModel/Client/DiscoveryCriteria.cs b/src/Microsoft.TestPlatform.ObjectModel/Client/DiscoveryCriteria.cs index f60e5cdbac..cadbac69a2 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Client/DiscoveryCriteria.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/Client/DiscoveryCriteria.cs @@ -182,6 +182,7 @@ public IEnumerable Sources /// /// Gets or sets the test session info object. /// + [DataMember] public TestSessionInfo TestSessionInfo { get; set; } } } diff --git a/src/Microsoft.TestPlatform.ObjectModel/Client/Payloads/DiscoveryRequestPayload.cs b/src/Microsoft.TestPlatform.ObjectModel/Client/Payloads/DiscoveryRequestPayload.cs index d0057377ba..c8a69408ca 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Client/Payloads/DiscoveryRequestPayload.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/Client/Payloads/DiscoveryRequestPayload.cs @@ -9,6 +9,7 @@ namespace Microsoft.VisualStudio.TestPlatform.ObjectModel.Client /// /// Class used to define the DiscoveryRequestPayload sent by the Vstest.console translation layers into design mode /// + [DataContract] public class DiscoveryRequestPayload { /// diff --git a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/net45/PublicAPI.Unshipped.txt b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/net45/PublicAPI.Unshipped.txt index 5f282702bb..0ccec4f450 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/net45/PublicAPI.Unshipped.txt +++ b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/net45/PublicAPI.Unshipped.txt @@ -1 +1,5 @@ - \ No newline at end of file +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.DiscoveryCriteria(System.Collections.Generic.IEnumerable sources, long frequencyOfDiscoveredTestsEvent, System.TimeSpan discoveredTestEventTimeout, string runSettings, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo testSessionInfo) -> void +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.TestSessionInfo.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.TestSessionInfo.set -> void +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryRequestPayload.TestSessionInfo.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryRequestPayload.TestSessionInfo.set -> void \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/net451/PublicAPI.Unshipped.txt b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/net451/PublicAPI.Unshipped.txt index 5f282702bb..0ccec4f450 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/net451/PublicAPI.Unshipped.txt +++ b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/net451/PublicAPI.Unshipped.txt @@ -1 +1,5 @@ - \ No newline at end of file +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.DiscoveryCriteria(System.Collections.Generic.IEnumerable sources, long frequencyOfDiscoveredTestsEvent, System.TimeSpan discoveredTestEventTimeout, string runSettings, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo testSessionInfo) -> void +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.TestSessionInfo.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.TestSessionInfo.set -> void +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryRequestPayload.TestSessionInfo.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryRequestPayload.TestSessionInfo.set -> void \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/net6.0/PublicAPI.Unshipped.txt b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/net6.0/PublicAPI.Unshipped.txt index 5f282702bb..0ccec4f450 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/net6.0/PublicAPI.Unshipped.txt +++ b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/net6.0/PublicAPI.Unshipped.txt @@ -1 +1,5 @@ - \ No newline at end of file +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.DiscoveryCriteria(System.Collections.Generic.IEnumerable sources, long frequencyOfDiscoveredTestsEvent, System.TimeSpan discoveredTestEventTimeout, string runSettings, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo testSessionInfo) -> void +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.TestSessionInfo.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.TestSessionInfo.set -> void +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryRequestPayload.TestSessionInfo.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryRequestPayload.TestSessionInfo.set -> void \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netcoreapp1.0/PublicAPI.Unshipped.txt b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netcoreapp1.0/PublicAPI.Unshipped.txt index 5f282702bb..0ccec4f450 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netcoreapp1.0/PublicAPI.Unshipped.txt +++ b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netcoreapp1.0/PublicAPI.Unshipped.txt @@ -1 +1,5 @@ - \ No newline at end of file +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.DiscoveryCriteria(System.Collections.Generic.IEnumerable sources, long frequencyOfDiscoveredTestsEvent, System.TimeSpan discoveredTestEventTimeout, string runSettings, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo testSessionInfo) -> void +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.TestSessionInfo.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.TestSessionInfo.set -> void +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryRequestPayload.TestSessionInfo.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryRequestPayload.TestSessionInfo.set -> void \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netcoreapp2.1/PublicAPI.Unshipped.txt b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netcoreapp2.1/PublicAPI.Unshipped.txt index 5f282702bb..0ccec4f450 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netcoreapp2.1/PublicAPI.Unshipped.txt +++ b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netcoreapp2.1/PublicAPI.Unshipped.txt @@ -1 +1,5 @@ - \ No newline at end of file +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.DiscoveryCriteria(System.Collections.Generic.IEnumerable sources, long frequencyOfDiscoveredTestsEvent, System.TimeSpan discoveredTestEventTimeout, string runSettings, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo testSessionInfo) -> void +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.TestSessionInfo.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.TestSessionInfo.set -> void +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryRequestPayload.TestSessionInfo.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryRequestPayload.TestSessionInfo.set -> void \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netstandard1.0/PublicAPI.Unshipped.txt b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netstandard1.0/PublicAPI.Unshipped.txt index 5f282702bb..0ccec4f450 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netstandard1.0/PublicAPI.Unshipped.txt +++ b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netstandard1.0/PublicAPI.Unshipped.txt @@ -1 +1,5 @@ - \ No newline at end of file +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.DiscoveryCriteria(System.Collections.Generic.IEnumerable sources, long frequencyOfDiscoveredTestsEvent, System.TimeSpan discoveredTestEventTimeout, string runSettings, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo testSessionInfo) -> void +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.TestSessionInfo.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.TestSessionInfo.set -> void +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryRequestPayload.TestSessionInfo.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryRequestPayload.TestSessionInfo.set -> void \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netstandard1.3/PublicAPI.Unshipped.txt b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netstandard1.3/PublicAPI.Unshipped.txt index 5f282702bb..0ccec4f450 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netstandard1.3/PublicAPI.Unshipped.txt +++ b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netstandard1.3/PublicAPI.Unshipped.txt @@ -1 +1,5 @@ - \ No newline at end of file +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.DiscoveryCriteria(System.Collections.Generic.IEnumerable sources, long frequencyOfDiscoveredTestsEvent, System.TimeSpan discoveredTestEventTimeout, string runSettings, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo testSessionInfo) -> void +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.TestSessionInfo.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.TestSessionInfo.set -> void +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryRequestPayload.TestSessionInfo.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryRequestPayload.TestSessionInfo.set -> void \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt index 5f282702bb..0ccec4f450 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt +++ b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt @@ -1 +1,5 @@ - \ No newline at end of file +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.DiscoveryCriteria(System.Collections.Generic.IEnumerable sources, long frequencyOfDiscoveredTestsEvent, System.TimeSpan discoveredTestEventTimeout, string runSettings, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo testSessionInfo) -> void +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.TestSessionInfo.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.TestSessionInfo.set -> void +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryRequestPayload.TestSessionInfo.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryRequestPayload.TestSessionInfo.set -> void \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/uap10.0/PublicAPI.Unshipped.txt b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/uap10.0/PublicAPI.Unshipped.txt index 5f282702bb..0ccec4f450 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/uap10.0/PublicAPI.Unshipped.txt +++ b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/uap10.0/PublicAPI.Unshipped.txt @@ -1 +1,5 @@ - \ No newline at end of file +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.DiscoveryCriteria(System.Collections.Generic.IEnumerable sources, long frequencyOfDiscoveredTestsEvent, System.TimeSpan discoveredTestEventTimeout, string runSettings, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo testSessionInfo) -> void +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.TestSessionInfo.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.TestSessionInfo.set -> void +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryRequestPayload.TestSessionInfo.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryRequestPayload.TestSessionInfo.set -> void \ No newline at end of file From 632824805eb27b12772a5a861444ae50c979c6f5 Mon Sep 17 00:00:00 2001 From: Codrin Poienaru Date: Thu, 16 Sep 2021 19:33:30 +0200 Subject: [PATCH 19/26] Fixed unit tests --- .../Client/ProxyDiscoveryManager.cs | 6 +++ .../Client/ProxyExecutionManager.cs | 8 +++- .../Client/ProxyOperationManager.cs | 39 ++++--------------- .../TestEngine.cs | 5 +-- .../Client/DiscoveryCriteriaTests.cs | 2 +- 5 files changed, 23 insertions(+), 37 deletions(-) diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyDiscoveryManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyDiscoveryManager.cs index fcb6fd39fe..f651e56afc 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyDiscoveryManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyDiscoveryManager.cs @@ -247,6 +247,12 @@ public void Close() // Make sure the proxy operation manager is initialized before anything. this.proxyOperationManagerInitializedEvent.WaitOne(); + // In compatibility mode (no test session used) we don't share the testhost + // between test discovery and test run. The testhost is closed upon + // successfully completing the operation it was spawned for. + // + // In contrast, the new workflow (using test sessions) means we should keep + // the testhost alive until explicitly closed by the test session owner. if (this.testSessionInfo == null) { this.proxyOperationManager.Close(); diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyExecutionManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyExecutionManager.cs index 4cc6bd0613..54d2118e4b 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyExecutionManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyExecutionManager.cs @@ -361,9 +361,15 @@ public void Close() // Make sure the proxy operation manager is initialized before anything. this.proxyOperationManagerInitializedEvent.WaitOne(); + // In compatibility mode (no test session used) we don't share the testhost + // between test discovery and test run. The testhost is closed upon + // successfully completing the operation it was spawned for. + // + // In contrast, the new workflow (using test sessions) means we should keep + // the testhost alive until explicitly closed by the test session owner. if (this.testSessionInfo == null) { - this.proxyOperationManager?.Close(); + this.proxyOperationManager.Close(); return; } diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyOperationManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyOperationManager.cs index 001df9a710..fc5d07cbf6 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyOperationManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyOperationManager.cs @@ -119,12 +119,6 @@ public ProxyOperationManager( /// Gets or sets the cancellation token source. /// public CancellationTokenSource CancellationTokenSource { get; set; } - - /// - /// Gets or sets a value indicating if the test request sender communication channel should - /// be closed when the proxy operation manager is closed. - /// - public bool CloseRequestSenderChannelOnProxyClose { get; set; } = false; #endregion #region IProxyOperationManager implementation. @@ -315,21 +309,8 @@ public virtual void Close() EqtTrace.Verbose("ProxyOperationManager.Close: waiting for test host to exit for {0} ms", timeout); this.testHostExited.Wait(timeout); - // In compatibility mode (no test session used) we don't share the testhost - // between test discovery and test run. The testhost is closed upon - // successfully completing the operation it was spawned for, and so the test - // request sender communication channel is closed then as well. As such, it's - // not a good idea to double close the communication channel here. - // - // In contrast, the new workflow (using test sessions) means we should keep - // the testhost alive until explicitly closed by the test session owner. For - // this we supressed the normal test request sender close and we have to close - // that communication channel here. - if (this.CloseRequestSenderChannelOnProxyClose) - { - // Closing the communication channel. - this.RequestSender.Close(); - } + // Closing the communication channel. + this.RequestSender.Close(); } } catch (Exception ex) @@ -340,19 +321,15 @@ public virtual void Close() } finally { - // Should only cleanup the testhost if we're in compatibility mode. - if (this.CloseRequestSenderChannelOnProxyClose) - { - this.initialized = false; + this.initialized = false; - EqtTrace.Warning("ProxyOperationManager: Timed out waiting for test host to exit. Will terminate process."); + EqtTrace.Warning("ProxyOperationManager: Timed out waiting for test host to exit. Will terminate process."); - // Please clean up test host. - this.TestHostManager.CleanTestHostAsync(CancellationToken.None).Wait(); + // Please clean up test host. + this.TestHostManager.CleanTestHostAsync(CancellationToken.None).Wait(); - this.TestHostManager.HostExited -= this.TestHostManagerHostExited; - this.TestHostManager.HostLaunched -= this.TestHostManagerHostLaunched; - } + this.TestHostManager.HostExited -= this.TestHostManagerHostExited; + this.TestHostManager.HostLaunched -= this.TestHostManagerHostLaunched; } } diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/TestEngine.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/TestEngine.cs index a063dc8164..3a4adb6791 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/TestEngine.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/TestEngine.cs @@ -269,10 +269,7 @@ public IProxyTestSessionManager GetTestSessionManager( : new ProxyOperationManager( requestData, requestSender, - hostManager) - { - CloseRequestSenderChannelOnProxyClose = true - }; + hostManager); }; var testhostManager = this.testHostProviderManager.GetTestHostManagerByRunConfiguration(testSessionCriteria.RunSettings); diff --git a/test/Microsoft.TestPlatform.ObjectModel.UnitTests/Client/DiscoveryCriteriaTests.cs b/test/Microsoft.TestPlatform.ObjectModel.UnitTests/Client/DiscoveryCriteriaTests.cs index 143005c095..5b309a92d1 100644 --- a/test/Microsoft.TestPlatform.ObjectModel.UnitTests/Client/DiscoveryCriteriaTests.cs +++ b/test/Microsoft.TestPlatform.ObjectModel.UnitTests/Client/DiscoveryCriteriaTests.cs @@ -32,7 +32,7 @@ public DiscoveryCriteriaTests() [TestMethod] public void DiscoveryCriteriaSerializesToExpectedJson() { - var expectedJson = "{\"Package\":null,\"AdapterSourceMap\":{\"_none_\":[\"sampleTest.dll\"]},\"FrequencyOfDiscoveredTestsEvent\":100,\"DiscoveredTestEventTimeout\":\"10675199.02:48:05.4775807\",\"RunSettings\":\"\",\"TestCaseFilter\":\"TestFilter\"}"; + var expectedJson = "{\"Package\":null,\"AdapterSourceMap\":{\"_none_\":[\"sampleTest.dll\"]},\"FrequencyOfDiscoveredTestsEvent\":100,\"DiscoveredTestEventTimeout\":\"10675199.02:48:05.4775807\",\"RunSettings\":\"\",\"TestCaseFilter\":\"TestFilter\",\"TestSessionInfo\":null}"; var json = JsonConvert.SerializeObject(this.discoveryCriteria, Settings); From 73fe5d0aeb81c71a764a1efdd4aebb6184edc037 Mon Sep 17 00:00:00 2001 From: Codrin Poienaru Date: Wed, 20 Oct 2021 21:05:56 +0200 Subject: [PATCH 20/26] Added more unit tests --- .../TestPlatform.cs | 8 +- .../IProxyTestSessionManager.cs | 8 +- .../Client/ProxyDiscoveryManager.cs | 22 +- .../Client/ProxyExecutionManager.cs | 30 +- .../Client/ProxyOperationManager.cs | 1 + .../Resources/xlf/Resources.cs.xlf | 10 + .../Resources/xlf/Resources.de.xlf | 10 + .../Resources/xlf/Resources.es.xlf | 10 + .../Resources/xlf/Resources.fr.xlf | 10 + .../Resources/xlf/Resources.it.xlf | 10 + .../Resources/xlf/Resources.ja.xlf | 10 + .../Resources/xlf/Resources.ko.xlf | 10 + .../Resources/xlf/Resources.pl.xlf | 10 + .../Resources/xlf/Resources.pt-BR.xlf | 10 + .../Resources/xlf/Resources.ru.xlf | 10 + .../Resources/xlf/Resources.tr.xlf | 10 + .../Resources/xlf/Resources.zh-Hans.xlf | 10 + .../Resources/xlf/Resources.zh-Hant.xlf | 10 + .../TestSession/ProxyTestSessionManager.cs | 127 ++-- .../TestSession/TestSessionPool.cs | 68 +- .../Client/Interfaces/ITestPlatform.cs | 4 +- .../PublicAPI/net45/PublicAPI.Shipped.txt | 1 - .../PublicAPI/net45/PublicAPI.Unshipped.txt | 3 +- .../PublicAPI/net451/PublicAPI.Shipped.txt | 1 - .../PublicAPI/net451/PublicAPI.Unshipped.txt | 3 +- .../PublicAPI/net6.0/PublicAPI.Unshipped.txt | 3 +- .../netcoreapp1.0/PublicAPI.Shipped.txt | 1 - .../netcoreapp1.0/PublicAPI.Unshipped.txt | 3 +- .../netcoreapp2.1/PublicAPI.Shipped.txt | 1 - .../netcoreapp2.1/PublicAPI.Unshipped.txt | 3 +- .../netstandard1.0/PublicAPI.Shipped.txt | 1 - .../netstandard1.0/PublicAPI.Unshipped.txt | 3 +- .../netstandard1.3/PublicAPI.Shipped.txt | 1 - .../netstandard1.3/PublicAPI.Unshipped.txt | 3 +- .../netstandard2.0/PublicAPI.Shipped.txt | 1 - .../netstandard2.0/PublicAPI.Unshipped.txt | 3 +- .../PublicAPI/uap10.0/PublicAPI.Shipped.txt | 1 - .../PublicAPI/uap10.0/PublicAPI.Unshipped.txt | 3 +- .../Interfaces/ITestSession.cs | 5 + .../TestSession.cs | 40 +- .../VsTestConsoleWrapper.cs | 2 +- .../TestPlatformHelpers/TestRequestManager.cs | 5 +- .../Client/ProxyTestSessionManagerTests.cs | 335 ++++++++++ .../TestSession/TestSessionPoolTests.cs | 124 ++++ .../TestSessionTests.cs | 586 ++++++++++++++++++ .../VsTestConsoleRequestSenderTests.cs | 373 ++++++++++- .../VsTestConsoleWrapperAsyncTests.cs | 249 ++++++++ .../VsTestConsoleWrapperTests.cs | 242 ++++++++ 48 files changed, 2252 insertions(+), 142 deletions(-) create mode 100644 test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyTestSessionManagerTests.cs create mode 100644 test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/TestSession/TestSessionPoolTests.cs create mode 100644 test/TranslationLayer.UnitTests/TestSessionTests.cs diff --git a/src/Microsoft.TestPlatform.Client/TestPlatform.cs b/src/Microsoft.TestPlatform.Client/TestPlatform.cs index 3f34331750..bb7c62320d 100644 --- a/src/Microsoft.TestPlatform.Client/TestPlatform.cs +++ b/src/Microsoft.TestPlatform.Client/TestPlatform.cs @@ -157,7 +157,7 @@ public ITestRunRequest CreateTestRunRequest( } /// - public void StartTestSession( + public bool StartTestSession( IRequestData requestData, StartTestSessionCriteria testSessionCriteria, ITestSessionEventsHandler eventsHandler) @@ -172,7 +172,7 @@ public void StartTestSession( var runConfiguration = XmlRunSettingsUtilities.GetRunConfigurationNode(testSessionCriteria.RunSettings); if (!runConfiguration.DesignMode) { - return; + return false; } var testSessionManager = this.TestEngine.GetTestSessionManager(requestData, testSessionCriteria); @@ -183,10 +183,10 @@ public void StartTestSession( // of this no session will be created because there's no testhost to be launched. // Expecting a subsequent call to execute tests with the same set of parameters. eventsHandler.HandleStartTestSessionComplete(null); - return; + return false; } - testSessionManager.StartSession(eventsHandler); + return testSessionManager.StartSession(eventsHandler); } /// diff --git a/src/Microsoft.TestPlatform.Common/Interfaces/Engine/ClientProtocol/IProxyTestSessionManager.cs b/src/Microsoft.TestPlatform.Common/Interfaces/Engine/ClientProtocol/IProxyTestSessionManager.cs index 4a7919d8f3..f7db16f472 100644 --- a/src/Microsoft.TestPlatform.Common/Interfaces/Engine/ClientProtocol/IProxyTestSessionManager.cs +++ b/src/Microsoft.TestPlatform.Common/Interfaces/Engine/ClientProtocol/IProxyTestSessionManager.cs @@ -18,11 +18,15 @@ public interface IProxyTestSessionManager /// /// Event handler for handling events fired during test session management operations. /// - void StartSession(ITestSessionEventsHandler eventsHandler); + /// + /// True if the operation succeeded, false otherwise. + bool StartSession(ITestSessionEventsHandler eventsHandler); /// /// Stops the test session. /// - void StopSession(); + /// + /// True if the operation succeeded, false otherwise. + bool StopSession(); } } diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyDiscoveryManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyDiscoveryManager.cs index f651e56afc..9f1120ae01 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyDiscoveryManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyDiscoveryManager.cs @@ -155,16 +155,14 @@ public void DiscoverTests(DiscoveryCriteria discoveryCriteria, ITestDiscoveryEve { if (this.proxyOperationManager == null) { - try - { - // In case we have an active test session, we always prefer the already - // created proxies instead of the ones that need to be created on the spot. - this.proxyOperationManager = TestSessionPool.Instance.TakeProxy( - this.testSessionInfo, - discoveryCriteria.Sources.First(), - runSettings); - } - catch (InvalidOperationException ex) + // In case we have an active test session, we always prefer the already + // created proxies instead of the ones that need to be created on the spot. + this.proxyOperationManager = TestSessionPool.Instance.TakeProxy( + this.testSessionInfo, + discoveryCriteria.Sources.First(), + runSettings); + + if (this.proxyOperationManager == null) { // If the proxy creation process based on test session info failed, then // we'll proceed with the normal creation process as if no test session @@ -172,9 +170,7 @@ public void DiscoverTests(DiscoveryCriteria discoveryCriteria, ITestDiscoveryEve // // WARNING: This should not normally happen and it raises questions // regarding the test session pool operation and consistency. - EqtTrace.Warning( - "ProxyDiscoveryManager creation with test session failed: {0}", - ex.ToString()); + EqtTrace.Warning("ProxyDiscoveryManager creation with test session failed."); this.proxyOperationManager = new ProxyOperationManager( this.backupRequestData, diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyExecutionManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyExecutionManager.cs index 54d2118e4b..6407c724b8 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyExecutionManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyExecutionManager.cs @@ -177,20 +177,18 @@ public virtual int StartTestRun(TestRunCriteria testRunCriteria, ITestRunEventsH { if (this.proxyOperationManager == null) { - try - { - // In case we have an active test session, we always prefer the already - // created proxies instead of the ones that need to be created on the spot. - var sources = testRunCriteria.HasSpecificTests - ? TestSourcesUtility.GetSources(testRunCriteria.Tests) - : testRunCriteria.Sources; - - this.proxyOperationManager = TestSessionPool.Instance.TakeProxy( - this.testSessionInfo, - sources.First(), - runSettings); - } - catch (InvalidOperationException ex) + // In case we have an active test session, we always prefer the already + // created proxies instead of the ones that need to be created on the spot. + var sources = testRunCriteria.HasSpecificTests + ? TestSourcesUtility.GetSources(testRunCriteria.Tests) + : testRunCriteria.Sources; + + this.proxyOperationManager = TestSessionPool.Instance.TakeProxy( + this.testSessionInfo, + sources.First(), + runSettings); + + if (this.proxyOperationManager == null) { // If the proxy creation process based on test session info failed, then // we'll proceed with the normal creation process as if no test session @@ -198,9 +196,7 @@ public virtual int StartTestRun(TestRunCriteria testRunCriteria, ITestRunEventsH // // WARNING: This should not normally happen and it raises questions // regarding the test session pool operation and consistency. - EqtTrace.Warning( - "ProxyDiscoveryManager creation with test session failed: {0}", - ex.ToString()); + EqtTrace.Warning("ProxyExecutionManager creation with test session failed."); this.proxyOperationManager = new ProxyOperationManager( this.backupRequestData, diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyOperationManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyOperationManager.cs index fc5d07cbf6..8444cc6411 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyOperationManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyOperationManager.cs @@ -151,6 +151,7 @@ public virtual bool SetupChannel( string runSettings, ITestMessageEventHandler eventHandler) { + // NOTE: Event handler is ignored here, but it is used in the overloaded method. return this.SetupChannel(sources, runSettings); } diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.cs.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.cs.xlf index 8daa2d861a..f3ca51b834 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.cs.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.cs.xlf @@ -157,6 +157,16 @@ Proxy s ID {0} je už k dispozici a nedá se znovu zařadit do fronty. + + No suitable test runtime provider found for this run. + No suitable test runtime provider found for this run. + + + + Could not find an available proxy to match the original run settings. + Could not find an available proxy to match the original run settings. + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.de.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.de.xlf index ae770775d9..a0e1bf469c 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.de.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.de.xlf @@ -157,6 +157,16 @@ Der Proxy mit der ID {0} ist bereits verfügbar und kann nicht erneut in die Warteschlange eingereiht werden. + + No suitable test runtime provider found for this run. + No suitable test runtime provider found for this run. + + + + Could not find an available proxy to match the original run settings. + Could not find an available proxy to match the original run settings. + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.es.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.es.xlf index 37a9ca613b..430b83c49f 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.es.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.es.xlf @@ -157,6 +157,16 @@ El proxy con el identificador {0} ya está disponible y no se puede volver a poner en cola. + + No suitable test runtime provider found for this run. + No suitable test runtime provider found for this run. + + + + Could not find an available proxy to match the original run settings. + Could not find an available proxy to match the original run settings. + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.fr.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.fr.xlf index 68f17b5385..e6aac2dabe 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.fr.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.fr.xlf @@ -157,6 +157,16 @@ Le proxy ayant l'ID {0} est déjà disponible et ne peut pas être empilé à nouveau. + + No suitable test runtime provider found for this run. + No suitable test runtime provider found for this run. + + + + Could not find an available proxy to match the original run settings. + Could not find an available proxy to match the original run settings. + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.it.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.it.xlf index ff566e5f5b..418d2eeed7 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.it.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.it.xlf @@ -157,6 +157,16 @@ Il proxy con ID {0} è già disponibile e non può essere riaccodato. + + No suitable test runtime provider found for this run. + No suitable test runtime provider found for this run. + + + + Could not find an available proxy to match the original run settings. + Could not find an available proxy to match the original run settings. + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ja.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ja.xlf index 09c4c63d8b..7f080dd8f6 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ja.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ja.xlf @@ -157,6 +157,16 @@ ID が {0} のプロキシは、既に使用可能になっているため、再度エンキューすることはできません。 + + No suitable test runtime provider found for this run. + No suitable test runtime provider found for this run. + + + + Could not find an available proxy to match the original run settings. + Could not find an available proxy to match the original run settings. + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ko.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ko.xlf index cfbb3628b0..26fda22065 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ko.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ko.xlf @@ -157,6 +157,16 @@ ID가 {0}인 프록시를 이미 사용할 수 있으며 큐에 다시 넣을 수 없습니다. + + No suitable test runtime provider found for this run. + No suitable test runtime provider found for this run. + + + + Could not find an available proxy to match the original run settings. + Could not find an available proxy to match the original run settings. + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.pl.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.pl.xlf index e4f0dde140..5eeb232cb4 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.pl.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.pl.xlf @@ -157,6 +157,16 @@ Serwer proxy o identyfikatorze {0} jest już dostępny i nie można go ponownie umieścić w kolejce. + + No suitable test runtime provider found for this run. + No suitable test runtime provider found for this run. + + + + Could not find an available proxy to match the original run settings. + Could not find an available proxy to match the original run settings. + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.pt-BR.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.pt-BR.xlf index 1778f2925c..44b39a80c8 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.pt-BR.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.pt-BR.xlf @@ -157,6 +157,16 @@ O proxy com a ID {0} já está disponível e não pode ser enfileirado novamente. + + No suitable test runtime provider found for this run. + No suitable test runtime provider found for this run. + + + + Could not find an available proxy to match the original run settings. + Could not find an available proxy to match the original run settings. + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ru.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ru.xlf index c8ae0e2a0a..2422c9dbf9 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ru.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ru.xlf @@ -157,6 +157,16 @@ Прокси-сервер с идентификатором {0} уже доступен и не может быть повторно поставлен в очередь. + + No suitable test runtime provider found for this run. + No suitable test runtime provider found for this run. + + + + Could not find an available proxy to match the original run settings. + Could not find an available proxy to match the original run settings. + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.tr.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.tr.xlf index 0bd92e7c0f..eb8b925a6b 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.tr.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.tr.xlf @@ -157,6 +157,16 @@ {0} kimliğine sahip ara sunucu zaten var ve yeniden kuyruğa alınamaz. + + No suitable test runtime provider found for this run. + No suitable test runtime provider found for this run. + + + + Could not find an available proxy to match the original run settings. + Could not find an available proxy to match the original run settings. + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.zh-Hans.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.zh-Hans.xlf index 5dc7ea0ba2..4a48f7a425 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.zh-Hans.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.zh-Hans.xlf @@ -157,6 +157,16 @@ ID 为 {0} 的代理已可用,无法重新排队。 + + No suitable test runtime provider found for this run. + No suitable test runtime provider found for this run. + + + + Could not find an available proxy to match the original run settings. + Could not find an available proxy to match the original run settings. + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.zh-Hant.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.zh-Hant.xlf index 71b24f022a..c214d5fb07 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.zh-Hant.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.zh-Hant.xlf @@ -157,6 +157,16 @@ 識別碼為 {0} 的 Proxy 已可供使用,但無法重新加入佇列。 + + No suitable test runtime provider found for this run. + No suitable test runtime provider found for this run. + + + + Could not find an available proxy to match the original run settings. + Could not find an available proxy to match the original run settings. + + \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/TestSession/ProxyTestSessionManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/TestSession/ProxyTestSessionManager.cs index 50d1f43464..56ae1a9af9 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/TestSession/ProxyTestSessionManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/TestSession/ProxyTestSessionManager.cs @@ -6,7 +6,6 @@ namespace Microsoft.VisualStudio.TestPlatform.CrossPlatEngine using System; using System.Collections.Generic; using System.Globalization; - using System.Linq; using System.Threading.Tasks; using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client; @@ -14,7 +13,7 @@ namespace Microsoft.VisualStudio.TestPlatform.CrossPlatEngine using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Engine; - using CrossPlatResources = Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Resources.Resources; + using CrossPlatResources = Resources.Resources; /// /// Orchestrates test session operations for the engine communicating with the client. @@ -23,6 +22,7 @@ public class ProxyTestSessionManager : IProxyTestSessionManager { private readonly object lockObject = new object(); private readonly object proxyOperationLockObject = new object(); + private volatile bool proxySetupFailed = false; private StartTestSessionCriteria testSessionCriteria; private int testhostCount; private TestSessionInfo testSessionInfo; @@ -51,20 +51,20 @@ public ProxyTestSessionManager( } /// - public void StartSession(ITestSessionEventsHandler eventsHandler) + public virtual bool StartSession(ITestSessionEventsHandler eventsHandler) { lock (this.lockObject) { if (this.testSessionInfo != null) { - return; + return false; } this.testSessionInfo = new TestSessionInfo(); } // Create all the proxies in parallel, one task per proxy. - var taskList = new Task[this.testhostCount]; - for (int i = 0; i < this.testhostCount; ++i) + var taskList = new Task[2 * this.testhostCount]; + for (int i = 0; i < taskList.Length; i += 2) { // The testhost count is equal to 1 because one of the following conditions // holds true: @@ -81,56 +81,59 @@ public void StartSession(ITestSessionEventsHandler eventsHandler) // create a list with a single element, i.e. the current source to be processed. var sources = (this.testhostCount == 1) ? this.testSessionCriteria.Sources - : new List() { this.testSessionCriteria.Sources[i] }; + : new List() { this.testSessionCriteria.Sources[i / 2] }; + + var task = Task.Factory.StartNew( + () => this.SetupRawProxy( + sources, + this.testSessionCriteria.RunSettings)); - taskList[i] = Task.Factory.StartNew(() => this.SetupRawProxy( - sources, - this.testSessionCriteria.RunSettings, - eventsHandler)); + taskList[i] = task; + taskList[i + 1] = task.ContinueWith(res => + { + if (!res.Result) + { + this.proxySetupFailed = true; + } + }); } // Wait for proxy creation to be over. Task.WaitAll(taskList); + // Dispose of all proxies if even one of them failed during setup. + if (this.proxySetupFailed) + { + this.DisposeProxies(); + return false; + } + // Make the session available. - TestSessionPool.Instance.AddSession(this.testSessionInfo, this); + if (!TestSessionPool.Instance.AddSession(this.testSessionInfo, this)) + { + this.DisposeProxies(); + return false; + } // Let the caller know the session has been created. eventsHandler.HandleStartTestSessionComplete(this.testSessionInfo); + return true; } /// - public void StopSession() + public virtual bool StopSession() { lock (this.lockObject) { if (this.testSessionInfo == null) { - return; + return false; } this.testSessionInfo = null; } - lock (this.proxyOperationLockObject) - { - // Dispose of all the proxies in parallel, one task per proxy. - int index = 0; - var taskList = new Task[this.proxyContainerList.Count]; - foreach (var proxyContainer in this.proxyContainerList) - { - taskList[index++] = Task.Factory.StartNew(() => - { - // Initiate the end session handshake with the underlying testhost. - proxyContainer.Proxy.Close(); - }); - } - - // Wait for proxy disposal to be over. - Task.WaitAll(taskList); - - this.proxyContainerList.Clear(); - this.proxyMap.Clear(); - } + this.DisposeProxies(); + return true; } /// @@ -141,7 +144,7 @@ public void StopSession() /// The run settings. /// /// The dequeued proxy. - public ProxyOperationManager DequeueProxy(string source, string runSettings) + public virtual ProxyOperationManager DequeueProxy(string source, string runSettings) { ProxyOperationManagerContainer proxyContainer = null; @@ -186,7 +189,9 @@ public ProxyOperationManager DequeueProxy(string source, string runSettings) /// /// /// The id of the proxy to be re-enqueued. - public void EnqueueProxy(int proxyId) + /// + /// True if the operation succeeded, false otherwise. + public virtual bool EnqueueProxy(int proxyId) { lock (this.proxyOperationLockObject) { @@ -214,6 +219,8 @@ public void EnqueueProxy(int proxyId) // Mark the proxy as available. proxyContainer.IsAvailable = true; } + + return true; } private int EnqueueNewProxy( @@ -239,10 +246,9 @@ private int EnqueueNewProxy( } } - private void SetupRawProxy( + private bool SetupRawProxy( IList sources, - string runSettings, - ITestSessionEventsHandler eventsHandler) + string runSettings) { try { @@ -250,17 +256,17 @@ private void SetupRawProxy( var operationManagerProxy = this.proxyCreator(); if (operationManagerProxy == null) { - return; + return false; } // Initialize the proxy. operationManagerProxy.Initialize(skipDefaultAdapters: false); // Start the test host associated to the proxy. - operationManagerProxy.SetupChannel( - sources, - runSettings, - eventsHandler); + if (!operationManagerProxy.SetupChannel(sources, runSettings)) + { + return false; + } // Associate each source in the source list with this new proxy operation // container. @@ -269,6 +275,7 @@ private void SetupRawProxy( available: true); operationManagerContainer.Proxy.Id = this.EnqueueNewProxy(sources, operationManagerContainer); + return true; } catch (Exception ex) { @@ -280,7 +287,37 @@ private void SetupRawProxy( EqtTrace.Error( "ProxyTestSessionManager.StartSession: Cannot create proxy. Error: {0}", ex.ToString()); - return; + } + + return false; + } + + private void DisposeProxies() + { + lock (this.proxyOperationLockObject) + { + if (this.proxyContainerList.Count == 0) + { + return; + } + + // Dispose of all the proxies in parallel, one task per proxy. + int i = 0; + var taskList = new Task[this.proxyContainerList.Count]; + foreach (var proxyContainer in this.proxyContainerList) + { + taskList[i++] = Task.Factory.StartNew(() => + { + // Initiate the end session handshake with the underlying testhost. + proxyContainer.Proxy.Close(); + }); + } + + // Wait for proxy disposal to be over. + Task.WaitAll(taskList); + + this.proxyContainerList.Clear(); + this.proxyMap.Clear(); } } } diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/TestSession/TestSessionPool.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/TestSession/TestSessionPool.cs index 772dab9903..1d40ee44fe 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/TestSession/TestSessionPool.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/TestSession/TestSessionPool.cs @@ -9,6 +9,7 @@ namespace Microsoft.VisualStudio.TestPlatform.CrossPlatEngine using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client; using Microsoft.VisualStudio.TestPlatform.ObjectModel; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client; + using Microsoft.VisualStudio.TestPlatform.ObjectModel.Engine; /// /// Represents the test session pool. @@ -24,13 +25,14 @@ public class TestSessionPool /// /// Initializes a new instance of the class. /// - private TestSessionPool() + internal TestSessionPool() { this.sessionPool = new Dictionary(); } /// /// Gets the test session pool instance. + /// Sets the test session pool instance for testing purposes only. /// /// /// Thread-safe singleton pattern. @@ -38,18 +40,22 @@ public static TestSessionPool Instance { get { - if (instance == null) + if (TestSessionPool.instance == null) { - lock (instanceLockObject) + lock (TestSessionPool.instanceLockObject) { - if (instance == null) + if (TestSessionPool.instance == null) { - instance = new TestSessionPool(); + TestSessionPool.instance = new TestSessionPool(); } } } - return instance; + return TestSessionPool.instance; + } + internal set + { + TestSessionPool.instance = value; } } @@ -61,7 +67,7 @@ public static TestSessionPool Instance /// The proxy manager object. /// /// True if the operation succeeded, false otherwise. - public bool AddSession( + public virtual bool AddSession( TestSessionInfo testSessionInfo, ProxyTestSessionManager proxyManager) { @@ -86,11 +92,11 @@ public bool AddSession( /// The test session info object. /// /// True if the operation succeeded, false otherwise. - public bool KillSession(TestSessionInfo testSessionInfo) + public virtual bool KillSession(TestSessionInfo testSessionInfo) { // TODO (copoiena): What happens if some request is running for the current session ? // Should we stop the request as well ? Probably yes. - ProxyTestSessionManager proxyManager = null; + IProxyTestSessionManager proxyManager = null; lock (this.lockObject) { @@ -106,8 +112,7 @@ public bool KillSession(TestSessionInfo testSessionInfo) } // Kill the session. - proxyManager.StopSession(); - return true; + return proxyManager.StopSession(); } /// @@ -119,7 +124,7 @@ public bool KillSession(TestSessionInfo testSessionInfo) /// The run settings. /// /// The proxy object. - public ProxyOperationManager TakeProxy( + public virtual ProxyOperationManager TakeProxy( TestSessionInfo testSessionInfo, string source, string runSettings) @@ -127,15 +132,31 @@ public ProxyOperationManager TakeProxy( ProxyTestSessionManager sessionManager = null; lock (this.lockObject) { + if (!this.sessionPool.ContainsKey(testSessionInfo)) + { + return null; + } + // Gets the session manager reference from the pool. sessionManager = this.sessionPool[testSessionInfo]; } - // Deque an actual proxy to do work. - // - // This can potentially throw, but let the caller handle this as it must recover from - // this error by creating its own proxy. - return sessionManager.DequeueProxy(source, runSettings); + try + { + // Deque an actual proxy to do work. + return sessionManager.DequeueProxy(source, runSettings); + } + catch (InvalidOperationException ex) + { + // If we are unable to dequeue the proxy we just eat up the exception here as + // it is safe to proceed. + // + // WARNING: This should not normally happen and it raises questions regarding the + // test session pool operation and consistency. + EqtTrace.Warning("TestSessionPool.ReturnProxy failed: {0}", ex.ToString()); + } + + return null; } /// @@ -144,11 +165,18 @@ public ProxyOperationManager TakeProxy( /// /// The test session info object. /// The proxy id to be returned. - public void ReturnProxy(TestSessionInfo testSessionInfo, int proxyId) + /// + /// True if the operation succeeded, false otherwise. + public virtual bool ReturnProxy(TestSessionInfo testSessionInfo, int proxyId) { ProxyTestSessionManager sessionManager = null; lock (this.lockObject) { + if (!this.sessionPool.ContainsKey(testSessionInfo)) + { + return false; + } + // Gets the session manager reference from the pool. sessionManager = this.sessionPool[testSessionInfo]; } @@ -156,7 +184,7 @@ public void ReturnProxy(TestSessionInfo testSessionInfo, int proxyId) try { // Try re-enqueueing the specified proxy. - sessionManager.EnqueueProxy(proxyId); + return sessionManager.EnqueueProxy(proxyId); } catch (InvalidOperationException ex) { @@ -167,6 +195,8 @@ public void ReturnProxy(TestSessionInfo testSessionInfo, int proxyId) // test session pool operation and consistency. EqtTrace.Warning("TestSessionPool.ReturnProxy failed: {0}", ex.ToString()); } + + return false; } } } diff --git a/src/Microsoft.TestPlatform.ObjectModel/Client/Interfaces/ITestPlatform.cs b/src/Microsoft.TestPlatform.ObjectModel/Client/Interfaces/ITestPlatform.cs index a842484b04..4f487a02f7 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Client/Interfaces/ITestPlatform.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/Client/Interfaces/ITestPlatform.cs @@ -68,7 +68,9 @@ ITestRunRequest CreateTestRunRequest( /// /// Specifies the start test session criteria. /// Events handler for handling session events. - void StartTestSession( + /// + /// True if the operation succeeded, false otherwise. + bool StartTestSession( IRequestData requestData, StartTestSessionCriteria criteria, ITestSessionEventsHandler eventsHandler); diff --git a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/net45/PublicAPI.Shipped.txt b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/net45/PublicAPI.Shipped.txt index c1ae6a08fb..9a14e14816 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/net45/PublicAPI.Shipped.txt +++ b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/net45/PublicAPI.Shipped.txt @@ -244,7 +244,6 @@ Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform.ClearExtensions() -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform.CreateDiscoveryRequest(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IRequestData requestData, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria discoveryCriteria, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestPlatformOptions options) -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IDiscoveryRequest Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform.CreateTestRunRequest(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IRequestData requestData, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestRunCriteria testRunCriteria, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestPlatformOptions options) -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestRunRequest -Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform.StartTestSession(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IRequestData requestData, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.StartTestSessionCriteria criteria, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestSessionEventsHandler eventsHandler) -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform.UpdateExtensions(System.Collections.Generic.IEnumerable pathToAdditionalExtensions, bool skipExtensionFilters) -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatformCapabilities Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatformCapabilities.TestPlatformType.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestPlatformType diff --git a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/net45/PublicAPI.Unshipped.txt b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/net45/PublicAPI.Unshipped.txt index 0ccec4f450..c8a84264e2 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/net45/PublicAPI.Unshipped.txt +++ b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/net45/PublicAPI.Unshipped.txt @@ -2,4 +2,5 @@ Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.TestSessionInfo.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.TestSessionInfo.set -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryRequestPayload.TestSessionInfo.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo -Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryRequestPayload.TestSessionInfo.set -> void \ No newline at end of file +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryRequestPayload.TestSessionInfo.set -> void +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform.StartTestSession(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IRequestData requestData, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.StartTestSessionCriteria criteria, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestSessionEventsHandler eventsHandler) -> bool \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/net451/PublicAPI.Shipped.txt b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/net451/PublicAPI.Shipped.txt index c1ae6a08fb..9a14e14816 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/net451/PublicAPI.Shipped.txt +++ b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/net451/PublicAPI.Shipped.txt @@ -244,7 +244,6 @@ Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform.ClearExtensions() -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform.CreateDiscoveryRequest(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IRequestData requestData, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria discoveryCriteria, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestPlatformOptions options) -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IDiscoveryRequest Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform.CreateTestRunRequest(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IRequestData requestData, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestRunCriteria testRunCriteria, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestPlatformOptions options) -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestRunRequest -Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform.StartTestSession(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IRequestData requestData, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.StartTestSessionCriteria criteria, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestSessionEventsHandler eventsHandler) -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform.UpdateExtensions(System.Collections.Generic.IEnumerable pathToAdditionalExtensions, bool skipExtensionFilters) -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatformCapabilities Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatformCapabilities.TestPlatformType.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestPlatformType diff --git a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/net451/PublicAPI.Unshipped.txt b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/net451/PublicAPI.Unshipped.txt index 0ccec4f450..c8a84264e2 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/net451/PublicAPI.Unshipped.txt +++ b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/net451/PublicAPI.Unshipped.txt @@ -2,4 +2,5 @@ Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.TestSessionInfo.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.TestSessionInfo.set -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryRequestPayload.TestSessionInfo.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo -Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryRequestPayload.TestSessionInfo.set -> void \ No newline at end of file +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryRequestPayload.TestSessionInfo.set -> void +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform.StartTestSession(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IRequestData requestData, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.StartTestSessionCriteria criteria, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestSessionEventsHandler eventsHandler) -> bool \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/net6.0/PublicAPI.Unshipped.txt b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/net6.0/PublicAPI.Unshipped.txt index 0ccec4f450..c8a84264e2 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/net6.0/PublicAPI.Unshipped.txt +++ b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/net6.0/PublicAPI.Unshipped.txt @@ -2,4 +2,5 @@ Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.TestSessionInfo.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.TestSessionInfo.set -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryRequestPayload.TestSessionInfo.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo -Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryRequestPayload.TestSessionInfo.set -> void \ No newline at end of file +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryRequestPayload.TestSessionInfo.set -> void +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform.StartTestSession(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IRequestData requestData, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.StartTestSessionCriteria criteria, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestSessionEventsHandler eventsHandler) -> bool \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netcoreapp1.0/PublicAPI.Shipped.txt b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netcoreapp1.0/PublicAPI.Shipped.txt index a694084129..af2c37b993 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netcoreapp1.0/PublicAPI.Shipped.txt +++ b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netcoreapp1.0/PublicAPI.Shipped.txt @@ -242,7 +242,6 @@ Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform.ClearExtensions() -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform.CreateDiscoveryRequest(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IRequestData requestData, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria discoveryCriteria, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestPlatformOptions options) -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IDiscoveryRequest Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform.CreateTestRunRequest(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IRequestData requestData, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestRunCriteria testRunCriteria, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestPlatformOptions options) -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestRunRequest -Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform.StartTestSession(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IRequestData requestData, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.StartTestSessionCriteria criteria, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestSessionEventsHandler eventsHandler) -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform.UpdateExtensions(System.Collections.Generic.IEnumerable pathToAdditionalExtensions, bool skipExtensionFilters) -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatformCapabilities Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatformCapabilities.TestPlatformType.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestPlatformType diff --git a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netcoreapp1.0/PublicAPI.Unshipped.txt b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netcoreapp1.0/PublicAPI.Unshipped.txt index 0ccec4f450..c8a84264e2 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netcoreapp1.0/PublicAPI.Unshipped.txt +++ b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netcoreapp1.0/PublicAPI.Unshipped.txt @@ -2,4 +2,5 @@ Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.TestSessionInfo.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.TestSessionInfo.set -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryRequestPayload.TestSessionInfo.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo -Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryRequestPayload.TestSessionInfo.set -> void \ No newline at end of file +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryRequestPayload.TestSessionInfo.set -> void +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform.StartTestSession(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IRequestData requestData, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.StartTestSessionCriteria criteria, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestSessionEventsHandler eventsHandler) -> bool \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netcoreapp2.1/PublicAPI.Shipped.txt b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netcoreapp2.1/PublicAPI.Shipped.txt index a694084129..af2c37b993 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netcoreapp2.1/PublicAPI.Shipped.txt +++ b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netcoreapp2.1/PublicAPI.Shipped.txt @@ -242,7 +242,6 @@ Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform.ClearExtensions() -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform.CreateDiscoveryRequest(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IRequestData requestData, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria discoveryCriteria, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestPlatformOptions options) -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IDiscoveryRequest Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform.CreateTestRunRequest(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IRequestData requestData, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestRunCriteria testRunCriteria, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestPlatformOptions options) -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestRunRequest -Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform.StartTestSession(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IRequestData requestData, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.StartTestSessionCriteria criteria, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestSessionEventsHandler eventsHandler) -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform.UpdateExtensions(System.Collections.Generic.IEnumerable pathToAdditionalExtensions, bool skipExtensionFilters) -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatformCapabilities Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatformCapabilities.TestPlatformType.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestPlatformType diff --git a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netcoreapp2.1/PublicAPI.Unshipped.txt b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netcoreapp2.1/PublicAPI.Unshipped.txt index 0ccec4f450..c8a84264e2 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netcoreapp2.1/PublicAPI.Unshipped.txt +++ b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netcoreapp2.1/PublicAPI.Unshipped.txt @@ -2,4 +2,5 @@ Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.TestSessionInfo.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.TestSessionInfo.set -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryRequestPayload.TestSessionInfo.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo -Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryRequestPayload.TestSessionInfo.set -> void \ No newline at end of file +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryRequestPayload.TestSessionInfo.set -> void +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform.StartTestSession(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IRequestData requestData, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.StartTestSessionCriteria criteria, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestSessionEventsHandler eventsHandler) -> bool \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netstandard1.0/PublicAPI.Shipped.txt b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netstandard1.0/PublicAPI.Shipped.txt index 1b43bbf9d5..f695feed79 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netstandard1.0/PublicAPI.Shipped.txt +++ b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netstandard1.0/PublicAPI.Shipped.txt @@ -228,7 +228,6 @@ Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform.ClearExtensions() -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform.CreateDiscoveryRequest(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IRequestData requestData, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria discoveryCriteria, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestPlatformOptions options) -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IDiscoveryRequest Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform.CreateTestRunRequest(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IRequestData requestData, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestRunCriteria testRunCriteria, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestPlatformOptions options) -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestRunRequest -Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform.StartTestSession(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IRequestData requestData, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.StartTestSessionCriteria criteria, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestSessionEventsHandler eventsHandler) -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform.UpdateExtensions(System.Collections.Generic.IEnumerable pathToAdditionalExtensions, bool skipExtensionFilters) -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatformCapabilities Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatformCapabilities.TestPlatformType.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestPlatformType diff --git a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netstandard1.0/PublicAPI.Unshipped.txt b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netstandard1.0/PublicAPI.Unshipped.txt index 0ccec4f450..c8a84264e2 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netstandard1.0/PublicAPI.Unshipped.txt +++ b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netstandard1.0/PublicAPI.Unshipped.txt @@ -2,4 +2,5 @@ Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.TestSessionInfo.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.TestSessionInfo.set -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryRequestPayload.TestSessionInfo.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo -Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryRequestPayload.TestSessionInfo.set -> void \ No newline at end of file +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryRequestPayload.TestSessionInfo.set -> void +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform.StartTestSession(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IRequestData requestData, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.StartTestSessionCriteria criteria, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestSessionEventsHandler eventsHandler) -> bool \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netstandard1.3/PublicAPI.Shipped.txt b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netstandard1.3/PublicAPI.Shipped.txt index a694084129..af2c37b993 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netstandard1.3/PublicAPI.Shipped.txt +++ b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netstandard1.3/PublicAPI.Shipped.txt @@ -242,7 +242,6 @@ Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform.ClearExtensions() -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform.CreateDiscoveryRequest(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IRequestData requestData, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria discoveryCriteria, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestPlatformOptions options) -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IDiscoveryRequest Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform.CreateTestRunRequest(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IRequestData requestData, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestRunCriteria testRunCriteria, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestPlatformOptions options) -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestRunRequest -Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform.StartTestSession(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IRequestData requestData, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.StartTestSessionCriteria criteria, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestSessionEventsHandler eventsHandler) -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform.UpdateExtensions(System.Collections.Generic.IEnumerable pathToAdditionalExtensions, bool skipExtensionFilters) -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatformCapabilities Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatformCapabilities.TestPlatformType.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestPlatformType diff --git a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netstandard1.3/PublicAPI.Unshipped.txt b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netstandard1.3/PublicAPI.Unshipped.txt index 0ccec4f450..c8a84264e2 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netstandard1.3/PublicAPI.Unshipped.txt +++ b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netstandard1.3/PublicAPI.Unshipped.txt @@ -2,4 +2,5 @@ Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.TestSessionInfo.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.TestSessionInfo.set -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryRequestPayload.TestSessionInfo.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo -Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryRequestPayload.TestSessionInfo.set -> void \ No newline at end of file +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryRequestPayload.TestSessionInfo.set -> void +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform.StartTestSession(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IRequestData requestData, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.StartTestSessionCriteria criteria, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestSessionEventsHandler eventsHandler) -> bool \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netstandard2.0/PublicAPI.Shipped.txt b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netstandard2.0/PublicAPI.Shipped.txt index a694084129..af2c37b993 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netstandard2.0/PublicAPI.Shipped.txt +++ b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netstandard2.0/PublicAPI.Shipped.txt @@ -242,7 +242,6 @@ Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform.ClearExtensions() -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform.CreateDiscoveryRequest(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IRequestData requestData, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria discoveryCriteria, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestPlatformOptions options) -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IDiscoveryRequest Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform.CreateTestRunRequest(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IRequestData requestData, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestRunCriteria testRunCriteria, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestPlatformOptions options) -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestRunRequest -Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform.StartTestSession(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IRequestData requestData, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.StartTestSessionCriteria criteria, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestSessionEventsHandler eventsHandler) -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform.UpdateExtensions(System.Collections.Generic.IEnumerable pathToAdditionalExtensions, bool skipExtensionFilters) -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatformCapabilities Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatformCapabilities.TestPlatformType.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestPlatformType diff --git a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt index 0ccec4f450..c8a84264e2 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt +++ b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt @@ -2,4 +2,5 @@ Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.TestSessionInfo.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.TestSessionInfo.set -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryRequestPayload.TestSessionInfo.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo -Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryRequestPayload.TestSessionInfo.set -> void \ No newline at end of file +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryRequestPayload.TestSessionInfo.set -> void +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform.StartTestSession(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IRequestData requestData, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.StartTestSessionCriteria criteria, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestSessionEventsHandler eventsHandler) -> bool \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/uap10.0/PublicAPI.Shipped.txt b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/uap10.0/PublicAPI.Shipped.txt index 64fc3fbd10..814958cfeb 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/uap10.0/PublicAPI.Shipped.txt +++ b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/uap10.0/PublicAPI.Shipped.txt @@ -242,7 +242,6 @@ Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform.ClearExtensions() -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform.CreateDiscoveryRequest(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IRequestData requestData, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria discoveryCriteria, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestPlatformOptions options) -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IDiscoveryRequest Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform.CreateTestRunRequest(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IRequestData requestData, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestRunCriteria testRunCriteria, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestPlatformOptions options) -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestRunRequest -Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform.StartTestSession(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IRequestData requestData, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.StartTestSessionCriteria criteria, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestSessionEventsHandler eventsHandler) -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform.UpdateExtensions(System.Collections.Generic.IEnumerable pathToAdditionalExtensions, bool skipExtensionFilters) -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatformCapabilities Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatformCapabilities.TestPlatformType.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestPlatformType diff --git a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/uap10.0/PublicAPI.Unshipped.txt b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/uap10.0/PublicAPI.Unshipped.txt index 0ccec4f450..c8a84264e2 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/uap10.0/PublicAPI.Unshipped.txt +++ b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/uap10.0/PublicAPI.Unshipped.txt @@ -2,4 +2,5 @@ Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.TestSessionInfo.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.TestSessionInfo.set -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryRequestPayload.TestSessionInfo.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo -Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryRequestPayload.TestSessionInfo.set -> void \ No newline at end of file +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryRequestPayload.TestSessionInfo.set -> void +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform.StartTestSession(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IRequestData requestData, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.StartTestSessionCriteria criteria, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestSessionEventsHandler eventsHandler) -> bool \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSession.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSession.cs index c7e174d722..965e7f6178 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSession.cs +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSession.cs @@ -16,6 +16,11 @@ namespace Microsoft.VisualStudio.TestPlatform.VsTestConsole.TranslationLayer.Int /// public interface ITestSession : IDisposable, ITestSessionAsync { + /// + /// Gets the underlying test session info object. + /// + TestSessionInfo TestSessionInfo { get; } + /// /// Starts test discovery. /// diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/TestSession.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/TestSession.cs index c5f80812ed..483fed2450 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/TestSession.cs +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/TestSession.cs @@ -21,10 +21,14 @@ public class TestSession : ITestSession { private bool disposed = false; - private TestSessionInfo testSessionInfo; private readonly ITestSessionEventsHandler eventsHandler; private readonly IVsTestConsoleWrapper consoleWrapper; + #region Properties + /// + public TestSessionInfo TestSessionInfo { get; private set; } + #endregion + #region Constructors /// /// Initializes a new instance of the class. @@ -38,7 +42,7 @@ public TestSession( ITestSessionEventsHandler eventsHandler, IVsTestConsoleWrapper consoleWrapper) { - this.testSessionInfo = testSessionInfo; + this.TestSessionInfo = testSessionInfo; this.eventsHandler = eventsHandler; this.consoleWrapper = consoleWrapper; } @@ -117,7 +121,7 @@ public void DiscoverTests( sources, discoverySettings, options, - this.testSessionInfo, + this.TestSessionInfo, discoveryEventsHandler); } @@ -145,7 +149,7 @@ public void RunTests( sources, runSettings, options, - this.testSessionInfo, + this.TestSessionInfo, testRunEventsHandler); } @@ -173,7 +177,7 @@ public void RunTests( testCases, runSettings, options, - this.testSessionInfo, + this.TestSessionInfo, testRunEventsHandler); } @@ -204,7 +208,7 @@ public void RunTestsWithCustomTestHost( sources, runSettings, options, - this.testSessionInfo, + this.TestSessionInfo, testRunEventsHandler, customTestHostLauncher); } @@ -236,7 +240,7 @@ public void RunTestsWithCustomTestHost( testCases, runSettings, options, - this.testSessionInfo, + this.TestSessionInfo, testRunEventsHandler, customTestHostLauncher); } @@ -250,7 +254,7 @@ public bool StopTestSession() /// public bool StopTestSession(ITestSessionEventsHandler eventsHandler) { - if (this.testSessionInfo == null) + if (this.TestSessionInfo == null) { return true; } @@ -258,12 +262,12 @@ public bool StopTestSession(ITestSessionEventsHandler eventsHandler) try { return this.consoleWrapper.StopTestSession( - this.testSessionInfo, + this.TestSessionInfo, eventsHandler); } finally { - this.testSessionInfo = null; + this.TestSessionInfo = null; } } #endregion @@ -295,7 +299,7 @@ await this.consoleWrapper.DiscoverTestsAsync( sources, discoverySettings, options, - this.testSessionInfo, + this.TestSessionInfo, discoveryEventsHandler).ConfigureAwait(false); } @@ -323,7 +327,7 @@ await this.consoleWrapper.RunTestsAsync( sources, runSettings, options, - this.testSessionInfo, + this.TestSessionInfo, testRunEventsHandler).ConfigureAwait(false); } @@ -351,7 +355,7 @@ await this.consoleWrapper.RunTestsAsync( testCases, runSettings, options, - this.testSessionInfo, + this.TestSessionInfo, testRunEventsHandler).ConfigureAwait(false); } @@ -382,7 +386,7 @@ await this.consoleWrapper.RunTestsWithCustomTestHostAsync( sources, runSettings, options, - this.testSessionInfo, + this.TestSessionInfo, testRunEventsHandler, customTestHostLauncher).ConfigureAwait(false); } @@ -414,7 +418,7 @@ await this.consoleWrapper.RunTestsWithCustomTestHostAsync( testCases, runSettings, options, - this.testSessionInfo, + this.TestSessionInfo, testRunEventsHandler, customTestHostLauncher).ConfigureAwait(false); } @@ -428,7 +432,7 @@ public async Task StopTestSessionAsync() /// public async Task StopTestSessionAsync(ITestSessionEventsHandler eventsHandler) { - if (this.testSessionInfo == null) + if (this.TestSessionInfo == null) { return true; } @@ -436,12 +440,12 @@ public async Task StopTestSessionAsync(ITestSessionEventsHandler eventsHan try { return await this.consoleWrapper.StopTestSessionAsync( - this.testSessionInfo, + this.TestSessionInfo, eventsHandler).ConfigureAwait(false); } finally { - this.testSessionInfo = null; + this.TestSessionInfo = null; } } #endregion diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleWrapper.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleWrapper.cs index 9d0670652b..99104f8fc6 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleWrapper.cs +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleWrapper.cs @@ -598,7 +598,7 @@ public async Task StartTestSessionAsync( return await this.StartTestSessionAsync( sources, runSettings, - options: null, + options, eventsHandler, testHostLauncher: null).ConfigureAwait(false); } diff --git a/src/vstest.console/TestPlatformHelpers/TestRequestManager.cs b/src/vstest.console/TestPlatformHelpers/TestRequestManager.cs index 8c9291568d..90b55dff2a 100644 --- a/src/vstest.console/TestPlatformHelpers/TestRequestManager.cs +++ b/src/vstest.console/TestPlatformHelpers/TestRequestManager.cs @@ -474,7 +474,10 @@ public void StartTestSession( TestHostLauncher = testHostLauncher }; - this.testPlatform.StartTestSession(requestData, criteria, eventsHandler); + if (!this.testPlatform.StartTestSession(requestData, criteria, eventsHandler)) + { + EqtTrace.Warning("TestRequestManager.StartTestSession: Unable to start test session."); + } } finally { diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyTestSessionManagerTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyTestSessionManagerTests.cs new file mode 100644 index 0000000000..d8764eb2c3 --- /dev/null +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyTestSessionManagerTests.cs @@ -0,0 +1,335 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +namespace Microsoft.TestPlatform.CrossPlatEngine.UnitTests.Client +{ + using System; + using System.Collections.Generic; + + using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine; + using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client; + using Microsoft.VisualStudio.TestPlatform.ObjectModel; + using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client; + using Microsoft.VisualStudio.TestTools.UnitTesting; + + using Moq; + + [TestClass] + public class ProxyTestSessionManagerTests + { + private readonly IList fakeTestSources = new List() { @"C:\temp\FakeTestAsset.dll" }; + private readonly IList fakeTestMultipleSources = new List() { + @"C:\temp\FakeTestAsset1.dll", + @"C:\temp\FakeTestAsset2.dll", + @"C:\temp\FakeTestAsset3.dll", + @"C:\temp\FakeTestAsset4.dll", + @"C:\temp\FakeTestAsset5.dll", + @"C:\temp\FakeTestAsset6.dll", + @"C:\temp\FakeTestAsset7.dll", + @"C:\temp\FakeTestAsset8.dll", + }; + private readonly string fakeRunSettings = "FakeRunSettings"; + private Mock mockEventsHandler; + + [TestInitialize] + public void TestInitialize() + { + TestSessionPool.Instance = null; + + this.mockEventsHandler = new Mock(); + + this.mockEventsHandler.Setup(e => e.HandleStartTestSessionComplete(It.IsAny())) + .Callback((TestSessionInfo tsi) => { }); + } + + [TestMethod] + public void StartSessionShouldSucceedIfCalledOnlyOnce() + { + var mockProxyOperationManager = new Mock(null, null, null); + mockProxyOperationManager.Setup(pom => pom.SetupChannel(It.IsAny>(), It.IsAny())) + .Returns(true); + + var testSessionCriteria = this.CreateTestSession(this.fakeTestSources, this.fakeRunSettings); + var proxyManager = this.CreateProxy(testSessionCriteria, mockProxyOperationManager.Object); + + // First call to StartSession should succeed. + Assert.IsTrue(proxyManager.StartSession(this.mockEventsHandler.Object)); + mockProxyOperationManager.Verify(pom => pom.SetupChannel( + testSessionCriteria.Sources, + testSessionCriteria.RunSettings), + Times.Once); + this.mockEventsHandler.Verify(eh => eh.HandleStartTestSessionComplete( + It.IsAny()), + Times.Once); + + // Second call to StartSession should fail. + Assert.IsFalse(proxyManager.StartSession(this.mockEventsHandler.Object)); + mockProxyOperationManager.Verify(pom => pom.SetupChannel( + testSessionCriteria.Sources, + testSessionCriteria.RunSettings), + Times.Once); + this.mockEventsHandler.Verify(eh => eh.HandleStartTestSessionComplete( + It.IsAny()), + Times.Once); + } + + [TestMethod] + public void StartSessionShouldSucceedWhenCalledWithMultipleSources() + { + var mockProxyOperationManager = new Mock(null, null, null); + mockProxyOperationManager.Setup(pom => pom.SetupChannel(It.IsAny>(), It.IsAny())) + .Returns(true); + + var testSessionCriteria = this.CreateTestSession(this.fakeTestMultipleSources, this.fakeRunSettings); + var proxyManager = this.CreateProxy(testSessionCriteria, mockProxyOperationManager.Object); + + // First call to StartSession should succeed. + Assert.IsTrue(proxyManager.StartSession(this.mockEventsHandler.Object)); + mockProxyOperationManager.Verify(pom => pom.SetupChannel( + It.IsAny>(), + testSessionCriteria.RunSettings), + Times.Exactly(this.fakeTestMultipleSources.Count)); + this.mockEventsHandler.Verify(eh => eh.HandleStartTestSessionComplete( + It.IsAny()), + Times.Once); + } + + [TestMethod] + public void StartSessionShouldFailIfProxyCreatorIsNull() + { + var testSessionCriteria = this.CreateTestSession(this.fakeTestSources, this.fakeRunSettings); + var proxyManager = this.CreateProxy(testSessionCriteria, null); + + Assert.IsFalse(proxyManager.StartSession(this.mockEventsHandler.Object)); + this.mockEventsHandler.Verify(eh => eh.HandleStartTestSessionComplete( + It.IsAny()), + Times.Never); + } + + [TestMethod] + public void StartSessionShouldFailIfSetupChannelReturnsFalse() + { + var mockProxyOperationManager = new Mock(null, null, null); + mockProxyOperationManager.Setup(pom => pom.SetupChannel(It.IsAny>(), It.IsAny())) + .Returns(false); + mockProxyOperationManager.Setup(pom => pom.Close()).Callback(() => { }); + + var testSessionCriteria = this.CreateTestSession(this.fakeTestSources, this.fakeRunSettings); + var proxyManager = this.CreateProxy(testSessionCriteria, mockProxyOperationManager.Object); + + // Call fails because SetupChannel returns false. + Assert.IsFalse(proxyManager.StartSession(this.mockEventsHandler.Object)); + mockProxyOperationManager.Verify(pom => pom.SetupChannel( + It.IsAny>(), + It.IsAny()), + Times.Once); + mockProxyOperationManager.Verify(pom => pom.Close(), Times.Never); + this.mockEventsHandler.Verify(eh => eh.HandleStartTestSessionComplete( + It.IsAny()), + Times.Never); + } + + [TestMethod] + public void StartSessionShouldFailIfSetupChannelThrowsException() + { + var mockProxyOperationManager = new Mock(null, null, null); + mockProxyOperationManager.Setup(pom => pom.SetupChannel(It.IsAny>(), It.IsAny())) + .Throws(new TestPlatformException("Dummy exception.")); + mockProxyOperationManager.Setup(pom => pom.Close()).Callback(() => { }); + + var testSessionCriteria = this.CreateTestSession(this.fakeTestSources, this.fakeRunSettings); + var proxyManager = this.CreateProxy(testSessionCriteria, mockProxyOperationManager.Object); + + // Call fails because SetupChannel returns false. + Assert.IsFalse(proxyManager.StartSession(this.mockEventsHandler.Object)); + mockProxyOperationManager.Verify(pom => pom.SetupChannel( + It.IsAny>(), + It.IsAny()), + Times.Once); + mockProxyOperationManager.Verify(pom => pom.Close(), Times.Never); + this.mockEventsHandler.Verify(eh => eh.HandleStartTestSessionComplete( + It.IsAny()), + Times.Never); + } + + [TestMethod] + public void StartSessionShouldFailIfAddSessionFails() + { + var mockTestSessionPool = new Mock(); + mockTestSessionPool.Setup(tsp => tsp.AddSession(It.IsAny(), It.IsAny())) + .Returns(false); + TestSessionPool.Instance = mockTestSessionPool.Object; + + var mockProxyOperationManager = new Mock(null, null, null); + mockProxyOperationManager.Setup(pom => pom.SetupChannel(It.IsAny>(), It.IsAny())) + .Returns(true); + mockProxyOperationManager.Setup(pom => pom.Close()).Callback(() => { }); + + var testSessionCriteria = this.CreateTestSession(this.fakeTestSources, this.fakeRunSettings); + var proxyManager = this.CreateProxy(testSessionCriteria, mockProxyOperationManager.Object); + + // Call to StartSession should fail because AddSession fails. + Assert.IsFalse(proxyManager.StartSession(this.mockEventsHandler.Object)); + mockProxyOperationManager.Verify(pom => pom.SetupChannel( + testSessionCriteria.Sources, + testSessionCriteria.RunSettings), + Times.Once); + mockProxyOperationManager.Verify(pom => pom.Close(), Times.Once); + this.mockEventsHandler.Verify(eh => eh.HandleStartTestSessionComplete( + It.IsAny()), + Times.Never); + } + + [TestMethod] + public void StopSessionShouldSucceedIfCalledOnlyOnce() + { + var mockProxyOperationManager = new Mock(null, null, null); + mockProxyOperationManager.Setup(pom => pom.SetupChannel(It.IsAny>(), It.IsAny())) + .Returns(true); + mockProxyOperationManager.Setup(pom => pom.Close()).Callback(() => { }); + + var testSessionCriteria = this.CreateTestSession(this.fakeTestSources, this.fakeRunSettings); + var proxyManager = this.CreateProxy(testSessionCriteria, mockProxyOperationManager.Object); + + // StartSession should succeed. + Assert.IsTrue(proxyManager.StartSession(this.mockEventsHandler.Object)); + mockProxyOperationManager.Verify(pom => pom.SetupChannel( + testSessionCriteria.Sources, + testSessionCriteria.RunSettings), + Times.Once); + this.mockEventsHandler.Verify(eh => eh.HandleStartTestSessionComplete( + It.IsAny()), + Times.Once); + + // First call to StopSession should succeed. + Assert.IsTrue(proxyManager.StopSession()); + mockProxyOperationManager.Verify(pom => pom.Close(), Times.Once); + + // Second call to StopSession should fail. + Assert.IsFalse(proxyManager.StopSession()); + mockProxyOperationManager.Verify(pom => pom.Close(), Times.Once); + } + + [TestMethod] + public void StopSessionShouldSucceedWhenCalledWithMultipleSources() + { + var mockProxyOperationManager = new Mock(null, null, null); + mockProxyOperationManager.Setup(pom => pom.SetupChannel(It.IsAny>(), It.IsAny())) + .Returns(true); + mockProxyOperationManager.Setup(pom => pom.Close()).Callback(() => { }); + + var testSessionCriteria = this.CreateTestSession(this.fakeTestMultipleSources, this.fakeRunSettings); + var proxyManager = this.CreateProxy(testSessionCriteria, mockProxyOperationManager.Object); + + // StartSession should succeed. + Assert.IsTrue(proxyManager.StartSession(this.mockEventsHandler.Object)); + mockProxyOperationManager.Verify(pom => pom.SetupChannel( + It.IsAny>(), + testSessionCriteria.RunSettings), + Times.Exactly(testSessionCriteria.Sources.Count)); + this.mockEventsHandler.Verify(eh => eh.HandleStartTestSessionComplete( + It.IsAny()), + Times.Once); + + // First call to StopSession should succeed. + Assert.IsTrue(proxyManager.StopSession()); + mockProxyOperationManager.Verify(pom => pom.Close(), Times.Exactly(testSessionCriteria.Sources.Count)); + } + + [TestMethod] + public void DequeueProxyShouldSucceedIfIdentificationCriteriaAreMet() + { + var mockProxyOperationManager = new Mock(null, null, null); + mockProxyOperationManager.Setup(pom => pom.SetupChannel(It.IsAny>(), It.IsAny())) + .Returns(true); + + var testSessionCriteria = this.CreateTestSession(this.fakeTestSources, this.fakeRunSettings); + var proxyManager = this.CreateProxy(testSessionCriteria, mockProxyOperationManager.Object); + + // StartSession should succeed. + Assert.IsTrue(proxyManager.StartSession(this.mockEventsHandler.Object)); + mockProxyOperationManager.Verify(pom => pom.SetupChannel( + It.IsAny>(), + testSessionCriteria.RunSettings), + Times.Exactly(testSessionCriteria.Sources.Count)); + this.mockEventsHandler.Verify(eh => eh.HandleStartTestSessionComplete( + It.IsAny()), + Times.Once); + + // First call to DequeueProxy fails because of source mismatch. + Assert.ThrowsException(() => proxyManager.DequeueProxy( + @"C:\temp\FakeTestAsset2.dll", + testSessionCriteria.RunSettings)); + + // Second call to DequeueProxy fails because of runsettings mismatch. + Assert.ThrowsException(() => proxyManager.DequeueProxy( + testSessionCriteria.Sources[0], + "DummyRunSettings")); + + // Third call to DequeueProxy succeeds. + Assert.AreEqual(proxyManager.DequeueProxy( + testSessionCriteria.Sources[0], + testSessionCriteria.RunSettings), + mockProxyOperationManager.Object); + + // Fourth call to DequeueProxy fails because proxy became unavailable following successful deque. + Assert.ThrowsException(() => proxyManager.DequeueProxy( + testSessionCriteria.Sources[0], + testSessionCriteria.RunSettings)); + } + + [TestMethod] + public void EnqueueProxyShouldSucceedIfIdentificationCriteriaAreMet() + { + var mockProxyOperationManager = new Mock(null, null, null); + mockProxyOperationManager.Setup(pom => pom.SetupChannel(It.IsAny>(), It.IsAny())) + .Returns(true); + + var testSessionCriteria = this.CreateTestSession(this.fakeTestSources, this.fakeRunSettings); + var proxyManager = this.CreateProxy(testSessionCriteria, mockProxyOperationManager.Object); + + // Validate sanity checks. + Assert.ThrowsException(() => proxyManager.EnqueueProxy(-1)); + Assert.ThrowsException(() => proxyManager.EnqueueProxy(1)); + + // StartSession should succeed. + Assert.IsTrue(proxyManager.StartSession(this.mockEventsHandler.Object)); + mockProxyOperationManager.Verify(pom => pom.SetupChannel( + It.IsAny>(), + testSessionCriteria.RunSettings), + Times.Exactly(testSessionCriteria.Sources.Count)); + this.mockEventsHandler.Verify(eh => eh.HandleStartTestSessionComplete( + It.IsAny()), + Times.Once); + + // Call throws exception because proxy is already available. + Assert.ThrowsException(() => proxyManager.EnqueueProxy(0)); + + // Call succeeds. + Assert.AreEqual(proxyManager.DequeueProxy( + testSessionCriteria.Sources[0], + testSessionCriteria.RunSettings), + mockProxyOperationManager.Object); + Assert.IsTrue(proxyManager.EnqueueProxy(0)); + } + + private StartTestSessionCriteria CreateTestSession(IList sources, string runSettings) + { + return new StartTestSessionCriteria() + { + Sources = sources, + RunSettings = runSettings + }; + } + + private ProxyTestSessionManager CreateProxy( + StartTestSessionCriteria testSessionCriteria, + ProxyOperationManager proxyOperationManager) + { + return new ProxyTestSessionManager( + testSessionCriteria, + testSessionCriteria.Sources.Count, + () => { return proxyOperationManager; }); + } + } +} diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/TestSession/TestSessionPoolTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/TestSession/TestSessionPoolTests.cs new file mode 100644 index 0000000000..ed055b51d2 --- /dev/null +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/TestSession/TestSessionPoolTests.cs @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +namespace Microsoft.TestPlatform.CrossPlatEngine.UnitTests.TestSession +{ + using System; + + using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine; + using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client; + using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client; + using Microsoft.VisualStudio.TestTools.UnitTesting; + + using Moq; + + [TestClass] + public class TestSessionPoolTests + { + [TestMethod] + public void AddSessionShouldSucceedIfTestSessionInfoIsUnique() + { + TestSessionPool.Instance = null; + + var testSessionInfo = new TestSessionInfo(); + var proxyTestSessionManager = new ProxyTestSessionManager( + new StartTestSessionCriteria(), + 1, + () => { return null; }); + + Assert.IsTrue(TestSessionPool.Instance.AddSession(testSessionInfo, proxyTestSessionManager)); + Assert.IsFalse(TestSessionPool.Instance.AddSession(testSessionInfo, proxyTestSessionManager)); + } + + [TestMethod] + public void KillSessionShouldSucceedIfTestSessionExists() + { + TestSessionPool.Instance = null; + + var testSessionInfo = new TestSessionInfo(); + var mockProxyTestSessionManager = new Mock( + new StartTestSessionCriteria(), + 1, + (Func)(() => { return null; })); + + mockProxyTestSessionManager.SetupSequence(tsm => tsm.StopSession()) + .Returns(true) + .Returns(false); + + Assert.IsFalse(TestSessionPool.Instance.KillSession(testSessionInfo)); + mockProxyTestSessionManager.Verify(tsm => tsm.StopSession(), Times.Never); + + Assert.IsTrue(TestSessionPool.Instance.AddSession(testSessionInfo, mockProxyTestSessionManager.Object)); + Assert.IsTrue(TestSessionPool.Instance.KillSession(testSessionInfo)); + mockProxyTestSessionManager.Verify(tsm => tsm.StopSession(), Times.Once); + + Assert.IsTrue(TestSessionPool.Instance.AddSession(testSessionInfo, mockProxyTestSessionManager.Object)); + Assert.IsFalse(TestSessionPool.Instance.KillSession(testSessionInfo)); + mockProxyTestSessionManager.Verify(tsm => tsm.StopSession(), Times.Exactly(2)); + } + + [TestMethod] + public void TakeProxyShouldSucceedIfMatchingCriteriaAreCorrect() + { + TestSessionPool.Instance = null; + + var testSessionInfo = new TestSessionInfo(); + var mockProxyTestSessionManager = new Mock( + new StartTestSessionCriteria(), + 1, + (Func)(() => { return null; })); + + mockProxyTestSessionManager.SetupSequence(tsm => tsm.DequeueProxy(It.IsAny(), It.IsAny())) + .Throws(new InvalidOperationException("Test Exception")) + .Returns(new ProxyOperationManager(null, null, null)); + + // Take proxy fails because test session is invalid. + Assert.IsNull(TestSessionPool.Instance.TakeProxy(new TestSessionInfo(), string.Empty, string.Empty)); + mockProxyTestSessionManager.Verify(tsm => tsm.DequeueProxy(It.IsAny(), It.IsAny()), Times.Never); + + Assert.IsTrue(TestSessionPool.Instance.AddSession(testSessionInfo, mockProxyTestSessionManager.Object)); + + // First TakeProxy fails because of throwing, see setup sequence. + Assert.IsNull(TestSessionPool.Instance.TakeProxy(testSessionInfo, string.Empty, string.Empty)); + mockProxyTestSessionManager.Verify(tsm => tsm.DequeueProxy(It.IsAny(), It.IsAny()), Times.Once); + + // Second TakeProxy succeeds, see setup sequence. + Assert.IsNotNull(TestSessionPool.Instance.TakeProxy(testSessionInfo, string.Empty, string.Empty)); + mockProxyTestSessionManager.Verify(tsm => tsm.DequeueProxy(It.IsAny(), It.IsAny()), Times.Exactly(2)); + } + + [TestMethod] + public void ReturnProxyShouldSucceedIfProxyIdIsValid() + { + TestSessionPool.Instance = null; + + var testSessionInfo = new TestSessionInfo(); + var mockProxyTestSessionManager = new Mock( + new StartTestSessionCriteria(), + 1, + (Func)(() => { return null; })); + + mockProxyTestSessionManager.SetupSequence(tsm => tsm.EnqueueProxy(It.IsAny())) + .Throws(new ArgumentException("Test Exception")) + .Throws(new InvalidOperationException("Test Exception")) + .Returns(true); + + Assert.IsFalse(TestSessionPool.Instance.ReturnProxy(new TestSessionInfo(), 0)); + mockProxyTestSessionManager.Verify(tsm => tsm.EnqueueProxy(It.IsAny()), Times.Never); + + Assert.IsTrue(TestSessionPool.Instance.AddSession(testSessionInfo, mockProxyTestSessionManager.Object)); + + // Simulates proxy id not found (see setup sequence). + Assert.ThrowsException(() => TestSessionPool.Instance.ReturnProxy(testSessionInfo, 0)); + mockProxyTestSessionManager.Verify(tsm => tsm.EnqueueProxy(It.IsAny()), Times.Once); + + // Simulates proxy already available (see setup sequence). + Assert.IsFalse(TestSessionPool.Instance.ReturnProxy(testSessionInfo, 0)); + mockProxyTestSessionManager.Verify(tsm => tsm.EnqueueProxy(It.IsAny()), Times.Exactly(2)); + + // EnqueueProxy call succeeds. + Assert.IsTrue(TestSessionPool.Instance.ReturnProxy(testSessionInfo, 0)); + mockProxyTestSessionManager.Verify(tsm => tsm.EnqueueProxy(It.IsAny()), Times.Exactly(3)); + } + } +} diff --git a/test/TranslationLayer.UnitTests/TestSessionTests.cs b/test/TranslationLayer.UnitTests/TestSessionTests.cs new file mode 100644 index 0000000000..99b73bc73f --- /dev/null +++ b/test/TranslationLayer.UnitTests/TestSessionTests.cs @@ -0,0 +1,586 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +namespace Microsoft.TestPlatform.VsTestConsole.TranslationLayer.UnitTests +{ + using System; + using System.Collections.Generic; + using System.Threading.Tasks; + + using Microsoft.TestPlatform.VsTestConsole.TranslationLayer.Interfaces; + using Microsoft.VisualStudio.TestPlatform.ObjectModel; + using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client; + using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.Interfaces; + using Microsoft.VisualStudio.TestPlatform.VsTestConsole.TranslationLayer.Interfaces; + using Microsoft.VisualStudio.TestTools.UnitTesting; + + using Moq; + + [TestClass] + public class TestSessionTests + { + private readonly string testSettings = "TestSettings"; + private readonly List testSources = new List { "Hello", "World" }; + private readonly List testCases = new List + { + new TestCase("a.b.c", new Uri("d://uri"), "a.dll"), + new TestCase("d.e.f", new Uri("g://uri"), "d.dll") + }; + + private TestSessionInfo testSessionInfo; + private ITestSession testSession; + private Mock mockTestSessionEventsHandler; + private Mock mockVsTestConsoleWrapper; + + [TestInitialize] + public void TestInitialize() + { + this.testSessionInfo = new TestSessionInfo(); + this.mockTestSessionEventsHandler = new Mock(); + this.mockVsTestConsoleWrapper = new Mock(); + + this.testSession = new TestSession( + this.testSessionInfo, + this.mockTestSessionEventsHandler.Object, + this.mockVsTestConsoleWrapper.Object); + } + + #region ITestSession + [TestMethod] + public void AbortTestRunShouldCallConsoleWrapperAbortTestRun() + { + this.testSession.AbortTestRun(); + + this.mockVsTestConsoleWrapper.Verify( + vtcw => vtcw.AbortTestRun(), + Times.Once); + } + + [TestMethod] + public void CancelDiscoveryShouldCallConsoleWrapperCancelDiscovery() + { + this.testSession.CancelDiscovery(); + + this.mockVsTestConsoleWrapper.Verify( + vtcw => vtcw.CancelDiscovery(), + Times.Once); + } + + [TestMethod] + public void CancelTestRunShouldCallConsoleWrapperCancelTestRun() + { + this.testSession.CancelTestRun(); + + this.mockVsTestConsoleWrapper.Verify( + vtcw => vtcw.CancelTestRun(), + Times.Once); + } + + [TestMethod] + public void DiscoverTestsShouldCallConsoleWrapperDiscoverTestsWithCorrectArguments1() + { + this.testSession.DiscoverTests( + this.testSources, + this.testSettings, + new Mock().Object); + + this.mockVsTestConsoleWrapper.Verify( + vtcw => vtcw.DiscoverTests( + this.testSources, + this.testSettings, + null, + this.testSessionInfo, + It.IsAny()), + Times.Once); + } + + [TestMethod] + public void DiscoverTestsShouldCallConsoleWrapperDiscoverTestsWithCorrectArguments2() + { + var testPlatformOptions = new TestPlatformOptions(); + var mockTestDiscoveryEventsHandler = new Mock(); + + this.testSession.DiscoverTests( + this.testSources, + this.testSettings, + testPlatformOptions, + mockTestDiscoveryEventsHandler.Object); + + this.mockVsTestConsoleWrapper.Verify( + vtcw => vtcw.DiscoverTests( + this.testSources, + this.testSettings, + testPlatformOptions, + this.testSessionInfo, + mockTestDiscoveryEventsHandler.Object), + Times.Once); + } + + [TestMethod] + public void RunTestsWithSourcesShouldCallConsoleWrapperRunTestsWithCorrectArguments1() + { + var mockTestRunEventsHandler = new Mock(); + + this.testSession.RunTests( + this.testSources, + this.testSettings, + mockTestRunEventsHandler.Object); + + this.mockVsTestConsoleWrapper.Verify( + vtcw => vtcw.RunTests( + this.testSources, + this.testSettings, + null, + this.testSessionInfo, + mockTestRunEventsHandler.Object), + Times.Once); + } + + [TestMethod] + public void RunTestsWithSourcesShouldCallConsoleWrapperRunTestsWithCorrectArguments2() + { + var testPlatformOptions = new TestPlatformOptions(); + var mockTestRunEventsHandler = new Mock(); + + this.testSession.RunTests( + this.testSources, + this.testSettings, + testPlatformOptions, + mockTestRunEventsHandler.Object); + + this.mockVsTestConsoleWrapper.Verify( + vtcw => vtcw.RunTests( + this.testSources, + this.testSettings, + testPlatformOptions, + this.testSessionInfo, + mockTestRunEventsHandler.Object), + Times.Once); + } + + [TestMethod] + public void RunTestsWithTestCasesShouldCallConsoleWrapperRunTestsWithCorrectArguments1() + { + var mockTestRunEventsHandler = new Mock(); + + this.testSession.RunTests( + this.testCases, + this.testSettings, + mockTestRunEventsHandler.Object); + + this.mockVsTestConsoleWrapper.Verify( + vtcw => vtcw.RunTests( + this.testCases, + this.testSettings, + null, + this.testSessionInfo, + mockTestRunEventsHandler.Object), + Times.Once); + } + + [TestMethod] + public void RunTestsWithTestCasesShouldCallConsoleWrapperRunTestsWithCorrectArguments2() + { + var testPlatformOptions = new TestPlatformOptions(); + var mockTestRunEventsHandler = new Mock(); + + this.testSession.RunTests( + this.testCases, + this.testSettings, + testPlatformOptions, + mockTestRunEventsHandler.Object); + + this.mockVsTestConsoleWrapper.Verify( + vtcw => vtcw.RunTests( + this.testCases, + this.testSettings, + testPlatformOptions, + this.testSessionInfo, + mockTestRunEventsHandler.Object), + Times.Once); + } + + [TestMethod] + public void RunTestsWithSourcesAndCustomTesthostShouldCallConsoleWrapperRunTestsWithCorrectArguments1() + { + var mockTestRunEventsHandler = new Mock(); + var mockTestHostLauncher = new Mock(); + + this.testSession.RunTestsWithCustomTestHost( + this.testSources, + this.testSettings, + mockTestRunEventsHandler.Object, + mockTestHostLauncher.Object); + + this.mockVsTestConsoleWrapper.Verify( + vtcw => vtcw.RunTestsWithCustomTestHost( + this.testSources, + this.testSettings, + null, + this.testSessionInfo, + mockTestRunEventsHandler.Object, + mockTestHostLauncher.Object), + Times.Once); + } + + [TestMethod] + public void RunTestsWithSourcesAndCustomTesthostShouldCallConsoleWrapperRunTestsWithCorrectArguments2() + { + var testPlatformOptions = new TestPlatformOptions(); + var mockTestRunEventsHandler = new Mock(); + var mockTestHostLauncher = new Mock(); + + this.testSession.RunTestsWithCustomTestHost( + this.testSources, + this.testSettings, + testPlatformOptions, + mockTestRunEventsHandler.Object, + mockTestHostLauncher.Object); + + this.mockVsTestConsoleWrapper.Verify( + vtcw => vtcw.RunTestsWithCustomTestHost( + this.testSources, + this.testSettings, + testPlatformOptions, + this.testSessionInfo, + mockTestRunEventsHandler.Object, + mockTestHostLauncher.Object), + Times.Once); + } + + [TestMethod] + public void RunTestsWithTestCasesAndCustomTesthostShouldCallConsoleWrapperRunTestsWithCorrectArguments1() + { + var mockTestRunEventsHandler = new Mock(); + var mockTestHostLauncher = new Mock(); + + this.testSession.RunTestsWithCustomTestHost( + this.testCases, + this.testSettings, + mockTestRunEventsHandler.Object, + mockTestHostLauncher.Object); + + this.mockVsTestConsoleWrapper.Verify( + vtcw => vtcw.RunTestsWithCustomTestHost( + this.testCases, + this.testSettings, + null, + this.testSessionInfo, + mockTestRunEventsHandler.Object, + mockTestHostLauncher.Object), + Times.Once); + } + + [TestMethod] + public void RunTestsWithTestCasesAndCustomTesthostShouldCallConsoleWrapperRunTestsWithCorrectArguments2() + { + var testPlatformOptions = new TestPlatformOptions(); + var mockTestRunEventsHandler = new Mock(); + var mockTestHostLauncher = new Mock(); + + this.testSession.RunTestsWithCustomTestHost( + this.testCases, + this.testSettings, + testPlatformOptions, + mockTestRunEventsHandler.Object, + mockTestHostLauncher.Object); + + this.mockVsTestConsoleWrapper.Verify( + vtcw => vtcw.RunTestsWithCustomTestHost( + this.testCases, + this.testSettings, + testPlatformOptions, + this.testSessionInfo, + mockTestRunEventsHandler.Object, + mockTestHostLauncher.Object), + Times.Once); + } + + [TestMethod] + public void StopTestSessionShouldCallConsoleWrapperStopTestSessionWithCorrectArguments1() + { + this.testSession.StopTestSession(); + + this.mockVsTestConsoleWrapper.Verify( + vtcw => vtcw.StopTestSession( + this.testSessionInfo, + this.mockTestSessionEventsHandler.Object), + Times.Once); + } + + [TestMethod] + public void StopTestSessionShouldCallConsoleWrapperStopTestSessionWithCorrectArguments2() + { + var mockTestSessionEventsHandler2 = new Mock(); + + this.testSession.StopTestSession(mockTestSessionEventsHandler2.Object); + + this.mockVsTestConsoleWrapper.Verify( + vtcw => vtcw.StopTestSession( + this.testSessionInfo, + mockTestSessionEventsHandler2.Object), + Times.Once); + } + #endregion + + #region ITestSessionAsync + [TestMethod] + public async Task DiscoverTestsAsyncShouldCallConsoleWrapperDiscoverTestsWithCorrectArguments1() + { + await this.testSession.DiscoverTestsAsync( + this.testSources, + this.testSettings, + new Mock().Object) + .ConfigureAwait(false); + + this.mockVsTestConsoleWrapper.Verify( + vtcw => vtcw.DiscoverTestsAsync( + this.testSources, + this.testSettings, + null, + this.testSessionInfo, + It.IsAny()), + Times.Once); + } + + [TestMethod] + public async Task DiscoverTestsAsyncShouldCallConsoleWrapperDiscoverTestsWithCorrectArguments2() + { + var testPlatformOptions = new TestPlatformOptions(); + var mockTestDiscoveryEventsHandler = new Mock(); + + await this.testSession.DiscoverTestsAsync( + this.testSources, + this.testSettings, + testPlatformOptions, + mockTestDiscoveryEventsHandler.Object) + .ConfigureAwait(false); ; + + this.mockVsTestConsoleWrapper.Verify( + vtcw => vtcw.DiscoverTestsAsync( + this.testSources, + this.testSettings, + testPlatformOptions, + this.testSessionInfo, + mockTestDiscoveryEventsHandler.Object), + Times.Once); + } + + [TestMethod] + public async Task RunTestsAsyncWithSourcesShouldCallConsoleWrapperRunTestsWithCorrectArguments1() + { + var mockTestRunEventsHandler = new Mock(); + + await this.testSession.RunTestsAsync( + this.testSources, + this.testSettings, + mockTestRunEventsHandler.Object) + .ConfigureAwait(false); + + this.mockVsTestConsoleWrapper.Verify( + vtcw => vtcw.RunTestsAsync( + this.testSources, + this.testSettings, + null, + this.testSessionInfo, + mockTestRunEventsHandler.Object), + Times.Once); + } + + [TestMethod] + public async Task RunTestsAsyncWithSourcesShouldCallConsoleWrapperRunTestsWithCorrectArguments2() + { + var testPlatformOptions = new TestPlatformOptions(); + var mockTestRunEventsHandler = new Mock(); + + await this.testSession.RunTestsAsync( + this.testSources, + this.testSettings, + testPlatformOptions, + mockTestRunEventsHandler.Object) + .ConfigureAwait(false); + + this.mockVsTestConsoleWrapper.Verify( + vtcw => vtcw.RunTestsAsync( + this.testSources, + this.testSettings, + testPlatformOptions, + this.testSessionInfo, + mockTestRunEventsHandler.Object), + Times.Once); + } + + [TestMethod] + public async Task RunTestsAsyncWithTestCasesShouldCallConsoleWrapperRunTestsWithCorrectArguments1() + { + var mockTestRunEventsHandler = new Mock(); + + await this.testSession.RunTestsAsync( + this.testCases, + this.testSettings, + mockTestRunEventsHandler.Object) + .ConfigureAwait(false); + + this.mockVsTestConsoleWrapper.Verify( + vtcw => vtcw.RunTestsAsync( + this.testCases, + this.testSettings, + null, + this.testSessionInfo, + mockTestRunEventsHandler.Object), + Times.Once); + } + + [TestMethod] + public async Task RunTestsAsyncWithTestCasesShouldCallConsoleWrapperRunTestsWithCorrectArguments2() + { + var testPlatformOptions = new TestPlatformOptions(); + var mockTestRunEventsHandler = new Mock(); + + await this.testSession.RunTestsAsync( + this.testCases, + this.testSettings, + testPlatformOptions, + mockTestRunEventsHandler.Object) + .ConfigureAwait(false); ; + + this.mockVsTestConsoleWrapper.Verify( + vtcw => vtcw.RunTestsAsync( + this.testCases, + this.testSettings, + testPlatformOptions, + this.testSessionInfo, + mockTestRunEventsHandler.Object), + Times.Once); + } + + [TestMethod] + public async Task RunTestsAsyncWithSourcesAndCustomTesthostShouldCallConsoleWrapperRunTestsWithCorrectArguments1() + { + var mockTestRunEventsHandler = new Mock(); + var mockTestHostLauncher = new Mock(); + + await this.testSession.RunTestsWithCustomTestHostAsync( + this.testSources, + this.testSettings, + mockTestRunEventsHandler.Object, + mockTestHostLauncher.Object) + .ConfigureAwait(false); + + this.mockVsTestConsoleWrapper.Verify( + vtcw => vtcw.RunTestsWithCustomTestHostAsync( + this.testSources, + this.testSettings, + null, + this.testSessionInfo, + mockTestRunEventsHandler.Object, + mockTestHostLauncher.Object), + Times.Once); + } + + [TestMethod] + public async Task RunTestsAsyncWithSourcesAndCustomTesthostShouldCallConsoleWrapperRunTestsWithCorrectArguments2() + { + var testPlatformOptions = new TestPlatformOptions(); + var mockTestRunEventsHandler = new Mock(); + var mockTestHostLauncher = new Mock(); + + await this.testSession.RunTestsWithCustomTestHostAsync( + this.testSources, + this.testSettings, + testPlatformOptions, + mockTestRunEventsHandler.Object, + mockTestHostLauncher.Object) + .ConfigureAwait(false); + + this.mockVsTestConsoleWrapper.Verify( + vtcw => vtcw.RunTestsWithCustomTestHostAsync( + this.testSources, + this.testSettings, + testPlatformOptions, + this.testSessionInfo, + mockTestRunEventsHandler.Object, + mockTestHostLauncher.Object), + Times.Once); + } + + [TestMethod] + public async Task RunTestsAsyncWithTestCasesAndCustomTesthostShouldCallConsoleWrapperRunTestsWithCorrectArguments1() + { + var mockTestRunEventsHandler = new Mock(); + var mockTestHostLauncher = new Mock(); + + await this.testSession.RunTestsWithCustomTestHostAsync( + this.testCases, + this.testSettings, + mockTestRunEventsHandler.Object, + mockTestHostLauncher.Object) + .ConfigureAwait(false); + + this.mockVsTestConsoleWrapper.Verify( + vtcw => vtcw.RunTestsWithCustomTestHostAsync( + this.testCases, + this.testSettings, + null, + this.testSessionInfo, + mockTestRunEventsHandler.Object, + mockTestHostLauncher.Object), + Times.Once); + } + + [TestMethod] + public async Task RunTestsAsyncWithTestCasesAndCustomTesthostShouldCallConsoleWrapperRunTestsWithCorrectArguments2() + { + var testPlatformOptions = new TestPlatformOptions(); + var mockTestRunEventsHandler = new Mock(); + var mockTestHostLauncher = new Mock(); + + await this.testSession.RunTestsWithCustomTestHostAsync( + this.testCases, + this.testSettings, + testPlatformOptions, + mockTestRunEventsHandler.Object, + mockTestHostLauncher.Object) + .ConfigureAwait(false); + + this.mockVsTestConsoleWrapper.Verify( + vtcw => vtcw.RunTestsWithCustomTestHostAsync( + this.testCases, + this.testSettings, + testPlatformOptions, + this.testSessionInfo, + mockTestRunEventsHandler.Object, + mockTestHostLauncher.Object), + Times.Once); + } + + [TestMethod] + public async Task StopTestSessionAsyncShouldCallConsoleWrapperStopTestSessionWithCorrectArguments1() + { + await this.testSession.StopTestSessionAsync().ConfigureAwait(false); + + this.mockVsTestConsoleWrapper.Verify( + vtcw => vtcw.StopTestSessionAsync( + this.testSessionInfo, + this.mockTestSessionEventsHandler.Object), + Times.Once); + } + + [TestMethod] + public async Task StopTestSessionAsyncShouldCallConsoleWrapperStopTestSessionWithCorrectArguments2() + { + var mockTestSessionEventsHandler2 = new Mock(); + + await this.testSession.StopTestSessionAsync( + mockTestSessionEventsHandler2.Object) + .ConfigureAwait(false); + + this.mockVsTestConsoleWrapper.Verify( + vtcw => vtcw.StopTestSessionAsync( + this.testSessionInfo, + mockTestSessionEventsHandler2.Object), + Times.Once); + } + #endregion + } +} diff --git a/test/TranslationLayer.UnitTests/VsTestConsoleRequestSenderTests.cs b/test/TranslationLayer.UnitTests/VsTestConsoleRequestSenderTests.cs index 25eb79168e..c07b2698b8 100644 --- a/test/TranslationLayer.UnitTests/VsTestConsoleRequestSenderTests.cs +++ b/test/TranslationLayer.UnitTests/VsTestConsoleRequestSenderTests.cs @@ -27,6 +27,7 @@ namespace Microsoft.TestPlatform.VsTestConsole.TranslationLayer.UnitTests using Newtonsoft.Json.Linq; using TestResult = Microsoft.VisualStudio.TestPlatform.ObjectModel.TestResult; + using Payloads = Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.Payloads; [TestClass] public class VsTestConsoleRequestSenderTests @@ -2109,7 +2110,361 @@ public async Task ProcessTestRunAttachmentsAsyncShouldAbortOnExceptionInSendMess #endregion + #region Sessions API + private const int MinimumProtocolVersionWithTestSessionSupport = 5; + private const int TesthostPid = 5000; + [TestMethod] + public void StartTestSessionShouldFailIfWrongProtocolVersionIsNegotiated() + { + this.InitializeCommunication(MinimumProtocolVersionWithTestSessionSupport - 1); + + var mockHandler = new Mock(); + mockHandler.Setup(mh => mh.HandleStartTestSessionComplete(It.IsAny())).Callback(() => { }); + + Assert.IsNull(this.requestSender.StartTestSession( + new List() { "DummyTestAssembly.dll" }, + string.Empty, + null, + mockHandler.Object, + null)); + + mockHandler.Verify(mh => mh.HandleStartTestSessionComplete(null), Times.Once); + } + + [TestMethod] + public async Task StartTestSessionAsyncShouldFailIfWrongProtocolVersionIsNegotiated() + { + await this.InitializeCommunicationAsync(MinimumProtocolVersionWithTestSessionSupport - 1).ConfigureAwait(false); + + var mockHandler = new Mock(); + mockHandler.Setup(mh => mh.HandleStartTestSessionComplete(It.IsAny())).Callback(() => { }); + + Assert.IsNull(await this.requestSender.StartTestSessionAsync( + new List() { "DummyTestAssembly.dll" }, + string.Empty, + null, + mockHandler.Object, + null).ConfigureAwait(false)); + + mockHandler.Verify(mh => mh.HandleStartTestSessionComplete(null), Times.Once); + } + + [TestMethod] + public void StartTestSessionShouldSucceed() + { + this.InitializeCommunication(); + + var mockHandler = new Mock(); + mockHandler.Setup(mh => mh.HandleStartTestSessionComplete(It.IsAny())).Callback(() => { }); + + var testSessionInfo = new TestSessionInfo(); + var ackPayload = new Payloads.StartTestSessionAckPayload() + { + TestSessionInfo = testSessionInfo + }; + var message = this.CreateMessage( + MessageType.StartTestSessionCallback, + ackPayload); + + this.mockCommunicationManager.Setup(cm => cm.SendMessage( + MessageType.StartTestSession, + It.IsAny(), + this.protocolVersion)).Callback(() => { }); + this.mockCommunicationManager.Setup(cm => cm.ReceiveMessageAsync(It.IsAny())) + .Returns(Task.FromResult(message)); + + Assert.AreEqual( + testSessionInfo, + this.requestSender.StartTestSession( + new List() { "DummyTestAssembly.dll" }, + string.Empty, + null, + mockHandler.Object, + null)); + mockHandler.Verify(mh => mh.HandleStartTestSessionComplete(testSessionInfo), Times.Once); + } + + [TestMethod] + public async Task StartTestSessionAsyncShouldSucceed() + { + await this.InitializeCommunicationAsync().ConfigureAwait(false); + + var mockHandler = new Mock(); + mockHandler.Setup(mh => mh.HandleStartTestSessionComplete(It.IsAny())).Callback(() => { }); + + var testSessionInfo = new TestSessionInfo(); + var ackPayload = new Payloads.StartTestSessionAckPayload() + { + TestSessionInfo = testSessionInfo + }; + var message = this.CreateMessage( + MessageType.StartTestSessionCallback, + ackPayload); + + this.mockCommunicationManager.Setup(cm => cm.SendMessage( + MessageType.StartTestSession, + It.IsAny(), + this.protocolVersion)).Callback(() => { }); + this.mockCommunicationManager.Setup(cm => cm.ReceiveMessageAsync(It.IsAny())) + .Returns(Task.FromResult(message)); + + Assert.AreEqual( + testSessionInfo, + await this.requestSender.StartTestSessionAsync( + new List() { "DummyTestAssembly.dll" }, + string.Empty, + null, + mockHandler.Object, + null).ConfigureAwait(false)); + } + + [TestMethod] + public void StartTestSessionWithTesthostLauncherShouldSucceed() + { + this.InitializeCommunication(); + + // Setup + var mockHandler = new Mock(); + mockHandler.Setup(mh => mh.HandleStartTestSessionComplete(It.IsAny())).Callback(() => { }); + var mockTesthostLauncher = new Mock(); + mockTesthostLauncher.Setup(tl => tl.LaunchTestHost(It.IsAny())).Returns(TesthostPid); + + var launchInfo = new TestProcessStartInfo(); + var launchMessage = this.CreateMessage( + MessageType.CustomTestHostLaunch, + launchInfo); + + var testSessionInfo = new TestSessionInfo(); + var ackPayload = new Payloads.StartTestSessionAckPayload() + { + TestSessionInfo = testSessionInfo + }; + var ackMessage = this.CreateMessage( + MessageType.StartTestSessionCallback, + ackPayload); + + Action reconfigureAction = () => + { + this.mockCommunicationManager.Setup(cm => cm.ReceiveMessageAsync(It.IsAny())) + .Returns(Task.FromResult(ackMessage)); + }; + + this.mockCommunicationManager.Setup(cm => cm.SendMessage( + MessageType.StartTestSession, + It.IsAny(), + this.protocolVersion)).Callback(() => { }); + this.mockCommunicationManager.Setup(cm => cm.SendMessage( + MessageType.CustomTestHostLaunchCallback, + It.IsAny(), + this.protocolVersion)) + .Callback((string messageType, object payload, int version) => + { + Assert.AreEqual(((CustomHostLaunchAckPayload)payload).HostProcessId, TesthostPid); + }); + this.mockCommunicationManager.Setup(cm => cm.ReceiveMessageAsync(It.IsAny())) + .Returns(Task.FromResult(launchMessage)) + .Callback(reconfigureAction); + + // Act + Assert.AreEqual( + testSessionInfo, + this.requestSender.StartTestSession( + new List() { "DummyTestAssembly.dll" }, + string.Empty, + null, + mockHandler.Object, + mockTesthostLauncher.Object)); + + // Verify + mockTesthostLauncher.Verify(tl => tl.LaunchTestHost(It.IsAny()), Times.Once); + mockHandler.Verify(mh => mh.HandleStartTestSessionComplete(testSessionInfo), Times.Once); + } + + [TestMethod] + public async Task StartTestSessionAsyncWithTesthostLauncherShouldSucceed() + { + await this.InitializeCommunicationAsync().ConfigureAwait(false); + + // Setup + var mockHandler = new Mock(); + mockHandler.Setup(mh => mh.HandleStartTestSessionComplete(It.IsAny())).Callback(() => { }); + var mockTesthostLauncher = new Mock(); + mockTesthostLauncher.Setup(tl => tl.LaunchTestHost(It.IsAny())).Returns(TesthostPid); + + var launchInfo = new TestProcessStartInfo(); + var launchMessage = this.CreateMessage( + MessageType.CustomTestHostLaunch, + launchInfo); + + var testSessionInfo = new TestSessionInfo(); + var ackPayload = new Payloads.StartTestSessionAckPayload() + { + TestSessionInfo = testSessionInfo + }; + var ackMessage = this.CreateMessage( + MessageType.StartTestSessionCallback, + ackPayload); + + Action reconfigureAction = () => + { + this.mockCommunicationManager.Setup(cm => cm.ReceiveMessageAsync(It.IsAny())) + .Returns(Task.FromResult(ackMessage)); + }; + + this.mockCommunicationManager.Setup(cm => cm.SendMessage( + MessageType.StartTestSession, + It.IsAny(), + this.protocolVersion)).Callback(() => { }); + this.mockCommunicationManager.Setup(cm => cm.SendMessage( + MessageType.CustomTestHostLaunchCallback, + It.IsAny(), + this.protocolVersion)) + .Callback((string messageType, object payload, int version) => + { + Assert.AreEqual(((CustomHostLaunchAckPayload)payload).HostProcessId, TesthostPid); + }); + this.mockCommunicationManager.Setup(cm => cm.ReceiveMessageAsync(It.IsAny())) + .Returns(Task.FromResult(launchMessage)) + .Callback(reconfigureAction); + + // Act + Assert.AreEqual( + testSessionInfo, + await this.requestSender.StartTestSessionAsync( + new List() { "DummyTestAssembly.dll" }, + string.Empty, + null, + mockHandler.Object, + mockTesthostLauncher.Object).ConfigureAwait(false)); + + // Verify + mockTesthostLauncher.Verify(tl => tl.LaunchTestHost(It.IsAny()), Times.Once); + mockHandler.Verify(mh => mh.HandleStartTestSessionComplete(testSessionInfo), Times.Once); + } + + [TestMethod] + public void StartTestSessionWithTesthostLauncherAttachingToProcessShouldSucceed() + { + this.InitializeCommunication(); + + // Setup + var mockHandler = new Mock(); + mockHandler.Setup(mh => mh.HandleStartTestSessionComplete(It.IsAny())).Callback(() => { }); + var mockTesthostLauncher = new Mock(); + mockTesthostLauncher.Setup(tl => tl.AttachDebuggerToProcess(TesthostPid)).Returns(true); + + var launchMessage = this.CreateMessage( + MessageType.EditorAttachDebugger, + TesthostPid); + + var testSessionInfo = new TestSessionInfo(); + var ackPayload = new Payloads.StartTestSessionAckPayload() + { + TestSessionInfo = testSessionInfo + }; + var ackMessage = this.CreateMessage( + MessageType.StartTestSessionCallback, + ackPayload); + + Action reconfigureAction = () => + { + this.mockCommunicationManager.Setup(cm => cm.ReceiveMessageAsync(It.IsAny())) + .Returns(Task.FromResult(ackMessage)); + }; + + this.mockCommunicationManager.Setup(cm => cm.SendMessage( + MessageType.StartTestSession, + It.IsAny(), + this.protocolVersion)).Callback(() => { }); + this.mockCommunicationManager.Setup(cm => cm.SendMessage( + MessageType.EditorAttachDebuggerCallback, + It.IsAny(), + this.protocolVersion)) + .Callback((string messageType, object payload, int version) => + { + Assert.IsTrue(((EditorAttachDebuggerAckPayload)payload).Attached); + }); + this.mockCommunicationManager.Setup(cm => cm.ReceiveMessageAsync(It.IsAny())) + .Returns(Task.FromResult(launchMessage)) + .Callback(reconfigureAction); + + // Act + Assert.AreEqual( + testSessionInfo, + this.requestSender.StartTestSession( + new List() { "DummyTestAssembly.dll" }, + string.Empty, + null, + mockHandler.Object, + mockTesthostLauncher.Object)); + + // Verify + mockTesthostLauncher.Verify(tl => tl.AttachDebuggerToProcess(TesthostPid), Times.Once); + mockHandler.Verify(mh => mh.HandleStartTestSessionComplete(testSessionInfo), Times.Once); + } + + [TestMethod] + public async Task StartTestSessionAsyncWithTesthostLauncherAttachingToProcessShouldSucceed() + { + await this.InitializeCommunicationAsync().ConfigureAwait(false); + + // Setup + var mockHandler = new Mock(); + mockHandler.Setup(mh => mh.HandleStartTestSessionComplete(It.IsAny())).Callback(() => { }); + var mockTesthostLauncher = new Mock(); + mockTesthostLauncher.Setup(tl => tl.AttachDebuggerToProcess(TesthostPid)).Returns(true); + + var launchMessage = this.CreateMessage( + MessageType.EditorAttachDebugger, + TesthostPid); + + var testSessionInfo = new TestSessionInfo(); + var ackPayload = new Payloads.StartTestSessionAckPayload() + { + TestSessionInfo = testSessionInfo + }; + var ackMessage = this.CreateMessage( + MessageType.StartTestSessionCallback, + ackPayload); + + Action reconfigureAction = () => + { + this.mockCommunicationManager.Setup(cm => cm.ReceiveMessageAsync(It.IsAny())) + .Returns(Task.FromResult(ackMessage)); + }; + + this.mockCommunicationManager.Setup(cm => cm.SendMessage( + MessageType.StartTestSession, + It.IsAny(), + this.protocolVersion)).Callback(() => { }); + this.mockCommunicationManager.Setup(cm => cm.SendMessage( + MessageType.EditorAttachDebuggerCallback, + It.IsAny(), + this.protocolVersion)) + .Callback((string messageType, object payload, int version) => + { + Assert.IsTrue(((EditorAttachDebuggerAckPayload)payload).Attached); + }); + this.mockCommunicationManager.Setup(cm => cm.ReceiveMessageAsync(It.IsAny())) + .Returns(Task.FromResult(launchMessage)) + .Callback(reconfigureAction); + + // Act + Assert.AreEqual( + testSessionInfo, + await this.requestSender.StartTestSessionAsync( + new List() { "DummyTestAssembly.dll" }, + string.Empty, + null, + mockHandler.Object, + mockTesthostLauncher.Object).ConfigureAwait(false)); + + // Verify + mockTesthostLauncher.Verify(tl => tl.AttachDebuggerToProcess(TesthostPid), Times.Once); + mockHandler.Verify(mh => mh.HandleStartTestSessionComplete(testSessionInfo), Times.Once); + } + #endregion #region Private Methods @@ -2126,6 +2481,11 @@ private Message CreateMessage(string messageType, T payload) } private void InitializeCommunication() + { + this.InitializeCommunication(this.protocolVersion); + } + + private void InitializeCommunication(int protocolVersion) { var dummyPortInput = 123; this.mockCommunicationManager.Setup(cm => cm.HostServer(new IPEndPoint(IPAddress.Loopback, 0))).Returns(new IPEndPoint(IPAddress.Loopback, dummyPortInput)); @@ -2135,7 +2495,7 @@ private void InitializeCommunication() .Callback((int timeout) => Task.Delay(200).Wait()); var sessionConnected = new Message() { MessageType = MessageType.SessionConnected }; - var versionCheck = new Message() { MessageType = MessageType.VersionCheck, Payload = this.protocolVersion }; + var versionCheck = new Message() { MessageType = MessageType.VersionCheck, Payload = protocolVersion }; Action changedMessage = () => { @@ -2143,7 +2503,7 @@ private void InitializeCommunication() }; this.mockCommunicationManager.Setup(cm => cm.ReceiveMessage()).Returns(sessionConnected); - this.mockCommunicationManager.Setup(cm => cm.SendMessage(MessageType.VersionCheck, this.protocolVersion)).Callback(changedMessage); + this.mockCommunicationManager.Setup(cm => cm.SendMessage(MessageType.VersionCheck, It.IsAny())).Callback(changedMessage); var portOutput = this.requestSender.InitializeCommunication(); Assert.AreEqual(dummyPortInput, portOutput, "Port number must return without changes."); @@ -2176,13 +2536,18 @@ private void SetupMockCommunicationForRunRequest(Mock moc } private async Task InitializeCommunicationAsync() + { + await this.InitializeCommunicationAsync(this.protocolVersion); + } + + private async Task InitializeCommunicationAsync(int protocolVersion) { var dummyPortInput = 123; this.mockCommunicationManager.Setup(cm => cm.HostServer(new IPEndPoint(IPAddress.Loopback, 0))).Returns(new IPEndPoint(IPAddress.Loopback, dummyPortInput)); this.mockCommunicationManager.Setup(cm => cm.AcceptClientAsync()).Returns(Task.FromResult(false)).Callback(() => { }); var sessionConnected = new Message() { MessageType = MessageType.SessionConnected }; - var versionCheck = new Message() { MessageType = MessageType.VersionCheck, Payload = this.protocolVersion }; + var versionCheck = new Message() { MessageType = MessageType.VersionCheck, Payload = protocolVersion }; Action changedMessage = () => { @@ -2190,7 +2555,7 @@ private async Task InitializeCommunicationAsync() }; this.mockCommunicationManager.Setup(cm => cm.ReceiveMessageAsync(It.IsAny())).Returns(Task.FromResult(sessionConnected)); - this.mockCommunicationManager.Setup(cm => cm.SendMessage(MessageType.VersionCheck, this.protocolVersion)).Callback(changedMessage); + this.mockCommunicationManager.Setup(cm => cm.SendMessage(MessageType.VersionCheck, It.IsAny())).Callback(changedMessage); var portOutput = await this.requestSender.InitializeCommunicationAsync(this.WaitTimeout); Assert.AreEqual(dummyPortInput, portOutput, "Connection must succeed."); diff --git a/test/TranslationLayer.UnitTests/VsTestConsoleWrapperAsyncTests.cs b/test/TranslationLayer.UnitTests/VsTestConsoleWrapperAsyncTests.cs index 9d291444b2..65af508b4c 100644 --- a/test/TranslationLayer.UnitTests/VsTestConsoleWrapperAsyncTests.cs +++ b/test/TranslationLayer.UnitTests/VsTestConsoleWrapperAsyncTests.cs @@ -55,6 +55,8 @@ public void TestInitialize() new Mock().Object, this.mockProcessHelper.Object); + this.mockRequestSender.Setup(rs => rs.WaitForRequestHandlerConnection(It.IsAny())).Returns(true); + this.mockRequestSender.Setup(rs => rs.InitializeCommunication()).Returns(100); this.mockRequestSender.Setup(rs => rs.InitializeCommunicationAsync(It.IsAny())).Returns(Task.FromResult(100)); } @@ -92,6 +94,132 @@ public async Task StartSessionShouldCallWhenProcessNotInitializedAsync() this.mockProcessManager.Verify(pm => pm.StartProcess(It.IsAny())); } + [TestMethod] + public async Task StartTestSessionAsyncShouldCallRequestSenderWithCorrectArguments1() + { + var testSessionInfo = new TestSessionInfo(); + var mockEventsHandler = new Mock(); + + this.mockRequestSender.Setup( + rs => rs.StartTestSessionAsync( + this.testSources, + null, + null, + mockEventsHandler.Object, + null)) + .Returns(Task.FromResult(testSessionInfo)); + + Assert.AreEqual( + (await this.consoleWrapper.StartTestSessionAsync( + this.testSources, + null, + mockEventsHandler.Object).ConfigureAwait(false)).TestSessionInfo, + testSessionInfo); + + this.mockRequestSender.Verify( + rs => rs.StartTestSessionAsync( + this.testSources, + null, + null, + mockEventsHandler.Object, + null), + Times.Once); + } + + [TestMethod] + public async Task StartTestSessionAsyncShouldCallRequestSenderWithCorrectArguments2() + { + var testSessionInfo = new TestSessionInfo(); + var testPlatformOptions = new TestPlatformOptions(); + var mockEventsHandler = new Mock(); + + this.mockRequestSender.Setup( + rs => rs.StartTestSessionAsync( + this.testSources, + null, + testPlatformOptions, + mockEventsHandler.Object, + null)) + .Returns(Task.FromResult(testSessionInfo)); + + Assert.AreEqual( + (await this.consoleWrapper.StartTestSessionAsync( + this.testSources, + null, + testPlatformOptions, + mockEventsHandler.Object).ConfigureAwait(false)).TestSessionInfo, + testSessionInfo); + + this.mockRequestSender.Verify( + rs => rs.StartTestSessionAsync( + this.testSources, + null, + testPlatformOptions, + mockEventsHandler.Object, + null), + Times.Once); + } + + [TestMethod] + public async Task StartTestSessionAsyncShouldCallRequestSenderWithCorrectArguments3() + { + var testSessionInfo = new TestSessionInfo(); + var testPlatformOptions = new TestPlatformOptions(); + var mockEventsHandler = new Mock(); + var mockTesthostLauncher = new Mock(); + + this.mockRequestSender.Setup( + rs => rs.StartTestSessionAsync( + this.testSources, + null, + testPlatformOptions, + mockEventsHandler.Object, + mockTesthostLauncher.Object)) + .Returns(Task.FromResult(testSessionInfo)); + + Assert.AreEqual( + (await this.consoleWrapper.StartTestSessionAsync( + this.testSources, + null, + testPlatformOptions, + mockEventsHandler.Object, + mockTesthostLauncher.Object).ConfigureAwait(false)).TestSessionInfo, + testSessionInfo); + + this.mockRequestSender.Verify( + rs => rs.StartTestSessionAsync( + this.testSources, + null, + testPlatformOptions, + mockEventsHandler.Object, + mockTesthostLauncher.Object), + Times.Once); + } + + [TestMethod] + public async Task StopTestSessionAsyncShouldCallRequestSenderWithCorrectArguments() + { + var testSessionInfo = new TestSessionInfo(); + var mockEventsHandler = new Mock(); + + this.mockRequestSender.Setup( + rs => rs.StopTestSessionAsync( + It.IsAny(), + It.IsAny())) + .Returns(Task.FromResult(true)); + + Assert.IsTrue( + await this.consoleWrapper.StopTestSessionAsync( + testSessionInfo, + mockEventsHandler.Object).ConfigureAwait(false)); + + this.mockRequestSender.Verify( + rs => rs.StopTestSessionAsync( + testSessionInfo, + mockEventsHandler.Object), + Times.Once); + } + [TestMethod] public async Task InitializeExtensionsAsyncShouldCachePathToExtensions() { @@ -177,6 +305,29 @@ public void DiscoverTestsAsyncShouldThrowExceptionOnBadConnection() this.mockRequestSender.Verify(rs => rs.DiscoverTestsAsync(It.IsAny>(), It.IsAny(), It.IsAny(), null, It.IsAny()), Times.Never); } + [TestMethod] + public async Task DiscoverTestsShouldSucceedWhenUsingSessions() + { + var testSessionInfo = new TestSessionInfo(); + + await this.consoleWrapper.DiscoverTestsAsync( + this.testSources, + null, + null, + testSessionInfo, + new Mock().Object) + .ConfigureAwait(false); + + this.mockRequestSender.Verify( + rs => rs.DiscoverTestsAsync( + this.testSources, + null, + null, + testSessionInfo, + It.IsAny()), + Times.Once); + } + [TestMethod] public async Task RunTestsAsyncWithSourcesShouldSucceed() { @@ -202,6 +353,29 @@ public async Task RunTestsAsyncWithSourcesAndOptionsShouldSucceedOnOptions() this.mockRequestSender.Verify(rs => rs.StartTestRunAsync(this.testSources, "RunSettings", options, null, It.IsAny()), Times.Once); } + [TestMethod] + public async Task RunTestsAsyncWithSourcesShouldSucceedWhenUsingSessions() + { + var testSessionInfo = new TestSessionInfo(); + var options = new TestPlatformOptions() { TestCaseFilter = "PacMan" }; + await this.consoleWrapper.RunTestsAsync( + this.testSources, + "RunSettings", + options, + testSessionInfo, + new Mock().Object) + .ConfigureAwait(false); + + this.mockRequestSender.Verify( + rs => rs.StartTestRunAsync( + this.testSources, + "RunSettings", + options, + testSessionInfo, + It.IsAny()), + Times.Once); + } + [TestMethod] public async Task RunTestsAsyncWithSourcesAndCustomHostShouldSucceed() { @@ -242,6 +416,31 @@ await this.consoleWrapper.RunTestsWithCustomTestHostAsync( this.mockRequestSender.Verify(rs => rs.StartTestRunWithCustomHostAsync(this.testSources, "RunSettings", options, null, It.IsAny(), It.IsAny()), Times.Once); } + [TestMethod] + public async Task RunTestsAsyncWithSourcesAndACustomHostShouldSucceedWhenUsingSessions() + { + var testSessionInfo = new TestSessionInfo(); + var options = new TestPlatformOptions() { TestCaseFilter = "PacMan" }; + await this.consoleWrapper.RunTestsWithCustomTestHostAsync( + this.testSources, + "RunSettings", + options, + testSessionInfo, + new Mock().Object, + new Mock().Object) + .ConfigureAwait(false); + + this.mockRequestSender.Verify( + rs => rs.StartTestRunWithCustomHostAsync( + this.testSources, + "RunSettings", + options, + testSessionInfo, + It.IsAny(), + It.IsAny()), + Times.Once); + } + [TestMethod] public async Task RunTestsAsyncWithSelectedTestsShouldSucceed() { @@ -268,6 +467,30 @@ public async Task RunTestsAsyncWithSelectedTestsAndOptionsShouldSucceedOnOptions this.mockRequestSender.Verify(rs => rs.StartTestRunAsync(this.testCases, "RunSettings", options, null, It.IsAny()), Times.Once); } + [TestMethod] + public async Task RunTestsAsyncWithSelectedTestsShouldSucceedWhenUsingSessions() + { + var testSessionInfo = new TestSessionInfo(); + var options = new TestPlatformOptions() { TestCaseFilter = "PacMan" }; + + await this.consoleWrapper.RunTestsAsync( + this.testCases, + "RunSettings", + options, + testSessionInfo, + new Mock().Object) + .ConfigureAwait(false); + + this.mockRequestSender.Verify( + rs => rs.StartTestRunAsync( + this.testCases, + "RunSettings", + options, + testSessionInfo, + It.IsAny()), + Times.Once); + } + [TestMethod] public async Task RunTestsAsyncWithSelectedTestsAndCustomLauncherShouldSucceed() { @@ -307,6 +530,32 @@ await this.consoleWrapper.RunTestsWithCustomTestHostAsync( this.mockRequestSender.Verify(rs => rs.StartTestRunWithCustomHostAsync(this.testCases, "RunSettings", options, null, It.IsAny(), It.IsAny()), Times.Once); } + [TestMethod] + public async Task RunTestsAsyncWithSelectedTestsAndACustomHostShouldSucceedWhenUsingSessions() + { + var testSessionInfo = new TestSessionInfo(); + var options = new TestPlatformOptions() { TestCaseFilter = "PacMan" }; + + await this.consoleWrapper.RunTestsWithCustomTestHostAsync( + this.testCases, + "RunSettings", + options, + testSessionInfo, + new Mock().Object, + new Mock().Object) + .ConfigureAwait(false); + + this.mockRequestSender.Verify( + rs => rs.StartTestRunWithCustomHostAsync( + this.testCases, + "RunSettings", + options, + testSessionInfo, + It.IsAny(), + It.IsAny()), + Times.Once); + } + [TestMethod] public async Task ProcessTestRunAttachmentsAsyncShouldSucceed() { diff --git a/test/TranslationLayer.UnitTests/VsTestConsoleWrapperTests.cs b/test/TranslationLayer.UnitTests/VsTestConsoleWrapperTests.cs index d99e9c9801..bffda62816 100644 --- a/test/TranslationLayer.UnitTests/VsTestConsoleWrapperTests.cs +++ b/test/TranslationLayer.UnitTests/VsTestConsoleWrapperTests.cs @@ -94,6 +94,132 @@ public void StartSessionShouldCallWhenProcessNotInitialized() this.mockProcessManager.Verify(pm => pm.StartProcess(It.IsAny())); } + [TestMethod] + public void StartTestSessionShouldCallRequestSenderWithCorrectArguments1() + { + var testSessionInfo = new TestSessionInfo(); + var mockEventsHandler = new Mock(); + + this.mockRequestSender.Setup( + rs => rs.StartTestSession( + this.testSources, + null, + null, + mockEventsHandler.Object, + null)) + .Returns(testSessionInfo); + + Assert.AreEqual( + this.consoleWrapper.StartTestSession( + this.testSources, + null, + mockEventsHandler.Object).TestSessionInfo, + testSessionInfo); + + this.mockRequestSender.Verify( + rs => rs.StartTestSession( + this.testSources, + null, + null, + mockEventsHandler.Object, + null), + Times.Once); + } + + [TestMethod] + public void StartTestSessionShouldCallRequestSenderWithCorrectArguments2() + { + var testSessionInfo = new TestSessionInfo(); + var testPlatformOptions = new TestPlatformOptions(); + var mockEventsHandler = new Mock(); + + this.mockRequestSender.Setup( + rs => rs.StartTestSession( + this.testSources, + null, + testPlatformOptions, + mockEventsHandler.Object, + null)) + .Returns(testSessionInfo); + + Assert.AreEqual( + this.consoleWrapper.StartTestSession( + this.testSources, + null, + testPlatformOptions, + mockEventsHandler.Object).TestSessionInfo, + testSessionInfo); + + this.mockRequestSender.Verify( + rs => rs.StartTestSession( + this.testSources, + null, + testPlatformOptions, + mockEventsHandler.Object, + null), + Times.Once); + } + + [TestMethod] + public void StartTestSessionShouldCallRequestSenderWithCorrectArguments3() + { + var testSessionInfo = new TestSessionInfo(); + var testPlatformOptions = new TestPlatformOptions(); + var mockEventsHandler = new Mock(); + var mockTesthostLauncher = new Mock(); + + this.mockRequestSender.Setup( + rs => rs.StartTestSession( + this.testSources, + null, + testPlatformOptions, + mockEventsHandler.Object, + mockTesthostLauncher.Object)) + .Returns(testSessionInfo); + + Assert.AreEqual( + this.consoleWrapper.StartTestSession( + this.testSources, + null, + testPlatformOptions, + mockEventsHandler.Object, + mockTesthostLauncher.Object).TestSessionInfo, + testSessionInfo); + + this.mockRequestSender.Verify( + rs => rs.StartTestSession( + this.testSources, + null, + testPlatformOptions, + mockEventsHandler.Object, + mockTesthostLauncher.Object), + Times.Once); + } + + [TestMethod] + public void StopTestSessionShouldCallRequestSenderWithCorrectArguments() + { + var testSessionInfo = new TestSessionInfo(); + var mockEventsHandler = new Mock(); + + this.mockRequestSender.Setup( + rs => rs.StopTestSession( + It.IsAny(), + It.IsAny())) + .Returns(true); + + Assert.IsTrue( + this.consoleWrapper.StopTestSession( + testSessionInfo, + mockEventsHandler.Object)); + + this.mockRequestSender.Verify( + rs => rs.StopTestSession( + testSessionInfo, + mockEventsHandler.Object), + Times.Once); + } + [TestMethod] public void InitializeExtensionsShouldCachePathToExtensions() { @@ -164,6 +290,28 @@ public void DiscoverTestsShouldCallTestDiscoveryHandler2IfTestDiscoveryHandler1I this.mockRequestSender.Verify(rs => rs.DiscoverTests(this.testSources, null, null, null, It.IsAny()), Times.Once); } + [TestMethod] + public void DiscoverTestsShouldSucceedWhenUsingSessions() + { + var testSessionInfo = new TestSessionInfo(); + + this.consoleWrapper.DiscoverTests( + this.testSources, + null, + null, + testSessionInfo, + new Mock().Object); + + this.mockRequestSender.Verify( + rs => rs.DiscoverTests( + this.testSources, + null, + null, + testSessionInfo, + It.IsAny()), + Times.Once); + } + [TestMethod] public void DiscoverTestsShouldThrowExceptionOnBadConnection() { @@ -208,6 +356,28 @@ public void RunTestsWithSourcesAndOptionsShouldPassOnOptions() this.mockRequestSender.Verify(rs => rs.StartTestRun(this.testSources, "RunSettings", options, null, It.IsAny()), Times.Once); } + [TestMethod] + public void RunTestsWithSourcesShouldSucceedWhenUsingSessions() + { + var testSessionInfo = new TestSessionInfo(); + var options = new TestPlatformOptions() { TestCaseFilter = "PacMan" }; + this.consoleWrapper.RunTests( + this.testSources, + "RunSettings", + options, + testSessionInfo, + new Mock().Object); + + this.mockRequestSender.Verify( + rs => rs.StartTestRun( + this.testSources, + "RunSettings", + options, + testSessionInfo, + It.IsAny()), + Times.Once); + } + [TestMethod] public void RunTestsWithSourcesAndCustomHostShouldSucceed() { @@ -242,6 +412,30 @@ public void RunTestsWithSourcesAndOptionsUsingACustomHostShouldPassOnOptions() Times.Once); } + [TestMethod] + public void RunTestsWithSourcesAndACustomHostShouldSucceedWhenUsingSessions() + { + var testSessionInfo = new TestSessionInfo(); + var options = new TestPlatformOptions() { TestCaseFilter = "PacMan" }; + this.consoleWrapper.RunTestsWithCustomTestHost( + this.testSources, + "RunSettings", + options, + testSessionInfo, + new Mock().Object, + new Mock().Object); + + this.mockRequestSender.Verify( + rs => rs.StartTestRunWithCustomHost( + this.testSources, + "RunSettings", + options, + testSessionInfo, + It.IsAny(), + It.IsAny()), + Times.Once); + } + [TestMethod] public void RunTestsWithSelectedTestsShouldSucceed() { @@ -268,6 +462,29 @@ public void RunTestsWithSelectedTestsAndOptionsShouldPassOnOptions() this.mockRequestSender.Verify(rs => rs.StartTestRun(this.testCases, "RunSettings", options, null, It.IsAny()), Times.Once); } + [TestMethod] + public void RunTestsWithSelectedTestsShouldSucceedWhenUsingSessions() + { + var testSessionInfo = new TestSessionInfo(); + var options = new TestPlatformOptions() { TestCaseFilter = "PacMan" }; + + this.consoleWrapper.RunTests( + this.testCases, + "RunSettings", + options, + testSessionInfo, + new Mock().Object); + + this.mockRequestSender.Verify( + rs => rs.StartTestRun( + this.testCases, + "RunSettings", + options, + testSessionInfo, + It.IsAny()), + Times.Once); + } + [TestMethod] public void RunTestsWithSelectedTestsAndCustomLauncherShouldSucceed() { @@ -308,6 +525,31 @@ public void RunTestsWithSelectedTestsAndOptionsUsingACustomHostShouldPassOnOptio this.mockRequestSender.Verify(rs => rs.StartTestRunWithCustomHost(this.testCases, "RunSettings", options, null, It.IsAny(), It.IsAny()), Times.Once); } + [TestMethod] + public void RunTestsWithSelectedTestsAndACustomHostShouldSucceedWhenUsingSessions() + { + var testSessionInfo = new TestSessionInfo(); + var options = new TestPlatformOptions() { TestCaseFilter = "PacMan" }; + + this.consoleWrapper.RunTestsWithCustomTestHost( + this.testCases, + "RunSettings", + options, + testSessionInfo, + new Mock().Object, + new Mock().Object); + + this.mockRequestSender.Verify( + rs => rs.StartTestRunWithCustomHost( + this.testCases, + "RunSettings", + options, + testSessionInfo, + It.IsAny(), + It.IsAny()), + Times.Once); + } + [TestMethod] public async Task ProcessTestRunAttachmentsAsyncShouldSucceed() { From 9cfd6bf6c9e3028b3639848d8302e6665f5e6713 Mon Sep 17 00:00:00 2001 From: Codrin Poienaru Date: Wed, 20 Oct 2021 21:57:09 +0200 Subject: [PATCH 21/26] Fixed public API --- .../PublicAPI/net45/PublicAPI.Unshipped.txt | 5 +++-- .../PublicAPI/net451/PublicAPI.Unshipped.txt | 4 ++-- .../PublicAPI/net6.0/PublicAPI.Unshipped.txt | 4 ++-- .../PublicAPI/netcoreapp1.0/PublicAPI.Unshipped.txt | 4 ++-- .../PublicAPI/netcoreapp2.1/PublicAPI.Unshipped.txt | 4 ++-- .../PublicAPI/netstandard1.0/PublicAPI.Unshipped.txt | 4 ++-- .../PublicAPI/netstandard1.3/PublicAPI.Unshipped.txt | 4 ++-- .../PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt | 4 ++-- .../PublicAPI/uap10.0/PublicAPI.Unshipped.txt | 4 ++-- 9 files changed, 19 insertions(+), 18 deletions(-) diff --git a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/net45/PublicAPI.Unshipped.txt b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/net45/PublicAPI.Unshipped.txt index a7b6515512..98db396306 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/net45/PublicAPI.Unshipped.txt +++ b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/net45/PublicAPI.Unshipped.txt @@ -1,7 +1,8 @@ -Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.DiscoveryCriteria(System.Collections.Generic.IEnumerable sources, long frequencyOfDiscoveredTestsEvent, System.TimeSpan discoveredTestEventTimeout, string runSettings, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo testSessionInfo) -> void +Microsoft.VisualStudio.TestPlatform.ObjectModel.Architecture.ARM64 = 5 -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Architecture +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.DiscoveryCriteria(System.Collections.Generic.IEnumerable sources, long frequencyOfDiscoveredTestsEvent, System.TimeSpan discoveredTestEventTimeout, string runSettings, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo testSessionInfo) -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.TestSessionInfo.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.TestSessionInfo.set -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryRequestPayload.TestSessionInfo.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryRequestPayload.TestSessionInfo.set -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform.StartTestSession(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IRequestData requestData, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.StartTestSessionCriteria criteria, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestSessionEventsHandler eventsHandler) -> bool -Microsoft.VisualStudio.TestPlatform.ObjectModel.Architecture.ARM64 = 5 -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Architecture + diff --git a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/net451/PublicAPI.Unshipped.txt b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/net451/PublicAPI.Unshipped.txt index a7b6515512..08187be2d5 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/net451/PublicAPI.Unshipped.txt +++ b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/net451/PublicAPI.Unshipped.txt @@ -1,7 +1,7 @@ -Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.DiscoveryCriteria(System.Collections.Generic.IEnumerable sources, long frequencyOfDiscoveredTestsEvent, System.TimeSpan discoveredTestEventTimeout, string runSettings, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo testSessionInfo) -> void +Microsoft.VisualStudio.TestPlatform.ObjectModel.Architecture.ARM64 = 5 -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Architecture +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.DiscoveryCriteria(System.Collections.Generic.IEnumerable sources, long frequencyOfDiscoveredTestsEvent, System.TimeSpan discoveredTestEventTimeout, string runSettings, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo testSessionInfo) -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.TestSessionInfo.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.TestSessionInfo.set -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryRequestPayload.TestSessionInfo.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryRequestPayload.TestSessionInfo.set -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform.StartTestSession(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IRequestData requestData, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.StartTestSessionCriteria criteria, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestSessionEventsHandler eventsHandler) -> bool -Microsoft.VisualStudio.TestPlatform.ObjectModel.Architecture.ARM64 = 5 -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Architecture diff --git a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/net6.0/PublicAPI.Unshipped.txt b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/net6.0/PublicAPI.Unshipped.txt index a7b6515512..08187be2d5 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/net6.0/PublicAPI.Unshipped.txt +++ b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/net6.0/PublicAPI.Unshipped.txt @@ -1,7 +1,7 @@ -Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.DiscoveryCriteria(System.Collections.Generic.IEnumerable sources, long frequencyOfDiscoveredTestsEvent, System.TimeSpan discoveredTestEventTimeout, string runSettings, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo testSessionInfo) -> void +Microsoft.VisualStudio.TestPlatform.ObjectModel.Architecture.ARM64 = 5 -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Architecture +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.DiscoveryCriteria(System.Collections.Generic.IEnumerable sources, long frequencyOfDiscoveredTestsEvent, System.TimeSpan discoveredTestEventTimeout, string runSettings, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo testSessionInfo) -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.TestSessionInfo.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.TestSessionInfo.set -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryRequestPayload.TestSessionInfo.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryRequestPayload.TestSessionInfo.set -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform.StartTestSession(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IRequestData requestData, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.StartTestSessionCriteria criteria, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestSessionEventsHandler eventsHandler) -> bool -Microsoft.VisualStudio.TestPlatform.ObjectModel.Architecture.ARM64 = 5 -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Architecture diff --git a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netcoreapp1.0/PublicAPI.Unshipped.txt b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netcoreapp1.0/PublicAPI.Unshipped.txt index a7b6515512..08187be2d5 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netcoreapp1.0/PublicAPI.Unshipped.txt +++ b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netcoreapp1.0/PublicAPI.Unshipped.txt @@ -1,7 +1,7 @@ -Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.DiscoveryCriteria(System.Collections.Generic.IEnumerable sources, long frequencyOfDiscoveredTestsEvent, System.TimeSpan discoveredTestEventTimeout, string runSettings, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo testSessionInfo) -> void +Microsoft.VisualStudio.TestPlatform.ObjectModel.Architecture.ARM64 = 5 -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Architecture +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.DiscoveryCriteria(System.Collections.Generic.IEnumerable sources, long frequencyOfDiscoveredTestsEvent, System.TimeSpan discoveredTestEventTimeout, string runSettings, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo testSessionInfo) -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.TestSessionInfo.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.TestSessionInfo.set -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryRequestPayload.TestSessionInfo.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryRequestPayload.TestSessionInfo.set -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform.StartTestSession(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IRequestData requestData, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.StartTestSessionCriteria criteria, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestSessionEventsHandler eventsHandler) -> bool -Microsoft.VisualStudio.TestPlatform.ObjectModel.Architecture.ARM64 = 5 -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Architecture diff --git a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netcoreapp2.1/PublicAPI.Unshipped.txt b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netcoreapp2.1/PublicAPI.Unshipped.txt index a7b6515512..08187be2d5 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netcoreapp2.1/PublicAPI.Unshipped.txt +++ b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netcoreapp2.1/PublicAPI.Unshipped.txt @@ -1,7 +1,7 @@ -Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.DiscoveryCriteria(System.Collections.Generic.IEnumerable sources, long frequencyOfDiscoveredTestsEvent, System.TimeSpan discoveredTestEventTimeout, string runSettings, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo testSessionInfo) -> void +Microsoft.VisualStudio.TestPlatform.ObjectModel.Architecture.ARM64 = 5 -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Architecture +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.DiscoveryCriteria(System.Collections.Generic.IEnumerable sources, long frequencyOfDiscoveredTestsEvent, System.TimeSpan discoveredTestEventTimeout, string runSettings, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo testSessionInfo) -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.TestSessionInfo.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.TestSessionInfo.set -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryRequestPayload.TestSessionInfo.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryRequestPayload.TestSessionInfo.set -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform.StartTestSession(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IRequestData requestData, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.StartTestSessionCriteria criteria, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestSessionEventsHandler eventsHandler) -> bool -Microsoft.VisualStudio.TestPlatform.ObjectModel.Architecture.ARM64 = 5 -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Architecture diff --git a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netstandard1.0/PublicAPI.Unshipped.txt b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netstandard1.0/PublicAPI.Unshipped.txt index a7b6515512..08187be2d5 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netstandard1.0/PublicAPI.Unshipped.txt +++ b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netstandard1.0/PublicAPI.Unshipped.txt @@ -1,7 +1,7 @@ -Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.DiscoveryCriteria(System.Collections.Generic.IEnumerable sources, long frequencyOfDiscoveredTestsEvent, System.TimeSpan discoveredTestEventTimeout, string runSettings, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo testSessionInfo) -> void +Microsoft.VisualStudio.TestPlatform.ObjectModel.Architecture.ARM64 = 5 -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Architecture +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.DiscoveryCriteria(System.Collections.Generic.IEnumerable sources, long frequencyOfDiscoveredTestsEvent, System.TimeSpan discoveredTestEventTimeout, string runSettings, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo testSessionInfo) -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.TestSessionInfo.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.TestSessionInfo.set -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryRequestPayload.TestSessionInfo.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryRequestPayload.TestSessionInfo.set -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform.StartTestSession(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IRequestData requestData, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.StartTestSessionCriteria criteria, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestSessionEventsHandler eventsHandler) -> bool -Microsoft.VisualStudio.TestPlatform.ObjectModel.Architecture.ARM64 = 5 -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Architecture diff --git a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netstandard1.3/PublicAPI.Unshipped.txt b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netstandard1.3/PublicAPI.Unshipped.txt index a7b6515512..08187be2d5 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netstandard1.3/PublicAPI.Unshipped.txt +++ b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netstandard1.3/PublicAPI.Unshipped.txt @@ -1,7 +1,7 @@ -Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.DiscoveryCriteria(System.Collections.Generic.IEnumerable sources, long frequencyOfDiscoveredTestsEvent, System.TimeSpan discoveredTestEventTimeout, string runSettings, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo testSessionInfo) -> void +Microsoft.VisualStudio.TestPlatform.ObjectModel.Architecture.ARM64 = 5 -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Architecture +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.DiscoveryCriteria(System.Collections.Generic.IEnumerable sources, long frequencyOfDiscoveredTestsEvent, System.TimeSpan discoveredTestEventTimeout, string runSettings, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo testSessionInfo) -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.TestSessionInfo.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.TestSessionInfo.set -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryRequestPayload.TestSessionInfo.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryRequestPayload.TestSessionInfo.set -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform.StartTestSession(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IRequestData requestData, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.StartTestSessionCriteria criteria, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestSessionEventsHandler eventsHandler) -> bool -Microsoft.VisualStudio.TestPlatform.ObjectModel.Architecture.ARM64 = 5 -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Architecture diff --git a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt index a7b6515512..08187be2d5 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt +++ b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt @@ -1,7 +1,7 @@ -Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.DiscoveryCriteria(System.Collections.Generic.IEnumerable sources, long frequencyOfDiscoveredTestsEvent, System.TimeSpan discoveredTestEventTimeout, string runSettings, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo testSessionInfo) -> void +Microsoft.VisualStudio.TestPlatform.ObjectModel.Architecture.ARM64 = 5 -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Architecture +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.DiscoveryCriteria(System.Collections.Generic.IEnumerable sources, long frequencyOfDiscoveredTestsEvent, System.TimeSpan discoveredTestEventTimeout, string runSettings, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo testSessionInfo) -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.TestSessionInfo.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.TestSessionInfo.set -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryRequestPayload.TestSessionInfo.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryRequestPayload.TestSessionInfo.set -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform.StartTestSession(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IRequestData requestData, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.StartTestSessionCriteria criteria, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestSessionEventsHandler eventsHandler) -> bool -Microsoft.VisualStudio.TestPlatform.ObjectModel.Architecture.ARM64 = 5 -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Architecture diff --git a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/uap10.0/PublicAPI.Unshipped.txt b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/uap10.0/PublicAPI.Unshipped.txt index a7b6515512..08187be2d5 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/uap10.0/PublicAPI.Unshipped.txt +++ b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/uap10.0/PublicAPI.Unshipped.txt @@ -1,7 +1,7 @@ -Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.DiscoveryCriteria(System.Collections.Generic.IEnumerable sources, long frequencyOfDiscoveredTestsEvent, System.TimeSpan discoveredTestEventTimeout, string runSettings, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo testSessionInfo) -> void +Microsoft.VisualStudio.TestPlatform.ObjectModel.Architecture.ARM64 = 5 -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Architecture +Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.DiscoveryCriteria(System.Collections.Generic.IEnumerable sources, long frequencyOfDiscoveredTestsEvent, System.TimeSpan discoveredTestEventTimeout, string runSettings, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo testSessionInfo) -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.TestSessionInfo.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryCriteria.TestSessionInfo.set -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryRequestPayload.TestSessionInfo.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.TestSessionInfo Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.DiscoveryRequestPayload.TestSessionInfo.set -> void Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestPlatform.StartTestSession(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IRequestData requestData, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.StartTestSessionCriteria criteria, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.ITestSessionEventsHandler eventsHandler) -> bool -Microsoft.VisualStudio.TestPlatform.ObjectModel.Architecture.ARM64 = 5 -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Architecture From 4b246a8fd963a1717ecbf0af834c104d9bcad784 Mon Sep 17 00:00:00 2001 From: Codrin Poienaru Date: Mon, 25 Oct 2021 21:03:10 +0200 Subject: [PATCH 22/26] Added more tests --- .../Friends.cs | 1 + .../DesignMode/DesignModeClientTests.cs | 205 ++++++++++- .../TestPlatformTests.cs | 139 +++++++ .../TestEngineTests.cs | 342 ++++++++++++++++++ .../TestRequestManagerTests.cs | 150 ++++++++ 5 files changed, 821 insertions(+), 16 deletions(-) diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Friends.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Friends.cs index 3a006e0ad9..6caae78d89 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Friends.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Friends.cs @@ -4,6 +4,7 @@ using System.Runtime.CompilerServices; [assembly: InternalsVisibleTo("Microsoft.TestPlatform.CrossPlatEngine.UnitTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] +[assembly: InternalsVisibleTo("Microsoft.TestPlatform.Client.UnitTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] [assembly: InternalsVisibleTo("vstest.console.UnitTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] [assembly: InternalsVisibleTo("datacollector, PublicKey = 002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] [assembly: InternalsVisibleTo("datacollector.PlatformTests, PublicKey = 002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] diff --git a/test/Microsoft.TestPlatform.Client.UnitTests/DesignMode/DesignModeClientTests.cs b/test/Microsoft.TestPlatform.Client.UnitTests/DesignMode/DesignModeClientTests.cs index 57786bb6d6..9cf49fb843 100644 --- a/test/Microsoft.TestPlatform.Client.UnitTests/DesignMode/DesignModeClientTests.cs +++ b/test/Microsoft.TestPlatform.Client.UnitTests/DesignMode/DesignModeClientTests.cs @@ -15,8 +15,10 @@ namespace Microsoft.VisualStudio.TestPlatform.Client.UnitTests.DesignMode using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities; using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.Interfaces; using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.ObjectModel; + using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine; using Microsoft.VisualStudio.TestPlatform.ObjectModel; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client; + using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.Payloads; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.Interfaces; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging; using Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces; @@ -41,7 +43,7 @@ public class DesignModeClientTests private readonly int protocolVersion = 5; - private readonly AutoResetEvent complateEvent; + private readonly AutoResetEvent completeEvent; private readonly Mock mockPlatformEnvrironment; @@ -51,7 +53,7 @@ public DesignModeClientTests() this.mockCommunicationManager = new Mock(); this.mockPlatformEnvrironment = new Mock(); this.designModeClient = new DesignModeClient(this.mockCommunicationManager.Object, JsonDataSerializer.Instance, this.mockPlatformEnvrironment.Object); - this.complateEvent = new AutoResetEvent(false); + this.completeEvent = new AutoResetEvent(false); } [TestMethod] @@ -367,7 +369,7 @@ public void DesignModeClientConnectShouldSendTestMessageAndDiscoverCompleteOnExc this.mockCommunicationManager.SetupSequence(cm => cm.ReceiveMessage()).Returns(startDiscovery); this.mockCommunicationManager .Setup(cm => cm.SendMessage(MessageType.DiscoveryComplete, It.IsAny())) - .Callback(() => complateEvent.Set()); + .Callback(() => completeEvent.Set()); this.mockTestRequestManager.Setup( rm => rm.DiscoverTests( It.IsAny(), @@ -377,7 +379,7 @@ public void DesignModeClientConnectShouldSendTestMessageAndDiscoverCompleteOnExc this.designModeClient.ConnectToClientAndProcessRequests(PortNumber, this.mockTestRequestManager.Object); - Assert.IsTrue(this.complateEvent.WaitOne(Timeout), "Discovery not completed."); + Assert.IsTrue(this.completeEvent.WaitOne(Timeout), "Discovery not completed."); this.mockCommunicationManager.Verify(cm => cm.SendMessage(MessageType.TestMessage, It.IsAny()), Times.Once()); this.mockCommunicationManager.Verify(cm => cm.SendMessage(MessageType.DiscoveryComplete, It.IsAny()), Times.Once()); } @@ -391,7 +393,7 @@ public void DesignModeClientConnectShouldSendTestMessageAndDiscoverCompleteOnTes this.mockCommunicationManager.SetupSequence(cm => cm.ReceiveMessage()).Returns(startDiscovery); this.mockCommunicationManager .Setup(cm => cm.SendMessage(MessageType.DiscoveryComplete, It.IsAny())) - .Callback(() => complateEvent.Set()); + .Callback(() => completeEvent.Set()); this.mockTestRequestManager.Setup( rm => rm.DiscoverTests( It.IsAny(), @@ -401,7 +403,7 @@ public void DesignModeClientConnectShouldSendTestMessageAndDiscoverCompleteOnTes this.designModeClient.ConnectToClientAndProcessRequests(PortNumber, this.mockTestRequestManager.Object); - Assert.IsTrue(this.complateEvent.WaitOne(Timeout), "Discovery not completed."); + Assert.IsTrue(this.completeEvent.WaitOne(Timeout), "Discovery not completed."); this.mockCommunicationManager.Verify(cm => cm.SendMessage(MessageType.TestMessage, It.IsAny()), Times.Once()); this.mockCommunicationManager.Verify(cm => cm.SendMessage(MessageType.DiscoveryComplete, It.IsAny()), Times.Once()); } @@ -415,7 +417,7 @@ public void DesignModeClientConnectShouldSendTestMessageAndAttachmentsProcessing this.mockCommunicationManager.SetupSequence(cm => cm.ReceiveMessage()).Returns(startAttachmentsProcessing); this.mockCommunicationManager .Setup(cm => cm.SendMessage(MessageType.TestRunAttachmentsProcessingComplete, It.IsAny())) - .Callback(() => complateEvent.Set()); + .Callback(() => completeEvent.Set()); this.mockTestRequestManager.Setup( rm => rm.ProcessTestRunAttachments( It.IsAny(), @@ -425,7 +427,7 @@ public void DesignModeClientConnectShouldSendTestMessageAndAttachmentsProcessing this.designModeClient.ConnectToClientAndProcessRequests(PortNumber, this.mockTestRequestManager.Object); - Assert.IsTrue(this.complateEvent.WaitOne(Timeout), "AttachmentsProcessing not completed."); + Assert.IsTrue(this.completeEvent.WaitOne(Timeout), "AttachmentsProcessing not completed."); this.mockCommunicationManager.Verify(cm => cm.SendMessage(MessageType.TestMessage, It.IsAny()), Times.Once()); this.mockCommunicationManager.Verify(cm => cm.SendMessage(MessageType.TestRunAttachmentsProcessingComplete, It.Is(p => p.Attachments == null)), Times.Once()); } @@ -439,7 +441,7 @@ public void DesignModeClientConnectShouldSendTestMessageAndDiscoverCompleteOnTes this.mockCommunicationManager.SetupSequence(cm => cm.ReceiveMessage()).Returns(startAttachmentsProcessing); this.mockCommunicationManager .Setup(cm => cm.SendMessage(MessageType.TestRunAttachmentsProcessingComplete, It.IsAny())) - .Callback(() => complateEvent.Set()); + .Callback(() => completeEvent.Set()); this.mockTestRequestManager.Setup( rm => rm.ProcessTestRunAttachments( It.IsAny(), @@ -449,7 +451,7 @@ public void DesignModeClientConnectShouldSendTestMessageAndDiscoverCompleteOnTes this.designModeClient.ConnectToClientAndProcessRequests(PortNumber, this.mockTestRequestManager.Object); - Assert.IsTrue(this.complateEvent.WaitOne(Timeout), "AttachmentsProcessing not completed."); + Assert.IsTrue(this.completeEvent.WaitOne(Timeout), "AttachmentsProcessing not completed."); this.mockCommunicationManager.Verify(cm => cm.SendMessage(MessageType.TestMessage, It.IsAny()), Times.Once()); this.mockCommunicationManager.Verify(cm => cm.SendMessage(MessageType.TestRunAttachmentsProcessingComplete, It.Is(p => p.Attachments == null)), Times.Once()); } @@ -468,11 +470,11 @@ public void DesignModeClientConnectShouldCallRequestManagerForAttachmentsProcess It.IsAny(), It.IsAny(), It.IsAny())) - .Callback(() => complateEvent.Set()); + .Callback(() => completeEvent.Set()); this.designModeClient.ConnectToClientAndProcessRequests(PortNumber, this.mockTestRequestManager.Object); - Assert.IsTrue(this.complateEvent.WaitOne(Timeout), "AttachmentsProcessing not completed."); + Assert.IsTrue(this.completeEvent.WaitOne(Timeout), "AttachmentsProcessing not completed."); this.mockCommunicationManager.Verify(cm => cm.SendMessage(MessageType.TestMessage, It.IsAny()), Times.Never); this.mockCommunicationManager.Verify(cm => cm.SendMessage(MessageType.TestRunAttachmentsProcessingComplete, It.IsAny()), Times.Never); this.mockTestRequestManager.Verify(rm => rm.ProcessTestRunAttachments(It.IsAny(), It.IsAny(), It.IsAny())); @@ -501,7 +503,7 @@ public void DesignModeClientConnectShouldSendTestMessageAndExecutionCompleteOnEx this.mockCommunicationManager.SetupSequence(cm => cm.ReceiveMessage()).Returns(testRunAll); this.mockCommunicationManager .Setup(cm => cm.SendMessage(MessageType.ExecutionComplete, It.IsAny())) - .Callback(() => this.complateEvent.Set()); + .Callback(() => this.completeEvent.Set()); this.mockTestRequestManager.Setup( rm => rm.RunTests( It.IsAny(), @@ -511,7 +513,7 @@ public void DesignModeClientConnectShouldSendTestMessageAndExecutionCompleteOnEx this.designModeClient.ConnectToClientAndProcessRequests(PortNumber, this.mockTestRequestManager.Object); - Assert.IsTrue(this.complateEvent.WaitOne(Timeout), "Execution not completed."); + Assert.IsTrue(this.completeEvent.WaitOne(Timeout), "Execution not completed."); this.mockCommunicationManager.Verify(cm => cm.SendMessage(MessageType.TestMessage, It.IsAny()), Times.Once()); this.mockCommunicationManager.Verify(cm => cm.SendMessage(MessageType.ExecutionComplete, It.IsAny()), Times.Once()); } @@ -525,7 +527,7 @@ public void DesignModeClientConnectShouldSendTestMessageAndExecutionCompleteOnTe this.mockCommunicationManager.SetupSequence(cm => cm.ReceiveMessage()).Returns(testRunAll); this.mockCommunicationManager .Setup(cm => cm.SendMessage(MessageType.ExecutionComplete, It.IsAny())) - .Callback(() => this.complateEvent.Set()); + .Callback(() => this.completeEvent.Set()); this.mockTestRequestManager.Setup( rm => rm.RunTests( It.IsAny(), @@ -535,11 +537,182 @@ public void DesignModeClientConnectShouldSendTestMessageAndExecutionCompleteOnTe this.designModeClient.ConnectToClientAndProcessRequests(PortNumber, this.mockTestRequestManager.Object); - Assert.IsTrue(this.complateEvent.WaitOne(Timeout), "Execution not completed."); + Assert.IsTrue(this.completeEvent.WaitOne(Timeout), "Execution not completed."); this.mockCommunicationManager.Verify(cm => cm.SendMessage(MessageType.TestMessage, It.IsAny()), Times.Once()); this.mockCommunicationManager.Verify(cm => cm.SendMessage(MessageType.ExecutionComplete, It.IsAny()), Times.Once()); } + [TestMethod] + public void DesignModeClientConnectShouldReturnNullSessionWhenStartTestSessionThrows() + { + var payload = new StartTestSessionPayload(); + var startTestSessionMessage = new Message() + { + MessageType = MessageType.StartTestSession, + Payload = JToken.FromObject(payload) + }; + + this.mockCommunicationManager.Setup(cm => cm.WaitForServerConnection(It.IsAny())).Returns(true); + this.mockCommunicationManager.SetupSequence(cm => cm.ReceiveMessage()).Returns(startTestSessionMessage); + this.mockCommunicationManager.Setup(cm => cm.SendMessage( + MessageType.StartTestSessionCallback, + It.IsAny())) + .Callback((string _, object actualPayload) => + { + this.completeEvent.Set(); + Assert.IsNull(((StartTestSessionAckPayload)actualPayload).TestSessionInfo); + }); + this.mockCommunicationManager.Setup( + cm => cm.DeserializePayload( + startTestSessionMessage)) + .Returns(payload); + + this.mockTestRequestManager.Setup( + rm => rm.StartTestSession( + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny())).Throws(new SettingsException("DummyException")); + + this.designModeClient.ConnectToClientAndProcessRequests(PortNumber, this.mockTestRequestManager.Object); + + Assert.IsTrue(this.completeEvent.WaitOne(Timeout), "Start test session not completed."); + this.mockCommunicationManager.Verify( + cm => cm.SendMessage( + MessageType.StartTestSessionCallback, + It.IsAny()), + Times.Once()); + } + + [TestMethod] + public void DesignModeClientConnectShouldReturnFalseWhenStopTestSessionThrows() + { + var mockTestPool = new Mock(); + TestSessionPool.Instance = mockTestPool.Object; + + var testSessionInfo = new TestSessionInfo(); + var stopTestSessionMessage = new Message() + { + MessageType = MessageType.StopTestSession, + Payload = JToken.FromObject(testSessionInfo) + }; + + this.mockCommunicationManager.Setup(cm => cm.WaitForServerConnection(It.IsAny())).Returns(true); + this.mockCommunicationManager.SetupSequence(cm => cm.ReceiveMessage()).Returns(stopTestSessionMessage); + this.mockCommunicationManager.Setup(cm => cm.SendMessage( + MessageType.StopTestSessionCallback, + It.IsAny())) + .Callback((string _, object actualPayload) => + { + this.completeEvent.Set(); + + Assert.AreEqual(((StopTestSessionAckPayload)actualPayload).TestSessionInfo, testSessionInfo); + Assert.IsFalse(((StopTestSessionAckPayload)actualPayload).IsStopped); + }); + + this.mockCommunicationManager.Setup( + cm => cm.DeserializePayload( + stopTestSessionMessage)) + .Returns(testSessionInfo); + + mockTestPool.Setup(tp => tp.KillSession(testSessionInfo)).Throws(new Exception("DummyException")); + + this.designModeClient.ConnectToClientAndProcessRequests(PortNumber, this.mockTestRequestManager.Object); + + Assert.IsTrue(this.completeEvent.WaitOne(Timeout), "Start test session not completed."); + this.mockCommunicationManager.Verify( + cm => cm.SendMessage( + MessageType.StopTestSessionCallback, + It.IsAny()), + Times.Once()); + } + + [TestMethod] + public void DesignModeClientConnectShouldReturnFalseWhenStopTestSessionReturnsFalse() + { + var mockTestPool = new Mock(); + TestSessionPool.Instance = mockTestPool.Object; + + var testSessionInfo = new TestSessionInfo(); + var stopTestSessionMessage = new Message() + { + MessageType = MessageType.StopTestSession, + Payload = JToken.FromObject(testSessionInfo) + }; + + this.mockCommunicationManager.Setup(cm => cm.WaitForServerConnection(It.IsAny())).Returns(true); + this.mockCommunicationManager.SetupSequence(cm => cm.ReceiveMessage()).Returns(stopTestSessionMessage); + this.mockCommunicationManager.Setup(cm => cm.SendMessage( + MessageType.StopTestSessionCallback, + It.IsAny())) + .Callback((string _, object actualPayload) => + { + this.completeEvent.Set(); + + Assert.AreEqual(((StopTestSessionAckPayload)actualPayload).TestSessionInfo, testSessionInfo); + Assert.IsFalse(((StopTestSessionAckPayload)actualPayload).IsStopped); + }); + + this.mockCommunicationManager.Setup( + cm => cm.DeserializePayload( + stopTestSessionMessage)) + .Returns(testSessionInfo); + + mockTestPool.Setup(tp => tp.KillSession(testSessionInfo)).Returns(false); + + this.designModeClient.ConnectToClientAndProcessRequests(PortNumber, this.mockTestRequestManager.Object); + + Assert.IsTrue(this.completeEvent.WaitOne(Timeout), "Start test session not completed."); + this.mockCommunicationManager.Verify( + cm => cm.SendMessage( + MessageType.StopTestSessionCallback, + It.IsAny()), + Times.Once()); + } + + [TestMethod] + public void DesignModeClientConnectShouldReturnTruenWhenStopTestSessionReturnsTrue() + { + var mockTestPool = new Mock(); + TestSessionPool.Instance = mockTestPool.Object; + + var testSessionInfo = new TestSessionInfo(); + var stopTestSessionMessage = new Message() + { + MessageType = MessageType.StopTestSession, + Payload = JToken.FromObject(testSessionInfo) + }; + + this.mockCommunicationManager.Setup(cm => cm.WaitForServerConnection(It.IsAny())).Returns(true); + this.mockCommunicationManager.SetupSequence(cm => cm.ReceiveMessage()).Returns(stopTestSessionMessage); + this.mockCommunicationManager.Setup(cm => cm.SendMessage( + MessageType.StopTestSessionCallback, + It.IsAny())) + .Callback((string _, object actualPayload) => + { + this.completeEvent.Set(); + + Assert.AreEqual(((StopTestSessionAckPayload)actualPayload).TestSessionInfo, testSessionInfo); + Assert.IsTrue(((StopTestSessionAckPayload)actualPayload).IsStopped); + }); + + this.mockCommunicationManager.Setup( + cm => cm.DeserializePayload( + stopTestSessionMessage)) + .Returns(testSessionInfo); + + mockTestPool.Setup(tp => tp.KillSession(testSessionInfo)).Returns(true); + + this.designModeClient.ConnectToClientAndProcessRequests(PortNumber, this.mockTestRequestManager.Object); + + Assert.IsTrue(this.completeEvent.WaitOne(Timeout), "Start test session not completed."); + this.mockCommunicationManager.Verify( + cm => cm.SendMessage( + MessageType.StopTestSessionCallback, + It.IsAny()), + Times.Once()); + } + [TestMethod] public void DesignModeClientSendTestMessageShouldSendTestMessage() { diff --git a/test/Microsoft.TestPlatform.Client.UnitTests/TestPlatformTests.cs b/test/Microsoft.TestPlatform.Client.UnitTests/TestPlatformTests.cs index a9fe291f15..a0402eaa98 100644 --- a/test/Microsoft.TestPlatform.Client.UnitTests/TestPlatformTests.cs +++ b/test/Microsoft.TestPlatform.Client.UnitTests/TestPlatformTests.cs @@ -505,6 +505,145 @@ public void CreateDiscoveryRequestShouldInitializeLoggerManagerForNonDesignMode( this.loggerManager.Verify(lm => lm.Initialize(settingsXml)); } + [TestMethod] + public void StartTestSessionShouldThrowExceptionIfTestSessionCriteriaIsNull() + { + var tp = new TestableTestPlatform(this.testEngine.Object, this.hostManager.Object); + + Assert.ThrowsException(() => + tp.StartTestSession( + new Mock().Object, + null, + new Mock().Object)); + } + + [TestMethod] + public void StartTestSessionShouldReturnFalseIfDesignModeIsDisabled() + { + var tp = new TestableTestPlatform(this.testEngine.Object, this.hostManager.Object); + + var testSessionCriteria = new StartTestSessionCriteria() + { + RunSettings = @" + + + false + + " + }; + + Assert.IsFalse( + tp.StartTestSession( + new Mock().Object, + testSessionCriteria, + new Mock().Object)); + } + + [TestMethod] + public void StartTestSessionShouldReturnFalseIfTestSessionManagerIsNull() + { + this.testEngine.Setup( + te => te.GetTestSessionManager( + It.IsAny(), + It.IsAny())) + .Returns((IProxyTestSessionManager)null); + + var tp = new TestableTestPlatform(this.testEngine.Object, this.hostManager.Object); + var mockEventsHandler = new Mock(); + + var testSessionCriteria = new StartTestSessionCriteria() + { + RunSettings = @" + + + true + + " + }; + + Assert.IsFalse( + tp.StartTestSession( + new Mock().Object, + testSessionCriteria, + mockEventsHandler.Object)); + + mockEventsHandler.Verify( + eh => eh.HandleStartTestSessionComplete(null), + Times.Once); + } + + [TestMethod] + public void StartTestSessionShouldReturnTrueIfTestSessionManagerStartSessionReturnsTrue() + { + var tp = new TestableTestPlatform(this.testEngine.Object, this.hostManager.Object); + + var testSessionCriteria = new StartTestSessionCriteria() + { + RunSettings = @" + + + true + + " + }; + + var mockEventsHandler = new Mock(); + var mockTestSessionManager = new Mock(); + mockTestSessionManager.Setup( + tsm => tsm.StartSession(It.IsAny())) + .Returns(true); + this.testEngine.Setup( + te => te.GetTestSessionManager( + It.IsAny(), + It.IsAny())) + .Returns(mockTestSessionManager.Object); + + Assert.IsTrue( + tp.StartTestSession( + new Mock().Object, + testSessionCriteria, + mockEventsHandler.Object)); + + mockTestSessionManager.Verify( + tsm => tsm.StartSession(mockEventsHandler.Object)); + } + + [TestMethod] + public void StartTestSessionShouldReturnFalseIfTestSessionManagerStartSessionReturnsFalse() + { + var tp = new TestableTestPlatform(this.testEngine.Object, this.hostManager.Object); + + var testSessionCriteria = new StartTestSessionCriteria() + { + RunSettings = @" + + + true + + " + }; + + var mockEventsHandler = new Mock(); + var mockTestSessionManager = new Mock(); + mockTestSessionManager.Setup( + tsm => tsm.StartSession(It.IsAny())) + .Returns(false); + this.testEngine.Setup( + te => te.GetTestSessionManager( + It.IsAny(), + It.IsAny())) + .Returns(mockTestSessionManager.Object); + + Assert.IsFalse( + tp.StartTestSession( + new Mock().Object, + testSessionCriteria, + mockEventsHandler.Object)); + + mockTestSessionManager.Verify( + tsm => tsm.StartSession(mockEventsHandler.Object)); + } + private void InvokeCreateDiscoveryRequest(TestPlatformOptions options = null) { this.discoveryManager.Setup(dm => dm.Initialize(false)).Verifiable(); diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/TestEngineTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/TestEngineTests.cs index 20cf8a5af7..87ee90db47 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/TestEngineTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/TestEngineTests.cs @@ -11,6 +11,7 @@ namespace TestPlatform.CrossPlatEngine.UnitTests using Microsoft.TestPlatform.CrossPlatEngine.UnitTests.TestableImplementations; using Microsoft.TestPlatform.TestUtilities; using Microsoft.VisualStudio.TestPlatform.Common.Telemetry; + using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine; using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client; using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.Parallel; using Microsoft.VisualStudio.TestPlatform.ObjectModel; @@ -536,5 +537,346 @@ public void GetLoggerManagerShouldAlwaysReturnNewInstance() { Assert.AreNotSame(this.testEngine.GetLoggerManager(mockRequestData.Object), this.testEngine.GetLoggerManager(mockRequestData.Object)); } + + [TestMethod] + public void GetTestSessionManagerShouldReturnAValidInstance() + { + var settingXml = @"true"; + var testSessionCriteria = new StartTestSessionCriteria() + { + Sources = new List { "1.dll" }, + RunSettings = settingXml + }; + + Assert.IsNotNull(this.testEngine.GetTestSessionManager( + this.mockRequestData.Object, + testSessionCriteria)); + } + + [TestMethod] + public void GetTestSessionManagerShouldReturnNewInstance() + { + var settingXml = @"true"; + var testSessionCriteria = new StartTestSessionCriteria() + { + Sources = new List { "1.dll" }, + RunSettings = settingXml + }; + + var testSessionManager1 = this.testEngine.GetTestSessionManager( + this.mockRequestData.Object, + testSessionCriteria); + + Assert.AreNotSame( + this.testEngine.GetTestSessionManager( + this.mockRequestData.Object, + testSessionCriteria), + testSessionManager1); + } + + [TestMethod] + public void GetTestSessionManagerShouldReturnDefaultTestSessionManagerIfParallelDisabled() + { + var settingXml = @"true"; + var testSessionCriteria = new StartTestSessionCriteria() + { + Sources = new List { "1.dll" }, + RunSettings = settingXml + }; + + var testSessionManager = this.testEngine.GetTestSessionManager( + this.mockRequestData.Object, + testSessionCriteria); + + Assert.IsNotNull(testSessionManager); + Assert.IsInstanceOfType(testSessionManager, typeof(ProxyTestSessionManager)); + } + + [TestMethod] + public void GetTestSessionManagerShouldReturnDefaultTestSessionManagerEvenIfParallelEnabled() + { + string settingXml = + @" + + 2 + true + + "; + var testSessionCriteria = new StartTestSessionCriteria() + { + Sources = new List { "1.dll" }, + RunSettings = settingXml + }; + + var testSessionManager = this.testEngine.GetTestSessionManager( + this.mockRequestData.Object, + testSessionCriteria); + + Assert.IsNotNull(testSessionManager); + Assert.IsInstanceOfType(testSessionManager, typeof(ProxyTestSessionManager)); + } + + [TestMethod] + public void GetTestSessionManagerShouldReturnDefaultTestSessionManagerIfParallelEnabled() + { + string settingXml = @"2"; + var testSessionCriteria = new StartTestSessionCriteria() + { + Sources = new List { "1.dll", "2.dll" }, + RunSettings = settingXml + }; + + var testSessionManager = this.testEngine.GetTestSessionManager( + this.mockRequestData.Object, + testSessionCriteria); + + Assert.IsNotNull(testSessionManager); + Assert.IsInstanceOfType(testSessionManager, typeof(ProxyTestSessionManager)); + } + + [TestMethod] + public void GetTestSessionManagerShouldReturnDefaultTestSessionManagerIfHostIsNotShared() + { + string settingXml = + @" + + true + + "; + var testSessionCriteria = new StartTestSessionCriteria() + { + Sources = new List { "1.dll", "2.dll" }, + RunSettings = settingXml + }; + + var testSessionManager = this.testEngine.GetTestSessionManager( + this.mockRequestData.Object, + testSessionCriteria); + + Assert.IsNotNull(testSessionManager); + Assert.IsInstanceOfType(testSessionManager, typeof(ProxyTestSessionManager)); + } + + [TestMethod] + public void GetTestSessionManagerShouldReturnDefaultTestSessionManagerIfDataCollectionIsEnabled() + { + var settingXml = + @" + + + + + + + "; + var testSessionCriteria = new StartTestSessionCriteria() + { + Sources = new List { "1.dll" }, + RunSettings = settingXml + }; + + var testSessionManager = this.testEngine.GetTestSessionManager( + this.mockRequestData.Object, + testSessionCriteria); + + Assert.IsNotNull(testSessionManager); + Assert.IsInstanceOfType(testSessionManager, typeof(ProxyTestSessionManager)); + } + + [TestMethod] + public void GetTestSessionManagerShouldReturnNullWhenTargetFrameworkIsNetFramework() + { + var settingXml = + @" + + .NETFramework, Version=v4.5 + + "; + var testSessionCriteria = new StartTestSessionCriteria() + { + Sources = new List { "1.dll" }, + RunSettings = settingXml + }; + + Assert.IsNull(this.testEngine.GetTestSessionManager( + this.mockRequestData.Object, + testSessionCriteria)); + } + + [TestMethod] + public void GetTestSessionManagerShouldReturnNotNullIfCurrentProcessIsDotnet() + { + var testSessionCriteria = new StartTestSessionCriteria() + { + Sources = new List { "1.dll" }, + RunSettings = null + }; + this.mockProcessHelper.Setup(ph => ph.GetCurrentProcessFileName()).Returns("dotnet.exe"); + + var testSessionManager = this.testEngine.GetTestSessionManager( + this.mockRequestData.Object, + testSessionCriteria); + + Assert.IsNotNull(testSessionManager); + } + + [TestMethod] + public void GetTestSessionManagerShouldReturnNotNullIfDisableAppDomainIsSet() + { + string settingXml = + @" + + x86 + true + false + .NETFramework, Version=v4.5 + + "; + + var testSessionCriteria = new StartTestSessionCriteria() + { + Sources = new List { "1.dll" }, + RunSettings = settingXml + }; + + var testSessionManager = this.testEngine.GetTestSessionManager( + this.mockRequestData.Object, + testSessionCriteria); + + Assert.IsNotNull(testSessionManager); + } + + [TestMethod] + public void GetTestSessionManagerShouldReturnNotNullIfDesignModeIsTrue() + { + string settingXml = + @" + + x86 + false + true + .NETFramework, Version=v4.5 + + "; + + var testSessionCriteria = new StartTestSessionCriteria() + { + Sources = new List { "1.dll" }, + RunSettings = settingXml + }; + + var testSessionManager = this.testEngine.GetTestSessionManager( + this.mockRequestData.Object, + testSessionCriteria); + + Assert.IsNotNull(testSessionManager); + } + + [TestMethod] + public void GetTestSessionManagerShouldReturnNotNullIfTargetFrameworkIsNetcoreApp() + { + string settingXml = + @" + + x86 + false + false + .NETCoreApp, Version=v1.1 + + "; + + var testSessionCriteria = new StartTestSessionCriteria() + { + Sources = new List { "1.dll" }, + RunSettings = settingXml + }; + + var testSessionManager = this.testEngine.GetTestSessionManager( + this.mockRequestData.Object, + testSessionCriteria); + + Assert.IsNotNull(testSessionManager); + } + + [TestMethod] + public void GetTestSessionManagerShouldReturnNotNullIfTargetFrameworkIsNetStandard() + { + string settingXml = + @" + + x86 + false + false + .NETStandard, Version=v1.4 + + "; + + var testSessionCriteria = new StartTestSessionCriteria() + { + Sources = new List { "1.dll" }, + RunSettings = settingXml + }; + + var testSessionManager = this.testEngine.GetTestSessionManager( + this.mockRequestData.Object, + testSessionCriteria); + + Assert.IsNotNull(testSessionManager); + } + + [TestMethod] + public void GetTestSessionManagerShouldReturnNotNullIfTargetPlatformIsX64() + { + string settingXml = + @" + + x64 + false + false + .NETStandard, Version=v1.4 + + "; + + var testSessionCriteria = new StartTestSessionCriteria() + { + Sources = new List { "1.dll" }, + RunSettings = settingXml + }; + + var testSessionManager = this.testEngine.GetTestSessionManager( + this.mockRequestData.Object, + testSessionCriteria); + + Assert.IsNotNull(testSessionManager); + } + + [TestMethod] + public void GetTestSessionManagerShouldReturnNotNullIfRunSettingsHasTestSettingsInIt() + { + string settingXml = + @" + + x86 + false + false + .NETFramework, Version=v4.5 + + + C:\temp.testsettings + + "; + + var testSessionCriteria = new StartTestSessionCriteria() + { + Sources = new List { "1.dll" }, + RunSettings = settingXml + }; + + var testSessionManager = this.testEngine.GetTestSessionManager( + this.mockRequestData.Object, + testSessionCriteria); + + Assert.IsNotNull(testSessionManager); + } } } diff --git a/test/vstest.console.UnitTests/TestPlatformHelpers/TestRequestManagerTests.cs b/test/vstest.console.UnitTests/TestPlatformHelpers/TestRequestManagerTests.cs index 9b4c08dfec..acc66e97a3 100644 --- a/test/vstest.console.UnitTests/TestPlatformHelpers/TestRequestManagerTests.cs +++ b/test/vstest.console.UnitTests/TestPlatformHelpers/TestRequestManagerTests.cs @@ -22,6 +22,7 @@ namespace vstest.console.UnitTests.TestPlatformHelpers using Microsoft.VisualStudio.TestPlatform.ObjectModel; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.Interfaces; + using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.Payloads; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Utilities; using Microsoft.VisualStudio.TestTools.UnitTesting; @@ -2263,6 +2264,155 @@ public void CancelTestRunAttachmentsProcessingShouldSucceedIfNoRequest() testRequestManager.CancelTestRunAttachmentsProcessing(); } + [TestMethod] + public void StartTestSessionShouldPassCorrectTelemetryOptedInOptionToTestPlatform() + { + this.mockTestPlatform.Setup( + tp => tp.StartTestSession( + It.IsAny(), + It.IsAny(), + It.IsAny())) + .Returns(true) + .Callback( + (IRequestData rd, StartTestSessionCriteria _, ITestSessionEventsHandler __) => + { + Assert.IsTrue(rd.IsTelemetryOptedIn); + }); + + Environment.SetEnvironmentVariable("VSTEST_TELEMETRY_OPTEDIN", "1"); + + this.testRequestManager.StartTestSession( + new StartTestSessionPayload() + { + TestPlatformOptions = new TestPlatformOptions() + { + CollectMetrics = true + } + }, + new Mock().Object, + new Mock().Object, + this.protocolConfig); + } + + [TestMethod] + public void StartTestSessionShouldUpdateSettings() + { + var payload = new StartTestSessionPayload() + { + Sources = new List() { "a.dll" }, + RunSettings = + @" + + + + " + }; + this.commandLineOptions.IsDesignMode = true; + + this.mockAssemblyMetadataProvider.Setup( + a => a.GetArchitecture(It.IsAny())) + .Returns(Architecture.ARM); + this.mockAssemblyMetadataProvider.Setup( + a => a.GetFrameWork(It.IsAny())) + .Returns(new FrameworkName(Constants.DotNetFramework46)); + + this.mockTestPlatform.Setup( + tp => tp.StartTestSession( + It.IsAny(), + It.IsAny(), + It.IsAny())) + .Returns(true) + .Callback( + (IRequestData _, StartTestSessionCriteria criteria, ITestSessionEventsHandler __) => + { + Assert.IsTrue(criteria.RunSettings.Contains(Constants.DotNetFramework46)); + Assert.IsTrue(criteria.RunSettings.Contains(nameof(Architecture.ARM))); + }); + + this.testRequestManager.StartTestSession( + payload, + new Mock().Object, + new Mock().Object, + this.protocolConfig); + + this.mockAssemblyMetadataProvider.Verify(a => a.GetArchitecture(It.IsAny())); + this.mockAssemblyMetadataProvider.Verify(a => a.GetFrameWork(It.IsAny())); + } + + [TestMethod] + public void StartTestSessionShouldThrowSettingsExceptionWhenFindingIncompatibleDataCollectorsInTestSettings() + { + var settingXml = @" + + C:\temp.testsettings + true + + + + + + + + + + "; + + var payload = new StartTestSessionPayload() + { + Sources = new List() { "a.dll" }, + RunSettings = settingXml + }; + + this.commandLineOptions.EnableCodeCoverage = false; + bool exceptionThrown = false; + + try + { + this.testRequestManager.StartTestSession( + payload, + new Mock().Object, + new Mock().Object, + this.protocolConfig); + } + catch (SettingsException ex) + { + exceptionThrown = true; + Assert.IsTrue(ex.Message.Contains(@"C:\temp.testsettings"), ex.Message); + } + + Assert.IsTrue(exceptionThrown, "Initialize should throw exception"); + } + + [TestMethod] + public void X() + { + this.mockTestPlatform.Setup( + tp => tp.StartTestSession( + It.IsAny(), + It.IsAny(), + It.IsAny())) + .Returns(true); + + this.testRequestManager.StartTestSession( + new StartTestSessionPayload() + { + TestPlatformOptions = new TestPlatformOptions() + { + CollectMetrics = true + } + }, + new Mock().Object, + new Mock().Object, + this.protocolConfig); + + this.mockTestPlatformEventSource.Verify( + tpes => tpes.StartTestSessionStart(), + Times.Once()); + this.mockTestPlatformEventSource.Verify( + tpes => tpes.StartTestSessionStop(), + Times.Once()); + } + private static DiscoveryRequestPayload CreateDiscoveryPayload(string runsettings) { var discoveryPayload = new DiscoveryRequestPayload From a64fd3728a6b33357a1eefeae6cc666d24ad46db Mon Sep 17 00:00:00 2001 From: Codrin Poienaru Date: Mon, 25 Oct 2021 22:44:28 +0200 Subject: [PATCH 23/26] Added more tests --- .../Client/ProxyDiscoveryManagerTests.cs | 46 ++++++++++++++++++ .../Client/ProxyExecutionManagerTests.cs | 47 +++++++++++++++++++ .../TestRequestManagerTests.cs | 2 +- 3 files changed, 94 insertions(+), 1 deletion(-) diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyDiscoveryManagerTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyDiscoveryManagerTests.cs index 79d9a8f80f..796c42b979 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyDiscoveryManagerTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyDiscoveryManagerTests.cs @@ -15,6 +15,7 @@ namespace TestPlatform.CrossPlatEngine.UnitTests.Client using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities; using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.Interfaces; using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.ObjectModel; + using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine; using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client; using Microsoft.VisualStudio.TestPlatform.ObjectModel; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client; @@ -507,6 +508,51 @@ public void AbortShouldSendTestDiscoveryCancelIfCommunicationSuccessful() this.mockRequestSender.Verify(s => s.EndSession(), Times.Once); } + [TestMethod] + public void StartTestRunShouldAttemptToTakeProxyFromPoolIfProxyIsNull() + { + var testSessionInfo = new TestSessionInfo(); + var testDiscoveryManager = new ProxyDiscoveryManager( + testSessionInfo, + string.Empty, + this.mockRequestData.Object, + this.mockRequestSender.Object, + this.mockTestHostManager.Object); + + var mockTestSessionPool = new Mock(); + TestSessionPool.Instance = mockTestSessionPool.Object; + + try + { + var mockProxyOperationManager = new Mock( + this.mockRequestData.Object, + this.mockRequestSender.Object, + this.mockTestHostManager.Object); + mockTestSessionPool.Setup( + tsp => tsp.TakeProxy( + testSessionInfo, + It.IsAny(), + It.IsAny())) + .Returns(mockProxyOperationManager.Object); + + testDiscoveryManager.Initialize(true); + testDiscoveryManager.DiscoverTests( + discoveryCriteria, + new Mock().Object); + + mockTestSessionPool.Verify( + tsp => tsp.TakeProxy( + testSessionInfo, + It.IsAny(), + It.IsAny()), + Times.Once); + } + finally + { + TestSessionPool.Instance = null; + } + } + private void InvokeAndVerifyDiscoverTests(bool skipDefaultAdapters) { TestPluginCache.Instance = null; diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyExecutionManagerTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyExecutionManagerTests.cs index 4b25cbf6e4..5a7848c089 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyExecutionManagerTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyExecutionManagerTests.cs @@ -28,6 +28,7 @@ namespace TestPlatform.CrossPlatEngine.UnitTests.Client using Microsoft.VisualStudio.TestPlatform.Utilities.Helpers.Interfaces; using CrossPlatEngineResources = Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Resources; + using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine; [TestClass] public class ProxyExecutionManagerTests : ProxyBaseManagerTests @@ -742,6 +743,52 @@ public void ExecutionManagerShouldPassOnLaunchProcessWithDebuggerAttached() mockTestRunEventsHandler.Verify(mtdeh => mtdeh.LaunchProcessWithDebuggerAttached(It.IsAny()), Times.Once); } + [TestMethod] + public void StartTestRunShouldAttemptToTakeProxyFromPoolIfProxyIsNull() + { + var testSessionInfo = new TestSessionInfo(); + var testExecutionManager = new ProxyExecutionManager( + testSessionInfo, + string.Empty, + false, + this.mockRequestData.Object, + this.mockRequestSender.Object, + this.mockTestHostManager.Object); + + var mockTestSessionPool = new Mock(); + TestSessionPool.Instance = mockTestSessionPool.Object; + + try + { + var mockProxyOperationManager = new Mock( + this.mockRequestData.Object, + this.mockRequestSender.Object, + this.mockTestHostManager.Object); + mockTestSessionPool.Setup( + tsp => tsp.TakeProxy( + testSessionInfo, + It.IsAny(), + It.IsAny())) + .Returns(mockProxyOperationManager.Object); + + testExecutionManager.Initialize(true); + testExecutionManager.StartTestRun( + this.mockTestRunCriteria.Object, + new Mock().Object); + + mockTestSessionPool.Verify( + tsp => tsp.TakeProxy( + testSessionInfo, + It.IsAny(), + It.IsAny()), + Times.Once); + } + finally + { + TestSessionPool.Instance = null; + } + } + private void SignalEvent(ManualResetEvent manualResetEvent) { // Wait for the 100 ms. diff --git a/test/vstest.console.UnitTests/TestPlatformHelpers/TestRequestManagerTests.cs b/test/vstest.console.UnitTests/TestPlatformHelpers/TestRequestManagerTests.cs index acc66e97a3..d8440633b5 100644 --- a/test/vstest.console.UnitTests/TestPlatformHelpers/TestRequestManagerTests.cs +++ b/test/vstest.console.UnitTests/TestPlatformHelpers/TestRequestManagerTests.cs @@ -2384,7 +2384,7 @@ public void StartTestSessionShouldThrowSettingsExceptionWhenFindingIncompatibleD } [TestMethod] - public void X() + public void StartTestSessionShouldBeSuccessful() { this.mockTestPlatform.Setup( tp => tp.StartTestSession( From b80b57888b83d72854d507d22e4ceef0e38f4cf2 Mon Sep 17 00:00:00 2001 From: Codrin Poienaru Date: Thu, 4 Nov 2021 18:08:11 +0100 Subject: [PATCH 24/26] Added Obsolete attributes to mark the API isn't final --- .../Interfaces/ITestSession.cs | 17 +++++++++++ .../Interfaces/ITestSessionAsync.cs | 16 ++++++++++ .../Interfaces/IVsTestConsoleWrapper.cs | 5 ++++ .../Interfaces/IVsTestConsoleWrapperAsync.cs | 5 ++++ .../TestSession.cs | 30 +++++++++++++++++++ .../VsTestConsoleWrapper.cs | 9 ++++++ 6 files changed, 82 insertions(+) diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSession.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSession.cs index 965e7f6178..2fbb324371 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSession.cs +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSession.cs @@ -14,11 +14,13 @@ namespace Microsoft.VisualStudio.TestPlatform.VsTestConsole.TranslationLayer.Int /// Defines a test session that can be used to make calls to the vstest.console /// process. /// + [Obsolete("This API is not final yet and is subject to changes.", false)] public interface ITestSession : IDisposable, ITestSessionAsync { /// /// Gets the underlying test session info object. /// + [Obsolete("This API is not final yet and is subject to changes.", false)] TestSessionInfo TestSessionInfo { get; } /// @@ -28,6 +30,7 @@ public interface ITestSession : IDisposable, ITestSessionAsync /// The list of source assemblies for the discovery. /// The run settings for the discovery. /// The discovery event handler. + [Obsolete("This API is not final yet and is subject to changes.", false)] void DiscoverTests( IEnumerable sources, string discoverySettings, @@ -41,6 +44,7 @@ void DiscoverTests( /// The run settings for the discovery. /// The test platform options. /// The discovery event handler. + [Obsolete("This API is not final yet and is subject to changes.", false)] void DiscoverTests( IEnumerable sources, string discoverySettings, @@ -50,6 +54,7 @@ void DiscoverTests( /// /// Cancels the last discovery request. /// + [Obsolete("This API is not final yet and is subject to changes.", false)] new void CancelDiscovery(); /// @@ -59,6 +64,7 @@ void DiscoverTests( /// The list of source assemblies for the test run. /// The run settings for the run. /// The run event handler. + [Obsolete("This API is not final yet and is subject to changes.", false)] void RunTests( IEnumerable sources, string runSettings, @@ -72,6 +78,7 @@ void RunTests( /// The run settings for the run. /// The test platform options. /// The run event handler. + [Obsolete("This API is not final yet and is subject to changes.", false)] void RunTests( IEnumerable sources, string runSettings, @@ -85,6 +92,7 @@ void RunTests( /// The list of test cases for the test run. /// The run settings for the run. /// The run event handler. + [Obsolete("This API is not final yet and is subject to changes.", false)] void RunTests( IEnumerable testCases, string runSettings, @@ -98,6 +106,7 @@ void RunTests( /// The run settings for the run. /// The test platform options. /// The run event handler. + [Obsolete("This API is not final yet and is subject to changes.", false)] void RunTests( IEnumerable testCases, string runSettings, @@ -112,6 +121,7 @@ void RunTests( /// 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, @@ -127,6 +137,7 @@ void RunTestsWithCustomTestHost( /// 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, @@ -142,6 +153,7 @@ void RunTestsWithCustomTestHost( /// 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, @@ -157,6 +169,7 @@ void RunTestsWithCustomTestHost( /// 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, @@ -169,6 +182,7 @@ void RunTestsWithCustomTestHost( /// /// /// True if the session was successfuly stopped, false otherwise. + [Obsolete("This API is not final yet and is subject to changes.", false)] bool StopTestSession(); /// @@ -178,16 +192,19 @@ void RunTestsWithCustomTestHost( /// The session event handler. /// /// True if the session was successfuly stopped, false otherwise. + [Obsolete("This API is not final yet and is subject to changes.", false)] bool StopTestSession(ITestSessionEventsHandler eventsHandler); /// /// Cancels the last test run. /// + [Obsolete("This API is not final yet and is subject to changes.", false)] new void CancelTestRun(); /// /// Aborts the last test run. /// + [Obsolete("This API is not final yet and is subject to changes.", false)] new void AbortTestRun(); } } diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSessionAsync.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSessionAsync.cs index dc2f9d125d..6846ca7788 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSessionAsync.cs +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/ITestSessionAsync.cs @@ -15,6 +15,7 @@ namespace Microsoft.VisualStudio.TestPlatform.VsTestConsole.TranslationLayer.Int /// Defines a test session that can be used to make async calls to the vstest.console /// process. /// + [Obsolete("This API is not final yet and is subject to changes.", false)] public interface ITestSessionAsync : IDisposable { /// @@ -25,6 +26,7 @@ public interface ITestSessionAsync : IDisposable /// The run settings for the discovery. /// The discovery event handler. /// + [Obsolete("This API is not final yet and is subject to changes.", false)] Task DiscoverTestsAsync( IEnumerable sources, string discoverySettings, @@ -38,6 +40,7 @@ Task DiscoverTestsAsync( /// The run settings for the discovery. /// The test platform options. /// The discovery event handler. + [Obsolete("This API is not final yet and is subject to changes.", false)] Task DiscoverTestsAsync( IEnumerable sources, string discoverySettings, @@ -47,6 +50,7 @@ Task DiscoverTestsAsync( /// /// Cancels the last discovery request. /// + [Obsolete("This API is not final yet and is subject to changes.", false)] void CancelDiscovery(); /// @@ -56,6 +60,7 @@ Task DiscoverTestsAsync( /// The list of source assemblies for the test run. /// The run settings for the run. /// The run event handler. + [Obsolete("This API is not final yet and is subject to changes.", false)] Task RunTestsAsync( IEnumerable sources, string runSettings, @@ -69,6 +74,7 @@ Task RunTestsAsync( /// The run settings for the run. /// The test platform options. /// The run event handler. + [Obsolete("This API is not final yet and is subject to changes.", false)] Task RunTestsAsync( IEnumerable sources, string runSettings, @@ -82,6 +88,7 @@ Task RunTestsAsync( /// The list of test cases for the test run. /// The run settings for the run. /// The run event handler. + [Obsolete("This API is not final yet and is subject to changes.", false)] Task RunTestsAsync( IEnumerable testCases, string runSettings, @@ -95,6 +102,7 @@ Task RunTestsAsync( /// The run settings for the run. /// The test platform options. /// The run event handler. + [Obsolete("This API is not final yet and is subject to changes.", false)] Task RunTestsAsync( IEnumerable testCases, string runSettings, @@ -109,6 +117,7 @@ Task RunTestsAsync( /// 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, @@ -124,6 +133,7 @@ Task RunTestsWithCustomTestHostAsync( /// 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, @@ -139,6 +149,7 @@ Task RunTestsWithCustomTestHostAsync( /// 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, @@ -154,6 +165,7 @@ Task RunTestsWithCustomTestHostAsync( /// 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, @@ -166,6 +178,7 @@ Task RunTestsWithCustomTestHostAsync( /// /// /// True if the session was successfuly stopped, false otherwise. + [Obsolete("This API is not final yet and is subject to changes.", false)] Task StopTestSessionAsync(); /// @@ -175,17 +188,20 @@ Task RunTestsWithCustomTestHostAsync( /// The session event handler. /// /// True if the session was successfuly stopped, false otherwise. + [Obsolete("This API is not final yet and is subject to changes.", false)] Task StopTestSessionAsync( ITestSessionEventsHandler eventsHandler); /// /// Cancels the last test run. /// + [Obsolete("This API is not final yet and is subject to changes.", false)] void CancelTestRun(); /// /// Aborts the last test run. /// + [Obsolete("This API is not final yet and is subject to changes.", false)] void AbortTestRun(); } } diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/IVsTestConsoleWrapper.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/IVsTestConsoleWrapper.cs index 0983d0d074..23dde8cbae 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/IVsTestConsoleWrapper.cs +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/IVsTestConsoleWrapper.cs @@ -3,6 +3,7 @@ namespace Microsoft.TestPlatform.VsTestConsole.TranslationLayer.Interfaces { + using System; using System.Collections.Generic; using Microsoft.VisualStudio.TestPlatform.ObjectModel; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client; @@ -28,6 +29,7 @@ public interface IVsTestConsoleWrapper : IVsTestConsoleWrapperAsync /// The session event handler. /// /// A test session info object. + [Obsolete("This API is not final yet and is subject to changes.", false)] ITestSession StartTestSession( IList sources, string runSettings, @@ -43,6 +45,7 @@ ITestSession StartTestSession( /// The session event handler. /// /// A test session info object. + [Obsolete("This API is not final yet and is subject to changes.", false)] ITestSession StartTestSession( IList sources, string runSettings, @@ -60,6 +63,7 @@ ITestSession StartTestSession( /// The custom host launcher. /// /// A test session info object. + [Obsolete("This API is not final yet and is subject to changes.", false)] ITestSession StartTestSession( IList sources, string runSettings, @@ -75,6 +79,7 @@ ITestSession StartTestSession( /// The session event handler. /// /// True if the session was successfuly stopped, false otherwise. + [Obsolete("This API is not final yet and is subject to changes.", false)] bool StopTestSession( TestSessionInfo testSessionInfo, ITestSessionEventsHandler eventsHandler); diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/IVsTestConsoleWrapperAsync.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/IVsTestConsoleWrapperAsync.cs index f1e5f987de..3474af900f 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/IVsTestConsoleWrapperAsync.cs +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Interfaces/IVsTestConsoleWrapperAsync.cs @@ -3,6 +3,7 @@ namespace Microsoft.TestPlatform.VsTestConsole.TranslationLayer.Interfaces { + using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; @@ -29,6 +30,7 @@ public interface IVsTestConsoleWrapperAsync /// string, /// ITestSessionEventsHandler)"/>. /// + [Obsolete("This API is not final yet and is subject to changes.", false)] Task StartTestSessionAsync( IList sources, string runSettings, @@ -42,6 +44,7 @@ Task StartTestSessionAsync( /// TestPlatformOptions, /// ITestSessionEventsHandler)"/>. /// + [Obsolete("This API is not final yet and is subject to changes.", false)] Task StartTestSessionAsync( IList sources, string runSettings, @@ -57,6 +60,7 @@ Task StartTestSessionAsync( /// ITestSessionEventsHandler, /// ITestHostLauncher)"/>. /// + [Obsolete("This API is not final yet and is subject to changes.", false)] Task StartTestSessionAsync( IList sources, string runSettings, @@ -70,6 +74,7 @@ Task StartTestSessionAsync( /// TestSessionInfo, /// ITestSessionEventsHandler)"/>. /// + [Obsolete("This API is not final yet and is subject to changes.", false)] Task StopTestSessionAsync( TestSessionInfo testSessionInfo, ITestSessionEventsHandler eventsHandler); diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/TestSession.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/TestSession.cs index 483fed2450..9db1bf6fc3 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/TestSession.cs +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/TestSession.cs @@ -17,6 +17,7 @@ namespace Microsoft.TestPlatform.VsTestConsole.TranslationLayer /// Defines a test session object that can be used to make calls to the vstest.console /// process. /// + [Obsolete("This API is not final yet and is subject to changes.", false)] public class TestSession : ITestSession { private bool disposed = false; @@ -26,6 +27,7 @@ public class TestSession : ITestSession #region Properties /// + [Obsolete("This API is not final yet and is subject to changes.", false)] public TestSessionInfo TestSessionInfo { get; private set; } #endregion @@ -55,6 +57,7 @@ public TestSession( /// /// Disposes of the current instance of the class. /// + [Obsolete("This API is not final yet and is subject to changes.", false)] public void Dispose() { this.Dispose(true); @@ -80,24 +83,28 @@ protected virtual void Dispose(bool disposing) #region ITestSession /// + [Obsolete("This API is not final yet and is subject to changes.", false)] public void AbortTestRun() { this.consoleWrapper.AbortTestRun(); } /// + [Obsolete("This API is not final yet and is subject to changes.", false)] public void CancelDiscovery() { this.consoleWrapper.CancelDiscovery(); } /// + [Obsolete("This API is not final yet and is subject to changes.", false)] public void CancelTestRun() { this.consoleWrapper.CancelTestRun(); } /// + [Obsolete("This API is not final yet and is subject to changes.", false)] public void DiscoverTests( IEnumerable sources, string discoverySettings, @@ -111,6 +118,7 @@ public void DiscoverTests( } /// + [Obsolete("This API is not final yet and is subject to changes.", false)] public void DiscoverTests( IEnumerable sources, string discoverySettings, @@ -126,6 +134,7 @@ public void DiscoverTests( } /// + [Obsolete("This API is not final yet and is subject to changes.", false)] public void RunTests( IEnumerable sources, string runSettings, @@ -139,6 +148,7 @@ public void RunTests( } /// + [Obsolete("This API is not final yet and is subject to changes.", false)] public void RunTests( IEnumerable sources, string runSettings, @@ -154,6 +164,7 @@ public void RunTests( } /// + [Obsolete("This API is not final yet and is subject to changes.", false)] public void RunTests( IEnumerable testCases, string runSettings, @@ -167,6 +178,7 @@ public void RunTests( } /// + [Obsolete("This API is not final yet and is subject to changes.", false)] public void RunTests( IEnumerable testCases, string runSettings, @@ -182,6 +194,7 @@ public void RunTests( } /// + [Obsolete("This API is not final yet and is subject to changes.", false)] public void RunTestsWithCustomTestHost( IEnumerable sources, string runSettings, @@ -197,6 +210,7 @@ public void RunTestsWithCustomTestHost( } /// + [Obsolete("This API is not final yet and is subject to changes.", false)] public void RunTestsWithCustomTestHost( IEnumerable sources, string runSettings, @@ -214,6 +228,7 @@ public void RunTestsWithCustomTestHost( } /// + [Obsolete("This API is not final yet and is subject to changes.", false)] public void RunTestsWithCustomTestHost( IEnumerable testCases, string runSettings, @@ -229,6 +244,7 @@ public void RunTestsWithCustomTestHost( } /// + [Obsolete("This API is not final yet and is subject to changes.", false)] public void RunTestsWithCustomTestHost( IEnumerable testCases, string runSettings, @@ -246,12 +262,14 @@ public void RunTestsWithCustomTestHost( } /// + [Obsolete("This API is not final yet and is subject to changes.", false)] public bool StopTestSession() { return this.StopTestSession(this.eventsHandler); } /// + [Obsolete("This API is not final yet and is subject to changes.", false)] public bool StopTestSession(ITestSessionEventsHandler eventsHandler) { if (this.TestSessionInfo == null) @@ -274,6 +292,7 @@ public bool StopTestSession(ITestSessionEventsHandler eventsHandler) #region ITestSessionAsync /// + [Obsolete("This API is not final yet and is subject to changes.", false)] public async Task DiscoverTestsAsync( IEnumerable sources, string discoverySettings, @@ -289,6 +308,7 @@ await this.DiscoverTestsAsync( } /// + [Obsolete("This API is not final yet and is subject to changes.", false)] public async Task DiscoverTestsAsync( IEnumerable sources, string discoverySettings, @@ -304,6 +324,7 @@ await this.consoleWrapper.DiscoverTestsAsync( } /// + [Obsolete("This API is not final yet and is subject to changes.", false)] public async Task RunTestsAsync( IEnumerable sources, string runSettings, @@ -317,6 +338,7 @@ await this.RunTestsAsync( } /// + [Obsolete("This API is not final yet and is subject to changes.", false)] public async Task RunTestsAsync( IEnumerable sources, string runSettings, @@ -332,6 +354,7 @@ await this.consoleWrapper.RunTestsAsync( } /// + [Obsolete("This API is not final yet and is subject to changes.", false)] public async Task RunTestsAsync( IEnumerable testCases, string runSettings, @@ -345,6 +368,7 @@ await this.RunTestsAsync( } /// + [Obsolete("This API is not final yet and is subject to changes.", false)] public async Task RunTestsAsync( IEnumerable testCases, string runSettings, @@ -360,6 +384,7 @@ await this.consoleWrapper.RunTestsAsync( } /// + [Obsolete("This API is not final yet and is subject to changes.", false)] public async Task RunTestsWithCustomTestHostAsync( IEnumerable sources, string runSettings, @@ -375,6 +400,7 @@ await this.RunTestsWithCustomTestHostAsync( } /// + [Obsolete("This API is not final yet and is subject to changes.", false)] public async Task RunTestsWithCustomTestHostAsync( IEnumerable sources, string runSettings, @@ -392,6 +418,7 @@ await this.consoleWrapper.RunTestsWithCustomTestHostAsync( } /// + [Obsolete("This API is not final yet and is subject to changes.", false)] public async Task RunTestsWithCustomTestHostAsync( IEnumerable testCases, string runSettings, @@ -407,6 +434,7 @@ await this.RunTestsWithCustomTestHostAsync( } /// + [Obsolete("This API is not final yet and is subject to changes.", false)] public async Task RunTestsWithCustomTestHostAsync( IEnumerable testCases, string runSettings, @@ -424,12 +452,14 @@ await this.consoleWrapper.RunTestsWithCustomTestHostAsync( } /// + [Obsolete("This API is not final yet and is subject to changes.", false)] public async Task StopTestSessionAsync() { return await this.StopTestSessionAsync(this.eventsHandler).ConfigureAwait(false); } /// + [Obsolete("This API is not final yet and is subject to changes.", false)] public async Task StopTestSessionAsync(ITestSessionEventsHandler eventsHandler) { if (this.TestSessionInfo == null) diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleWrapper.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleWrapper.cs index 99104f8fc6..794bf70089 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleWrapper.cs +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleWrapper.cs @@ -3,6 +3,7 @@ namespace Microsoft.TestPlatform.VsTestConsole.TranslationLayer { + using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; @@ -173,6 +174,7 @@ public void StartSession() } /// + [Obsolete("This API is not final yet and is subject to changes.", false)] public ITestSession StartTestSession( IList sources, string runSettings, @@ -186,6 +188,7 @@ public ITestSession StartTestSession( } /// + [Obsolete("This API is not final yet and is subject to changes.", false)] public ITestSession StartTestSession( IList sources, string runSettings, @@ -201,6 +204,7 @@ public ITestSession StartTestSession( } /// + [Obsolete("This API is not final yet and is subject to changes.", false)] public ITestSession StartTestSession( IList sources, string runSettings, @@ -223,6 +227,7 @@ public ITestSession StartTestSession( } /// + [Obsolete("This API is not final yet and is subject to changes.", false)] public bool StopTestSession( TestSessionInfo testSessionInfo, ITestSessionEventsHandler eventsHandler) @@ -576,6 +581,7 @@ public async Task StartSessionAsync() } /// + [Obsolete("This API is not final yet and is subject to changes.", false)] public async Task StartTestSessionAsync( IList sources, string runSettings, @@ -589,6 +595,7 @@ public async Task StartTestSessionAsync( } /// + [Obsolete("This API is not final yet and is subject to changes.", false)] public async Task StartTestSessionAsync( IList sources, string runSettings, @@ -604,6 +611,7 @@ public async Task StartTestSessionAsync( } /// + [Obsolete("This API is not final yet and is subject to changes.", false)] public async Task StartTestSessionAsync( IList sources, string runSettings, @@ -626,6 +634,7 @@ await this.requestSender.StartTestSessionAsync( } /// + [Obsolete("This API is not final yet and is subject to changes.", false)] public async Task StopTestSessionAsync( TestSessionInfo testSessionInfo, ITestSessionEventsHandler eventsHandler) From 02d620501ed5aa8b0c60aef19455ad71ae0f1dc5 Mon Sep 17 00:00:00 2001 From: Codrin Poienaru Date: Fri, 12 Nov 2021 17:00:36 +0100 Subject: [PATCH 25/26] Fixed code review comments --- .../Client/ProxyDiscoveryManager.cs | 55 ++----------- .../Client/ProxyExecutionManager.cs | 56 +++---------- .../TestEngine.cs | 78 ++++++++++++++++--- .../TestSession/ProxyTestSessionManager.cs | 18 ++--- .../TestSession/TestSessionPool.cs | 2 +- .../Client/DiscoveryCriteria.cs | 2 +- .../Client/TestRunCriteria.cs | 10 +-- .../Client/ProxyDiscoveryManagerTests.cs | 23 ++++-- .../Client/ProxyExecutionManagerTests.cs | 25 ++++-- .../TestSession/TestSessionPoolTests.cs | 6 +- .../TestSessionTests.cs | 1 + .../VsTestConsoleWrapperAsyncTests.cs | 4 + .../VsTestConsoleWrapperTests.cs | 4 + 13 files changed, 146 insertions(+), 138 deletions(-) diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyDiscoveryManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyDiscoveryManager.cs index 9f1120ae01..97df778ead 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyDiscoveryManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyDiscoveryManager.cs @@ -27,10 +27,7 @@ namespace Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client public class ProxyDiscoveryManager : IProxyDiscoveryManager, IBaseProxy, ITestDiscoveryEventsHandler2 { private readonly TestSessionInfo testSessionInfo = null; - private readonly string runSettings; - private readonly IRequestData backupRequestData; - private readonly ITestRequestSender backupTestRequestSender; - private readonly ITestRuntimeProvider backupTestHostManager; + Func proxyOperationManagerCreator; private ITestRuntimeProvider testHostManager; private IRequestData requestData; @@ -51,32 +48,14 @@ public class ProxyDiscoveryManager : IProxyDiscoveryManager, IBaseProxy, ITestDi /// /// /// The test session info. - /// The run settings. - /// - /// The backup request data to be used to create a proxy operation manager should acquire - /// an existent proxy fail. - /// - /// - /// The backup test request sender to be used to create a proxy operation manager should - /// acquire an existent proxy fail. - /// - /// - /// The backup testhost manager to be used to create a proxy operation manager should - /// acquire an existent proxy fail. - /// + /// The proxy operation manager creator. public ProxyDiscoveryManager( TestSessionInfo testSessionInfo, - string runSettings, - IRequestData backupRequestData, - ITestRequestSender backupTestRequestSender, - ITestRuntimeProvider backupTestHostManager) + Func proxyOperationManagerCreator) { // Filling in test session info and proxy information. this.testSessionInfo = testSessionInfo; - this.runSettings = runSettings; - this.backupRequestData = backupRequestData; - this.backupTestRequestSender = backupTestRequestSender; - this.backupTestHostManager = backupTestHostManager; + this.proxyOperationManagerCreator = proxyOperationManagerCreator; this.requestData = null; this.testHostManager = null; @@ -155,29 +134,9 @@ public void DiscoverTests(DiscoveryCriteria discoveryCriteria, ITestDiscoveryEve { if (this.proxyOperationManager == null) { - // In case we have an active test session, we always prefer the already - // created proxies instead of the ones that need to be created on the spot. - this.proxyOperationManager = TestSessionPool.Instance.TakeProxy( - this.testSessionInfo, + this.proxyOperationManager = this.proxyOperationManagerCreator( discoveryCriteria.Sources.First(), - runSettings); - - if (this.proxyOperationManager == null) - { - // If the proxy creation process based on test session info failed, then - // we'll proceed with the normal creation process as if no test session - // info was passed in in the first place. - // - // WARNING: This should not normally happen and it raises questions - // regarding the test session pool operation and consistency. - EqtTrace.Warning("ProxyDiscoveryManager creation with test session failed."); - - this.proxyOperationManager = new ProxyOperationManager( - this.backupRequestData, - this.backupTestRequestSender, - this.backupTestHostManager, - this); - } + this); this.proxyOperationManagerInitializedEvent.Set(); this.testHostManager = this.proxyOperationManager.TestHostManager; @@ -243,7 +202,7 @@ public void Close() // Make sure the proxy operation manager is initialized before anything. this.proxyOperationManagerInitializedEvent.WaitOne(); - // In compatibility mode (no test session used) we don't share the testhost + // When no test session is being used we don't share the testhost // between test discovery and test run. The testhost is closed upon // successfully completing the operation it was spawned for. // diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyExecutionManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyExecutionManager.cs index 6407c724b8..7e7239563f 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyExecutionManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyExecutionManager.cs @@ -32,10 +32,7 @@ namespace Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client internal class ProxyExecutionManager : IProxyExecutionManager, IBaseProxy, ITestRunEventsHandler2 { private readonly TestSessionInfo testSessionInfo = null; - private readonly string runSettings; - private readonly IRequestData backupRequestData; - private readonly ITestRequestSender backupTestRequestSender; - private readonly ITestRuntimeProvider backupTestHostManager; + Func proxyOperationManagerCreator; private ITestRuntimeProvider testHostManager; private IRequestData requestData; @@ -68,38 +65,21 @@ public CancellationTokenSource CancellationTokenSource /// /// /// The test session info. - /// The run settings. + /// The proxy operation manager creator. /// /// A flag indicating if debugging should be enabled or not. /// - /// - /// The backup request data to be used to create a proxy operation manager should acquire - /// an existent proxy fail. - /// - /// - /// The backup test request sender to be used to create a proxy operation manager should - /// acquire an existent proxy fail. - /// - /// - /// The backup testhost manager to be used to create a proxy operation manager should - /// acquire an existent proxy fail. - /// public ProxyExecutionManager( TestSessionInfo testSessionInfo, - string runSettings, - bool debugEnabledForTestSession, - IRequestData backupRequestData, - ITestRequestSender backupTestRequestSender, - ITestRuntimeProvider backupTestHostManager) + Func proxyOperationManagerCreator, + bool debugEnabledForTestSession) { // Filling in test session info and proxy information. this.testSessionInfo = testSessionInfo; - this.runSettings = runSettings; + this.proxyOperationManagerCreator = proxyOperationManagerCreator; + // This should be set to enable debugging when we have test session info available. this.debugEnabledForTestSession = debugEnabledForTestSession; - this.backupRequestData = backupRequestData; - this.backupTestRequestSender = backupTestRequestSender; - this.backupTestHostManager = backupTestHostManager; this.requestData = null; this.testHostManager = null; @@ -183,27 +163,9 @@ public virtual int StartTestRun(TestRunCriteria testRunCriteria, ITestRunEventsH ? TestSourcesUtility.GetSources(testRunCriteria.Tests) : testRunCriteria.Sources; - this.proxyOperationManager = TestSessionPool.Instance.TakeProxy( - this.testSessionInfo, + this.proxyOperationManager = this.proxyOperationManagerCreator( sources.First(), - runSettings); - - if (this.proxyOperationManager == null) - { - // If the proxy creation process based on test session info failed, then - // we'll proceed with the normal creation process as if no test session - // info was passed in in the first place. - // - // WARNING: This should not normally happen and it raises questions - // regarding the test session pool operation and consistency. - EqtTrace.Warning("ProxyExecutionManager creation with test session failed."); - - this.proxyOperationManager = new ProxyOperationManager( - this.backupRequestData, - this.backupTestRequestSender, - this.backupTestHostManager, - this); - } + this); this.proxyOperationManagerInitializedEvent.Set(); this.testHostManager = this.proxyOperationManager.TestHostManager; @@ -357,7 +319,7 @@ public void Close() // Make sure the proxy operation manager is initialized before anything. this.proxyOperationManagerInitializedEvent.WaitOne(); - // In compatibility mode (no test session used) we don't share the testhost + // When no test session is being used we don't share the testhost // between test discovery and test run. The testhost is closed upon // successfully completing the operation it was spawned for. // diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/TestEngine.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/TestEngine.cs index 3a4adb6791..804e769d77 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/TestEngine.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/TestEngine.cs @@ -83,15 +83,46 @@ public IProxyDiscoveryManager GetDiscoveryManager( var hostManager = this.testHostProviderManager.GetTestHostManagerByRunConfiguration(discoveryCriteria.RunSettings); hostManager?.Initialize(TestSessionMessageLogger.Instance, discoveryCriteria.RunSettings); + // This function is used to either take a pre-existing proxy operation manager from + // the test pool or to create a new proxy operation manager on the spot. + Func + proxyOperationManagerCreator = ( + string source, + ProxyDiscoveryManager proxyDiscoveryManager) => + { + // In case we have an active test session, we always prefer the already + // created proxies instead of the ones that need to be created on the spot. + var proxyOperationManager = TestSessionPool.Instance.TryTakeProxy( + discoveryCriteria.TestSessionInfo, + source, + discoveryCriteria.RunSettings); + + if (proxyOperationManager == null) + { + // If the proxy creation process based on test session info failed, then + // we'll proceed with the normal creation process as if no test session + // info was passed in in the first place. + // + // WARNING: This should not normally happen and it raises questions + // regarding the test session pool operation and consistency. + EqtTrace.Warning("ProxyDiscoveryManager creation with test session failed."); + + proxyOperationManager = new ProxyOperationManager( + requestData, + new TestRequestSender(requestData.ProtocolConfig, hostManager), + hostManager, + proxyDiscoveryManager); + } + + return proxyOperationManager; + }; + // In case we have an active test session, we always prefer the already // created proxies instead of the ones that need to be created on the spot. return (discoveryCriteria.TestSessionInfo != null) ? new ProxyDiscoveryManager( discoveryCriteria.TestSessionInfo, - discoveryCriteria.RunSettings, - requestData, - new TestRequestSender(requestData.ProtocolConfig, hostManager), - hostManager) + proxyOperationManagerCreator) : new ProxyDiscoveryManager( requestData, new TestRequestSender(requestData.ProtocolConfig, hostManager), @@ -156,17 +187,46 @@ public IProxyExecutionManager GetExecutionManager( if (testRunCriteria.TestSessionInfo != null) { + // This function is used to either take a pre-existing proxy operation manager from + // the test pool or to create a new proxy operation manager on the spot. + Func + proxyOperationManagerCreator = ( + string source, + ProxyExecutionManager proxyExecutionManager) => + { + var proxyOperationManager = TestSessionPool.Instance.TryTakeProxy( + testRunCriteria.TestSessionInfo, + source, + testRunCriteria.TestRunSettings); + + if (proxyOperationManager == null) + { + // If the proxy creation process based on test session info failed, then + // we'll proceed with the normal creation process as if no test session + // info was passed in in the first place. + // + // WARNING: This should not normally happen and it raises questions + // regarding the test session pool operation and consistency. + EqtTrace.Warning("ProxyExecutionManager creation with test session failed."); + + proxyOperationManager = new ProxyOperationManager( + requestData, + requestSender, + hostManager, + proxyExecutionManager); + } + + return proxyOperationManager; + }; + // In case we have an active test session, data collection needs were // already taken care of when first creating the session. As a consequence // we always return this proxy instead of choosing between the vanilla // execution proxy and the one with data collection enabled. return new ProxyExecutionManager( testRunCriteria.TestSessionInfo, - testRunCriteria.TestRunSettings, - testRunCriteria.DebugEnabledForTestSession, - requestData, - requestSender, - hostManager); + proxyOperationManagerCreator, + testRunCriteria.DebugEnabledForTestSession); } return isDataCollectorEnabled diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/TestSession/ProxyTestSessionManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/TestSession/ProxyTestSessionManager.cs index 56ae1a9af9..142400d0a2 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/TestSession/ProxyTestSessionManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/TestSession/ProxyTestSessionManager.cs @@ -63,8 +63,8 @@ public virtual bool StartSession(ITestSessionEventsHandler eventsHandler) } // Create all the proxies in parallel, one task per proxy. - var taskList = new Task[2 * this.testhostCount]; - for (int i = 0; i < taskList.Length; i += 2) + var taskList = new Task[this.testhostCount]; + for (int i = 0; i < taskList.Length; ++i) { // The testhost count is equal to 1 because one of the following conditions // holds true: @@ -81,17 +81,13 @@ public virtual bool StartSession(ITestSessionEventsHandler eventsHandler) // create a list with a single element, i.e. the current source to be processed. var sources = (this.testhostCount == 1) ? this.testSessionCriteria.Sources - : new List() { this.testSessionCriteria.Sources[i / 2] }; + : new List() { this.testSessionCriteria.Sources[i] }; - var task = Task.Factory.StartNew( - () => this.SetupRawProxy( - sources, - this.testSessionCriteria.RunSettings)); - - taskList[i] = task; - taskList[i + 1] = task.ContinueWith(res => + taskList[i] = Task.Factory.StartNew(() => { - if (!res.Result) + if (!this.SetupRawProxy( + sources, + this.testSessionCriteria.RunSettings)) { this.proxySetupFailed = true; } diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/TestSession/TestSessionPool.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/TestSession/TestSessionPool.cs index 1d40ee44fe..751a508809 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/TestSession/TestSessionPool.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/TestSession/TestSessionPool.cs @@ -124,7 +124,7 @@ public virtual bool KillSession(TestSessionInfo testSessionInfo) /// The run settings. /// /// The proxy object. - public virtual ProxyOperationManager TakeProxy( + public virtual ProxyOperationManager TryTakeProxy( TestSessionInfo testSessionInfo, string source, string runSettings) diff --git a/src/Microsoft.TestPlatform.ObjectModel/Client/DiscoveryCriteria.cs b/src/Microsoft.TestPlatform.ObjectModel/Client/DiscoveryCriteria.cs index cadbac69a2..b9b53c21c3 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Client/DiscoveryCriteria.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/Client/DiscoveryCriteria.cs @@ -73,7 +73,7 @@ public DiscoveryCriteria( frequencyOfDiscoveredTestsEvent, discoveredTestEventTimeout, runSettings, - null) + testSessionInfo: null) { } /// diff --git a/src/Microsoft.TestPlatform.ObjectModel/Client/TestRunCriteria.cs b/src/Microsoft.TestPlatform.ObjectModel/Client/TestRunCriteria.cs index 1a81b4c494..1e23577f93 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Client/TestRunCriteria.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/Client/TestRunCriteria.cs @@ -33,7 +33,7 @@ public TestRunCriteria( : this( sources, frequencyOfRunStatsChangeEvent, - true) + keepAlive: true) { } @@ -54,7 +54,7 @@ public TestRunCriteria( sources, frequencyOfRunStatsChangeEvent, keepAlive, - string.Empty) + testSettings: string.Empty) { } @@ -107,7 +107,7 @@ public TestRunCriteria( keepAlive, testSettings, runStatsChangeEventTimeout, - null) + testHostLauncher: null) { } @@ -141,8 +141,8 @@ public TestRunCriteria( testSettings, runStatsChangeEventTimeout, testHostLauncher, - null, - null) + testCaseFilter: null, + filterOptions: null) { } diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyDiscoveryManagerTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyDiscoveryManagerTests.cs index 796c42b979..5133483580 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyDiscoveryManagerTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyDiscoveryManagerTests.cs @@ -512,12 +512,23 @@ public void AbortShouldSendTestDiscoveryCancelIfCommunicationSuccessful() public void StartTestRunShouldAttemptToTakeProxyFromPoolIfProxyIsNull() { var testSessionInfo = new TestSessionInfo(); + + Func + proxyOperationManagerCreator = ( + string source, + ProxyDiscoveryManager proxyDiscoveryManager) => + { + var proxyOperationManager = TestSessionPool.Instance.TryTakeProxy( + testSessionInfo, + source, + discoveryCriteria.RunSettings); + + return proxyOperationManager; + }; + var testDiscoveryManager = new ProxyDiscoveryManager( testSessionInfo, - string.Empty, - this.mockRequestData.Object, - this.mockRequestSender.Object, - this.mockTestHostManager.Object); + proxyOperationManagerCreator); var mockTestSessionPool = new Mock(); TestSessionPool.Instance = mockTestSessionPool.Object; @@ -529,7 +540,7 @@ public void StartTestRunShouldAttemptToTakeProxyFromPoolIfProxyIsNull() this.mockRequestSender.Object, this.mockTestHostManager.Object); mockTestSessionPool.Setup( - tsp => tsp.TakeProxy( + tsp => tsp.TryTakeProxy( testSessionInfo, It.IsAny(), It.IsAny())) @@ -541,7 +552,7 @@ public void StartTestRunShouldAttemptToTakeProxyFromPoolIfProxyIsNull() new Mock().Object); mockTestSessionPool.Verify( - tsp => tsp.TakeProxy( + tsp => tsp.TryTakeProxy( testSessionInfo, It.IsAny(), It.IsAny()), diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyExecutionManagerTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyExecutionManagerTests.cs index 5a7848c089..dfe854a27e 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyExecutionManagerTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyExecutionManagerTests.cs @@ -747,13 +747,24 @@ public void ExecutionManagerShouldPassOnLaunchProcessWithDebuggerAttached() public void StartTestRunShouldAttemptToTakeProxyFromPoolIfProxyIsNull() { var testSessionInfo = new TestSessionInfo(); + + Func + proxyOperationManagerCreator = ( + string source, + ProxyExecutionManager proxyExecutionManager) => + { + var proxyOperationManager = TestSessionPool.Instance.TryTakeProxy( + testSessionInfo, + source, + string.Empty); + + return proxyOperationManager; + }; + var testExecutionManager = new ProxyExecutionManager( testSessionInfo, - string.Empty, - false, - this.mockRequestData.Object, - this.mockRequestSender.Object, - this.mockTestHostManager.Object); + proxyOperationManagerCreator, + false); var mockTestSessionPool = new Mock(); TestSessionPool.Instance = mockTestSessionPool.Object; @@ -765,7 +776,7 @@ public void StartTestRunShouldAttemptToTakeProxyFromPoolIfProxyIsNull() this.mockRequestSender.Object, this.mockTestHostManager.Object); mockTestSessionPool.Setup( - tsp => tsp.TakeProxy( + tsp => tsp.TryTakeProxy( testSessionInfo, It.IsAny(), It.IsAny())) @@ -777,7 +788,7 @@ public void StartTestRunShouldAttemptToTakeProxyFromPoolIfProxyIsNull() new Mock().Object); mockTestSessionPool.Verify( - tsp => tsp.TakeProxy( + tsp => tsp.TryTakeProxy( testSessionInfo, It.IsAny(), It.IsAny()), diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/TestSession/TestSessionPoolTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/TestSession/TestSessionPoolTests.cs index ed055b51d2..ab3c47ebe0 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/TestSession/TestSessionPoolTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/TestSession/TestSessionPoolTests.cs @@ -73,17 +73,17 @@ public void TakeProxyShouldSucceedIfMatchingCriteriaAreCorrect() .Returns(new ProxyOperationManager(null, null, null)); // Take proxy fails because test session is invalid. - Assert.IsNull(TestSessionPool.Instance.TakeProxy(new TestSessionInfo(), string.Empty, string.Empty)); + Assert.IsNull(TestSessionPool.Instance.TryTakeProxy(new TestSessionInfo(), string.Empty, string.Empty)); mockProxyTestSessionManager.Verify(tsm => tsm.DequeueProxy(It.IsAny(), It.IsAny()), Times.Never); Assert.IsTrue(TestSessionPool.Instance.AddSession(testSessionInfo, mockProxyTestSessionManager.Object)); // First TakeProxy fails because of throwing, see setup sequence. - Assert.IsNull(TestSessionPool.Instance.TakeProxy(testSessionInfo, string.Empty, string.Empty)); + Assert.IsNull(TestSessionPool.Instance.TryTakeProxy(testSessionInfo, string.Empty, string.Empty)); mockProxyTestSessionManager.Verify(tsm => tsm.DequeueProxy(It.IsAny(), It.IsAny()), Times.Once); // Second TakeProxy succeeds, see setup sequence. - Assert.IsNotNull(TestSessionPool.Instance.TakeProxy(testSessionInfo, string.Empty, string.Empty)); + Assert.IsNotNull(TestSessionPool.Instance.TryTakeProxy(testSessionInfo, string.Empty, string.Empty)); mockProxyTestSessionManager.Verify(tsm => tsm.DequeueProxy(It.IsAny(), It.IsAny()), Times.Exactly(2)); } diff --git a/test/TranslationLayer.UnitTests/TestSessionTests.cs b/test/TranslationLayer.UnitTests/TestSessionTests.cs index 99b73bc73f..01989a2f6a 100644 --- a/test/TranslationLayer.UnitTests/TestSessionTests.cs +++ b/test/TranslationLayer.UnitTests/TestSessionTests.cs @@ -17,6 +17,7 @@ namespace Microsoft.TestPlatform.VsTestConsole.TranslationLayer.UnitTests using Moq; [TestClass] + [Obsolete("This API is not final yet and is subject to changes.", false)] public class TestSessionTests { private readonly string testSettings = "TestSettings"; diff --git a/test/TranslationLayer.UnitTests/VsTestConsoleWrapperAsyncTests.cs b/test/TranslationLayer.UnitTests/VsTestConsoleWrapperAsyncTests.cs index 65af508b4c..a4a85627f9 100644 --- a/test/TranslationLayer.UnitTests/VsTestConsoleWrapperAsyncTests.cs +++ b/test/TranslationLayer.UnitTests/VsTestConsoleWrapperAsyncTests.cs @@ -95,6 +95,7 @@ public async Task StartSessionShouldCallWhenProcessNotInitializedAsync() } [TestMethod] + [Obsolete("This API is not final yet and is subject to changes.", false)] public async Task StartTestSessionAsyncShouldCallRequestSenderWithCorrectArguments1() { var testSessionInfo = new TestSessionInfo(); @@ -127,6 +128,7 @@ public async Task StartTestSessionAsyncShouldCallRequestSenderWithCorrectArgumen } [TestMethod] + [Obsolete("This API is not final yet and is subject to changes.", false)] public async Task StartTestSessionAsyncShouldCallRequestSenderWithCorrectArguments2() { var testSessionInfo = new TestSessionInfo(); @@ -161,6 +163,7 @@ public async Task StartTestSessionAsyncShouldCallRequestSenderWithCorrectArgumen } [TestMethod] + [Obsolete("This API is not final yet and is subject to changes.", false)] public async Task StartTestSessionAsyncShouldCallRequestSenderWithCorrectArguments3() { var testSessionInfo = new TestSessionInfo(); @@ -197,6 +200,7 @@ public async Task StartTestSessionAsyncShouldCallRequestSenderWithCorrectArgumen } [TestMethod] + [Obsolete("This API is not final yet and is subject to changes.", false)] public async Task StopTestSessionAsyncShouldCallRequestSenderWithCorrectArguments() { var testSessionInfo = new TestSessionInfo(); diff --git a/test/TranslationLayer.UnitTests/VsTestConsoleWrapperTests.cs b/test/TranslationLayer.UnitTests/VsTestConsoleWrapperTests.cs index bffda62816..2c4f86e188 100644 --- a/test/TranslationLayer.UnitTests/VsTestConsoleWrapperTests.cs +++ b/test/TranslationLayer.UnitTests/VsTestConsoleWrapperTests.cs @@ -95,6 +95,7 @@ public void StartSessionShouldCallWhenProcessNotInitialized() } [TestMethod] + [Obsolete("This API is not final yet and is subject to changes.", false)] public void StartTestSessionShouldCallRequestSenderWithCorrectArguments1() { var testSessionInfo = new TestSessionInfo(); @@ -127,6 +128,7 @@ public void StartTestSessionShouldCallRequestSenderWithCorrectArguments1() } [TestMethod] + [Obsolete("This API is not final yet and is subject to changes.", false)] public void StartTestSessionShouldCallRequestSenderWithCorrectArguments2() { var testSessionInfo = new TestSessionInfo(); @@ -161,6 +163,7 @@ public void StartTestSessionShouldCallRequestSenderWithCorrectArguments2() } [TestMethod] + [Obsolete("This API is not final yet and is subject to changes.", false)] public void StartTestSessionShouldCallRequestSenderWithCorrectArguments3() { var testSessionInfo = new TestSessionInfo(); @@ -197,6 +200,7 @@ public void StartTestSessionShouldCallRequestSenderWithCorrectArguments3() } [TestMethod] + [Obsolete("This API is not final yet and is subject to changes.", false)] public void StopTestSessionShouldCallRequestSenderWithCorrectArguments() { var testSessionInfo = new TestSessionInfo(); From 393fb3e3590f190627f78b3e7c66c7d58252a550 Mon Sep 17 00:00:00 2001 From: Codrin Poienaru Date: Thu, 18 Nov 2021 20:14:02 +0100 Subject: [PATCH 26/26] Fixed review comments --- .../Client/ProxyDiscoveryManager.cs | 17 ++++---- .../Client/ProxyExecutionManager.cs | 24 +++++++---- .../Resources/Resources.Designer.cs | 4 +- .../Resources/Resources.resx | 2 +- .../Resources/xlf/Resources.cs.xlf | 2 +- .../Resources/xlf/Resources.de.xlf | 2 +- .../Resources/xlf/Resources.es.xlf | 2 +- .../Resources/xlf/Resources.fr.xlf | 2 +- .../Resources/xlf/Resources.it.xlf | 2 +- .../Resources/xlf/Resources.ja.xlf | 2 +- .../Resources/xlf/Resources.ko.xlf | 2 +- .../Resources/xlf/Resources.pl.xlf | 2 +- .../Resources/xlf/Resources.pt-BR.xlf | 2 +- .../Resources/xlf/Resources.ru.xlf | 2 +- .../Resources/xlf/Resources.tr.xlf | 2 +- .../Resources/xlf/Resources.xlf | 2 +- .../Resources/xlf/Resources.zh-Hans.xlf | 2 +- .../Resources/xlf/Resources.zh-Hant.xlf | 2 +- .../VsTestConsoleWrapper.cs | 42 ++++++++++++------- 19 files changed, 68 insertions(+), 49 deletions(-) diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyDiscoveryManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyDiscoveryManager.cs index 97df778ead..c8d85fa1b8 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyDiscoveryManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyDiscoveryManager.cs @@ -36,7 +36,6 @@ public class ProxyDiscoveryManager : IProxyDiscoveryManager, IBaseProxy, ITestDi private readonly IDataSerializer dataSerializer; private bool isCommunicationEstablished; - private ManualResetEvent proxyOperationManagerInitializedEvent = new ManualResetEvent(false); private ProxyOperationManager proxyOperationManager = null; private ITestDiscoveryEventsHandler2 baseTestDiscoveryEventsHandler; private bool skipDefaultAdapters; @@ -116,7 +115,6 @@ internal ProxyDiscoveryManager( // Create a new proxy operation manager. this.proxyOperationManager = new ProxyOperationManager(requestData, requestSender, testHostManager, this); - this.proxyOperationManagerInitializedEvent.Set(); } #endregion @@ -138,7 +136,6 @@ public void DiscoverTests(DiscoveryCriteria discoveryCriteria, ITestDiscoveryEve discoveryCriteria.Sources.First(), this); - this.proxyOperationManagerInitializedEvent.Set(); this.testHostManager = this.proxyOperationManager.TestHostManager; this.requestData = this.proxyOperationManager.RequestData; } @@ -188,8 +185,11 @@ public void DiscoverTests(DiscoveryCriteria discoveryCriteria, ITestDiscoveryEve /// public void Abort() { - // Make sure the proxy operation manager is initialized before anything. - this.proxyOperationManagerInitializedEvent.WaitOne(); + // Do nothing if the proxy is not initialized yet. + if (this.proxyOperationManager == null) + { + return; + } // Cancel fast, try to stop testhost deployment/launch this.proxyOperationManager.CancellationTokenSource.Cancel(); @@ -199,8 +199,11 @@ public void Abort() /// public void Close() { - // Make sure the proxy operation manager is initialized before anything. - this.proxyOperationManagerInitializedEvent.WaitOne(); + // Do nothing if the proxy is not initialized yet. + if (this.proxyOperationManager == null) + { + return; + } // When no test session is being used we don't share the testhost // between test discovery and test run. The testhost is closed upon diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyExecutionManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyExecutionManager.cs index 7e7239563f..c5e90651a4 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyExecutionManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyExecutionManager.cs @@ -41,7 +41,6 @@ internal class ProxyExecutionManager : IProxyExecutionManager, IBaseProxy, ITest private readonly IDataSerializer dataSerializer; private bool isCommunicationEstablished; - private ManualResetEvent proxyOperationManagerInitializedEvent = new ManualResetEvent(false); private ProxyOperationManager proxyOperationManager = null; private ITestRunEventsHandler baseTestRunEventsHandler; private bool skipDefaultAdapters; @@ -138,7 +137,6 @@ internal ProxyExecutionManager( // Create a new proxy operation manager. this.proxyOperationManager = new ProxyOperationManager(requestData, requestSender, testHostManager, this); - this.proxyOperationManagerInitializedEvent.Set(); } #endregion @@ -167,7 +165,6 @@ public virtual int StartTestRun(TestRunCriteria testRunCriteria, ITestRunEventsH sources.First(), this); - this.proxyOperationManagerInitializedEvent.Set(); this.testHostManager = this.proxyOperationManager.TestHostManager; this.requestData = this.proxyOperationManager.RequestData; } @@ -281,8 +278,11 @@ public virtual void Cancel(ITestRunEventsHandler eventHandler) this.baseTestRunEventsHandler = eventHandler; } - // Make sure the proxy operation manager is initialized before anything. - this.proxyOperationManagerInitializedEvent.WaitOne(); + // Do nothing if the proxy is not initialized yet. + if (this.proxyOperationManager == null) + { + return; + } // Cancel fast, try to stop testhost deployment/launch. this.proxyOperationManager.CancellationTokenSource.Cancel(); @@ -301,8 +301,11 @@ public void Abort(ITestRunEventsHandler eventHandler) this.baseTestRunEventsHandler = eventHandler; } - // Make sure the proxy operation manager is initialized before anything. - this.proxyOperationManagerInitializedEvent.WaitOne(); + // Do nothing if the proxy is not initialized yet. + if (this.proxyOperationManager == null) + { + return; + } // Cancel fast, try to stop testhost deployment/launch. this.proxyOperationManager.CancellationTokenSource.Cancel(); @@ -316,8 +319,11 @@ public void Abort(ITestRunEventsHandler eventHandler) /// public void Close() { - // Make sure the proxy operation manager is initialized before anything. - this.proxyOperationManagerInitializedEvent.WaitOne(); + // Do nothing if the proxy is not initialized yet. + if (this.proxyOperationManager == null) + { + return; + } // When no test session is being used we don't share the testhost // between test discovery and test run. The testhost is closed upon diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/Resources.Designer.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/Resources.Designer.cs index 0a6824724e..9fb9692fc8 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/Resources.Designer.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/Resources.Designer.cs @@ -11,7 +11,7 @@ namespace Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Resources { using System; using System.Reflection; - + /// /// A strongly-typed resource class, for looking up localized strings, etc. /// @@ -241,7 +241,7 @@ internal static string NonExistingExtensions { } /// - /// Looks up a localized string similar to Could not find an available proxy to match the original run settings.. + /// Looks up a localized string similar to The runsettings changed between the time when the test session was established and the time of the current run/discovery request.. /// internal static string NoProxyMatchesDescription { get { diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/Resources.resx b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/Resources.resx index 147ecc9807..74fc12636d 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/Resources.resx +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/Resources.resx @@ -217,6 +217,6 @@ No suitable test runtime provider found for this run. - Could not find an available proxy to match the original run settings. + The runsettings changed between the time when the test session was established and the time of the current run/discovery request. \ No newline at end of file diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.cs.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.cs.xlf index f3ca51b834..d71b556d5f 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.cs.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.cs.xlf @@ -163,7 +163,7 @@ - Could not find an available proxy to match the original run settings. + The runsettings changed between the time when the test session was established and the time of the current run/discovery request. Could not find an available proxy to match the original run settings. diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.de.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.de.xlf index a0e1bf469c..cec299f274 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.de.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.de.xlf @@ -163,7 +163,7 @@ - Could not find an available proxy to match the original run settings. + The runsettings changed between the time when the test session was established and the time of the current run/discovery request. Could not find an available proxy to match the original run settings. diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.es.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.es.xlf index 430b83c49f..3ab3d7f1da 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.es.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.es.xlf @@ -163,7 +163,7 @@ - Could not find an available proxy to match the original run settings. + The runsettings changed between the time when the test session was established and the time of the current run/discovery request. Could not find an available proxy to match the original run settings. diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.fr.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.fr.xlf index e6aac2dabe..d2a7606007 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.fr.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.fr.xlf @@ -163,7 +163,7 @@ - Could not find an available proxy to match the original run settings. + The runsettings changed between the time when the test session was established and the time of the current run/discovery request. Could not find an available proxy to match the original run settings. diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.it.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.it.xlf index 418d2eeed7..493fa749bf 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.it.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.it.xlf @@ -163,7 +163,7 @@ - Could not find an available proxy to match the original run settings. + The runsettings changed between the time when the test session was established and the time of the current run/discovery request. Could not find an available proxy to match the original run settings. diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ja.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ja.xlf index 7f080dd8f6..473060cb08 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ja.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ja.xlf @@ -163,7 +163,7 @@ - Could not find an available proxy to match the original run settings. + The runsettings changed between the time when the test session was established and the time of the current run/discovery request. Could not find an available proxy to match the original run settings. diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ko.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ko.xlf index 26fda22065..0ecf479af1 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ko.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ko.xlf @@ -163,7 +163,7 @@ - Could not find an available proxy to match the original run settings. + The runsettings changed between the time when the test session was established and the time of the current run/discovery request. Could not find an available proxy to match the original run settings. diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.pl.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.pl.xlf index 5eeb232cb4..ffcbc7d5f2 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.pl.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.pl.xlf @@ -163,7 +163,7 @@ - Could not find an available proxy to match the original run settings. + The runsettings changed between the time when the test session was established and the time of the current run/discovery request. Could not find an available proxy to match the original run settings. diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.pt-BR.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.pt-BR.xlf index 44b39a80c8..2bf767e351 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.pt-BR.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.pt-BR.xlf @@ -163,7 +163,7 @@ - Could not find an available proxy to match the original run settings. + The runsettings changed between the time when the test session was established and the time of the current run/discovery request. Could not find an available proxy to match the original run settings. diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ru.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ru.xlf index 2422c9dbf9..4b267cc1d1 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ru.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.ru.xlf @@ -163,7 +163,7 @@ - Could not find an available proxy to match the original run settings. + The runsettings changed between the time when the test session was established and the time of the current run/discovery request. Could not find an available proxy to match the original run settings. diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.tr.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.tr.xlf index eb8b925a6b..56510a3cfd 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.tr.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.tr.xlf @@ -163,7 +163,7 @@ - Could not find an available proxy to match the original run settings. + The runsettings changed between the time when the test session was established and the time of the current run/discovery request. Could not find an available proxy to match the original run settings. diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.xlf index b6abd7bf7f..ad5ba9b685 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.xlf @@ -149,7 +149,7 @@ - Could not find an available proxy to match the original run settings. + The runsettings changed between the time when the test session was established and the time of the current run/discovery request. Could not find an available proxy to match the original run settings. diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.zh-Hans.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.zh-Hans.xlf index 4a48f7a425..6947ac935d 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.zh-Hans.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.zh-Hans.xlf @@ -163,7 +163,7 @@ - Could not find an available proxy to match the original run settings. + The runsettings changed between the time when the test session was established and the time of the current run/discovery request. Could not find an available proxy to match the original run settings. diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.zh-Hant.xlf b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.zh-Hant.xlf index c214d5fb07..1b2b0376c7 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.zh-Hant.xlf +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/xlf/Resources.zh-Hant.xlf @@ -163,7 +163,7 @@ - Could not find an available proxy to match the original run settings. + The runsettings changed between the time when the test session was established and the time of the current run/discovery request. Could not find an available proxy to match the original run settings. diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleWrapper.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleWrapper.cs index 794bf70089..dbfeaf780f 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleWrapper.cs +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleWrapper.cs @@ -215,15 +215,20 @@ public ITestSession StartTestSession( this.testPlatformEventSource.TranslationLayerStartTestSessionStart(); this.EnsureInitialized(); - return new TestSession( - this.requestSender.StartTestSession( - sources, - runSettings, - options, - eventsHandler, - testHostLauncher), + + var testSessionInfo = this.requestSender.StartTestSession( + sources, + runSettings, + options, eventsHandler, - this); + testHostLauncher); + + return (testSessionInfo != null) + ? new TestSession( + testSessionInfo, + eventsHandler, + this) + : null; } /// @@ -622,15 +627,20 @@ public async Task StartTestSessionAsync( this.testPlatformEventSource.TranslationLayerStartTestSessionStart(); await this.EnsureInitializedAsync().ConfigureAwait(false); - return new TestSession( - await this.requestSender.StartTestSessionAsync( - sources, - runSettings, - options, - eventsHandler, - testHostLauncher).ConfigureAwait(false), + + var testSessionInfo = await this.requestSender.StartTestSessionAsync( + sources, + runSettings, + options, eventsHandler, - this); + testHostLauncher).ConfigureAwait(false); + + return (testSessionInfo != null) + ? new TestSession( + testSessionInfo, + eventsHandler, + this) + : null; } ///