From 15ab092f4461d30ab6cc1cef2dc1e60e7a55aeda Mon Sep 17 00:00:00 2001 From: Martin Costello Date: Tue, 20 Nov 2018 06:52:56 +0000 Subject: [PATCH 1/2] Fix invalid XML in resource string (#1844) When the NoIsTestProjectProperty resource string is displayed, the XML shown is not valid XML for copying and pasting into a project file. This fixes that by adding the missing / from the second tag. --- .../Resources/Resources.Designer.cs | 2 +- .../Resources/xlf/Resources.cs.xlf | 4 ++-- .../Resources/xlf/Resources.de.xlf | 4 ++-- .../Resources/xlf/Resources.es.xlf | 4 ++-- .../Resources/xlf/Resources.fr.xlf | 4 ++-- .../Resources/xlf/Resources.it.xlf | 4 ++-- .../Resources/xlf/Resources.ja.xlf | 4 ++-- .../Resources/xlf/Resources.ko.xlf | 4 ++-- .../Resources/xlf/Resources.pl.xlf | 4 ++-- .../Resources/xlf/Resources.pt-BR.xlf | 4 ++-- .../Resources/xlf/Resources.ru.xlf | 4 ++-- .../Resources/xlf/Resources.tr.xlf | 4 ++-- src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.xlf | 4 ++-- .../Resources/xlf/Resources.zh-Hans.xlf | 4 ++-- .../Resources/xlf/Resources.zh-Hant.xlf | 4 ++-- 15 files changed, 29 insertions(+), 29 deletions(-) diff --git a/src/Microsoft.TestPlatform.Build/Resources/Resources.Designer.cs b/src/Microsoft.TestPlatform.Build/Resources/Resources.Designer.cs index f897fa84d0..689e046619 100644 --- a/src/Microsoft.TestPlatform.Build/Resources/Resources.Designer.cs +++ b/src/Microsoft.TestPlatform.Build/Resources/Resources.Designer.cs @@ -80,7 +80,7 @@ internal static string BuildStarted { } /// - /// Looks up a localized string similar to Skipping running test for project {0}. To run tests with dotnet test add "<IsTestProject>true<IsTestProject>" property to project file.. + /// Looks up a localized string similar to Skipping running test for project {0}. To run tests with dotnet test add "<IsTestProject>true</IsTestProject>" property to project file.. /// internal static string NoIsTestProjectProperty { get { diff --git a/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.cs.xlf b/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.cs.xlf index ff88a5fe10..42b176140b 100644 --- a/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.cs.xlf +++ b/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.cs.xlf @@ -41,8 +41,8 @@ - Skipping running test for project {0}. To run tests with dotnet test add "<IsTestProject>true<IsTestProject>" property to project file. - Spuštění testu pro projekt {0} se přeskočí. Pokud chcete spustit testy s testem dotnet, přidejte do souboru projektu vlastnost <IsTestProject>true<IsTestProject>. + Skipping running test for project {0}. To run tests with dotnet test add "<IsTestProject>true</IsTestProject>" property to project file. + Spuštění testu pro projekt {0} se přeskočí. Pokud chcete spustit testy s testem dotnet, přidejte do souboru projektu vlastnost <IsTestProject>true</IsTestProject>. diff --git a/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.de.xlf b/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.de.xlf index 51711002fc..6a42987d7d 100644 --- a/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.de.xlf +++ b/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.de.xlf @@ -41,8 +41,8 @@ - Skipping running test for project {0}. To run tests with dotnet test add "<IsTestProject>true<IsTestProject>" property to project file. - Die Testausführung für das Projekt "{0}" wird übersprungen. Um Tests mit "dotnet test" auszuführen, fügen Sie der Projektdatei die Eigenschaft "<IsTestProject>true<IsTestProject>" hinzu. + Skipping running test for project {0}. To run tests with dotnet test add "<IsTestProject>true</IsTestProject>" property to project file. + Die Testausführung für das Projekt "{0}" wird übersprungen. Um Tests mit "dotnet test" auszuführen, fügen Sie der Projektdatei die Eigenschaft "<IsTestProject>true</IsTestProject>" hinzu. diff --git a/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.es.xlf b/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.es.xlf index 384d69d89c..7069039863 100644 --- a/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.es.xlf +++ b/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.es.xlf @@ -41,8 +41,8 @@ - Skipping running test for project {0}. To run tests with dotnet test add "<IsTestProject>true<IsTestProject>" property to project file. - Omitiendo la ejecución de la prueba para el proyecto {0}. Para ejecutar pruebas con la prueba dotnet, agregue la propiedad "<IsTestProject>true<IsTestProject>" al archivo de proyecto. + Skipping running test for project {0}. To run tests with dotnet test add "<IsTestProject>true</IsTestProject>" property to project file. + Omitiendo la ejecución de la prueba para el proyecto {0}. Para ejecutar pruebas con la prueba dotnet, agregue la propiedad "<IsTestProject>true</IsTestProject>" al archivo de proyecto. diff --git a/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.fr.xlf b/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.fr.xlf index ad82c9ad95..279d7392ad 100644 --- a/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.fr.xlf +++ b/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.fr.xlf @@ -41,8 +41,8 @@ - Skipping running test for project {0}. To run tests with dotnet test add "<IsTestProject>true<IsTestProject>" property to project file. - L’exécution du test pour le projet {0} est ignorée. Pour exécuter les tests avec dotnet test, ajoutez la propriété "<IsTestProject>true<IsTestProject>" au fichier projet. + Skipping running test for project {0}. To run tests with dotnet test add "<IsTestProject>true</IsTestProject>" property to project file. + L’exécution du test pour le projet {0} est ignorée. Pour exécuter les tests avec dotnet test, ajoutez la propriété "<IsTestProject>true</IsTestProject>" au fichier projet. diff --git a/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.it.xlf b/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.it.xlf index 066714fd64..6ce2f0f31a 100644 --- a/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.it.xlf +++ b/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.it.xlf @@ -41,8 +41,8 @@ - Skipping running test for project {0}. To run tests with dotnet test add "<IsTestProject>true<IsTestProject>" property to project file. - L'esecuzione del test per il progetto {0} verrà ignorata. Per eseguire test con dotnet, aggiungere la proprietà "<IsTestProject>true<IsTestProject>" al file di progetto. + Skipping running test for project {0}. To run tests with dotnet test add "<IsTestProject>true</IsTestProject>" property to project file. + L'esecuzione del test per il progetto {0} verrà ignorata. Per eseguire test con dotnet, aggiungere la proprietà "<IsTestProject>true</IsTestProject>" al file di progetto. diff --git a/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.ja.xlf b/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.ja.xlf index 009b42f585..c3dca885ea 100644 --- a/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.ja.xlf +++ b/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.ja.xlf @@ -41,8 +41,8 @@ - Skipping running test for project {0}. To run tests with dotnet test add "<IsTestProject>true<IsTestProject>" property to project file. - プロジェクト {0} のテストの実行をスキップしています。dotnet test を使用してテストを実行するには、プロジェクト ファイルに "<IsTestProject>true<IsTestProject>" プロパティを追加します。 + Skipping running test for project {0}. To run tests with dotnet test add "<IsTestProject>true</IsTestProject>" property to project file. + プロジェクト {0} のテストの実行をスキップしています。dotnet test を使用してテストを実行するには、プロジェクト ファイルに "<IsTestProject>true</IsTestProject>" プロパティを追加します。 diff --git a/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.ko.xlf b/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.ko.xlf index 5afa4f4c67..0f802d17d6 100644 --- a/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.ko.xlf +++ b/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.ko.xlf @@ -41,8 +41,8 @@ - Skipping running test for project {0}. To run tests with dotnet test add "<IsTestProject>true<IsTestProject>" property to project file. - 프로젝트 {0}의 테스트 실행을 건너뜁니다. dotnet test로 테스트를 실행하려면 "<IsTestProject>true<IsTestProject>" 속성을 프로젝트 파일에 추가하세요. + Skipping running test for project {0}. To run tests with dotnet test add "<IsTestProject>true</IsTestProject>" property to project file. + 프로젝트 {0}의 테스트 실행을 건너뜁니다. dotnet test로 테스트를 실행하려면 "<IsTestProject>true</IsTestProject>" 속성을 프로젝트 파일에 추가하세요. diff --git a/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.pl.xlf b/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.pl.xlf index 5da4a3a759..41f36f4159 100644 --- a/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.pl.xlf +++ b/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.pl.xlf @@ -41,8 +41,8 @@ - Skipping running test for project {0}. To run tests with dotnet test add "<IsTestProject>true<IsTestProject>" property to project file. - Pomijanie uruchamiania testu dla projektu {0}. Aby uruchomić testy za pomocą polecenia dotnet test, dodaj właściwość „<IsTestProject>true<IsTestProject>” do pliku projektu. + Skipping running test for project {0}. To run tests with dotnet test add "<IsTestProject>true</IsTestProject>" property to project file. + Pomijanie uruchamiania testu dla projektu {0}. Aby uruchomić testy za pomocą polecenia dotnet test, dodaj właściwość „<IsTestProject>true</IsTestProject>” do pliku projektu. diff --git a/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.pt-BR.xlf b/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.pt-BR.xlf index fc10557564..0ef17e01ad 100644 --- a/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.pt-BR.xlf +++ b/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.pt-BR.xlf @@ -41,8 +41,8 @@ - Skipping running test for project {0}. To run tests with dotnet test add "<IsTestProject>true<IsTestProject>" property to project file. - Ignorando a execução de teste do projeto {0}. Para executar testes com dotnet test, adicione a propriedade "<IsTestProject>true<IsTestProject>" ao arquivo de projeto. + Skipping running test for project {0}. To run tests with dotnet test add "<IsTestProject>true</IsTestProject>" property to project file. + Ignorando a execução de teste do projeto {0}. Para executar testes com dotnet test, adicione a propriedade "<IsTestProject>true</IsTestProject>" ao arquivo de projeto. diff --git a/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.ru.xlf b/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.ru.xlf index 5cb8db4e46..b78ffe7ae5 100644 --- a/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.ru.xlf +++ b/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.ru.xlf @@ -41,8 +41,8 @@ - Skipping running test for project {0}. To run tests with dotnet test add "<IsTestProject>true<IsTestProject>" property to project file. - Пропуск выполнения теста для проекта {0}. Чтобы выполнить тесты с тестом dotnet, добавьте свойство "<IsTestProject>true<IsTestProject>" в файл проекта. + Skipping running test for project {0}. To run tests with dotnet test add "<IsTestProject>true</IsTestProject>" property to project file. + Пропуск выполнения теста для проекта {0}. Чтобы выполнить тесты с тестом dotnet, добавьте свойство "<IsTestProject>true</IsTestProject>" в файл проекта. diff --git a/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.tr.xlf b/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.tr.xlf index 63535f3c83..3da1047aa7 100644 --- a/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.tr.xlf +++ b/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.tr.xlf @@ -41,8 +41,8 @@ - Skipping running test for project {0}. To run tests with dotnet test add "<IsTestProject>true<IsTestProject>" property to project file. - {0} projesi için test çalıştırması atlanıyor. Dotnet test ile testleri çalıştırmak için proje dosyasına "<IsTestProject>true<IsTestProject>" özelliğini ekleyin. + Skipping running test for project {0}. To run tests with dotnet test add "<IsTestProject>true</IsTestProject>" property to project file. + {0} projesi için test çalıştırması atlanıyor. Dotnet test ile testleri çalıştırmak için proje dosyasına "<IsTestProject>true</IsTestProject>" özelliğini ekleyin. diff --git a/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.xlf b/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.xlf index c614274805..48d18887e0 100644 --- a/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.xlf +++ b/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.xlf @@ -23,8 +23,8 @@ - Skipping running test for project {0}. To run tests with dotnet test add "<IsTestProject>true<IsTestProject>" property to project file. - Skipping running test for project {0}. To run tests with dotnet test add "<IsTestProject>true<IsTestProject>" property to project file. + Skipping running test for project {0}. To run tests with dotnet test add "<IsTestProject>true</IsTestProject>" property to project file. + Skipping running test for project {0}. To run tests with dotnet test add "<IsTestProject>true</IsTestProject>" property to project file. diff --git a/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.zh-Hans.xlf b/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.zh-Hans.xlf index 778e262cfb..d28d3a4d78 100644 --- a/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.zh-Hans.xlf +++ b/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.zh-Hans.xlf @@ -41,8 +41,8 @@ - Skipping running test for project {0}. To run tests with dotnet test add "<IsTestProject>true<IsTestProject>" property to project file. - 不对项目 {0} 运行测试。要运行带 dotnet 测试的测试,请向项目文件添加 "<IsTestProject>true<IsTestProject>"。 + Skipping running test for project {0}. To run tests with dotnet test add "<IsTestProject>true</IsTestProject>" property to project file. + 不对项目 {0} 运行测试。要运行带 dotnet 测试的测试,请向项目文件添加 "<IsTestProject>true</IsTestProject>"。 diff --git a/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.zh-Hant.xlf b/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.zh-Hant.xlf index c5541fbce7..06a4cb845c 100644 --- a/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.zh-Hant.xlf +++ b/src/Microsoft.TestPlatform.Build/Resources/xlf/Resources.zh-Hant.xlf @@ -41,8 +41,8 @@ - Skipping running test for project {0}. To run tests with dotnet test add "<IsTestProject>true<IsTestProject>" property to project file. - 即將跳過為專案 {0} 執行測試。若要使用 dotnet 測試來執行測試,請在專案檔中新增 "<IsTestProject>true<IsTestProject>" 屬性。 + Skipping running test for project {0}. To run tests with dotnet test add "<IsTestProject>true</IsTestProject>" property to project file. + 即將跳過為專案 {0} 執行測試。若要使用 dotnet 測試來執行測試,請在專案檔中新增 "<IsTestProject>true</IsTestProject>" 屬性。 From ed25c6423924a0d4ec63a36cd111a7326510ddf6 Mon Sep 17 00:00:00 2001 From: Sarabjot Singh Date: Tue, 20 Nov 2018 14:57:14 +0530 Subject: [PATCH 2/2] Translation Layer connection timeout (#1843) Increasing the connection timeout, and making it configurable between the translationlayer and vstest.console. --- .../VsTestConsoleWrapper.cs | 39 ++++++++++++++----- .../VsTestConsoleWrapperTests.cs | 15 +++++-- 2 files changed, 41 insertions(+), 13 deletions(-) diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleWrapper.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleWrapper.cs index f128e7cc58..672d9b4164 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleWrapper.cs +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleWrapper.cs @@ -5,14 +5,20 @@ namespace Microsoft.TestPlatform.VsTestConsole.TranslationLayer { using System.Collections.Generic; using System.Diagnostics; + using System.Globalization; using System.Linq; using Microsoft.TestPlatform.VsTestConsole.TranslationLayer.Interfaces; + using Microsoft.VisualStudio.TestPlatform.CoreUtilities.Helpers; using Microsoft.VisualStudio.TestPlatform.CoreUtilities.Tracing; using Microsoft.VisualStudio.TestPlatform.CoreUtilities.Tracing.Interfaces; using Microsoft.VisualStudio.TestPlatform.ObjectModel; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.Interfaces; + using Microsoft.VisualStudio.TestPlatform.PlatformAbstractions; + using Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces; + using CommunicationUtilitiesResources = Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.Resources.Resources; + using CoreUtilitiesConstants = Microsoft.VisualStudio.TestPlatform.CoreUtilities.Constants; /// /// An implementation of to invoke test operations @@ -28,6 +34,8 @@ public class VsTestConsoleWrapper : IVsTestConsoleWrapper private readonly ITranslationLayerRequestSender requestSender; + private readonly IProcessHelper processHelper; + private bool sessionStarted; /// @@ -63,7 +71,7 @@ public VsTestConsoleWrapper(string vstestConsolePath) : /// Path to the test runner vstest.console.exe. /// The parameters to be passed onto the runner process public VsTestConsoleWrapper(string vstestConsolePath, ConsoleParameters consoleParameters) : - this(new VsTestConsoleRequestSender(), new VsTestConsoleProcessManager(vstestConsolePath), consoleParameters, TestPlatformEventSource.Instance) + this(new VsTestConsoleRequestSender(), new VsTestConsoleProcessManager(vstestConsolePath), consoleParameters, TestPlatformEventSource.Instance, new ProcessHelper()) { } @@ -74,12 +82,14 @@ public VsTestConsoleWrapper(string vstestConsolePath, ConsoleParameters consoleP /// Process manager. /// The parameters to be passed onto the runner process /// Performance event source - internal VsTestConsoleWrapper(ITranslationLayerRequestSender requestSender, IProcessManager processManager, ConsoleParameters consoleParameters, ITestPlatformEventSource testPlatformEventSource) + /// Helper for process related utilities + internal VsTestConsoleWrapper(ITranslationLayerRequestSender requestSender, IProcessManager processManager, ConsoleParameters consoleParameters, ITestPlatformEventSource testPlatformEventSource, IProcessHelper processHelper) { this.requestSender = requestSender; this.vstestConsoleProcessManager = processManager; this.consoleParameters = consoleParameters; this.testPlatformEventSource = testPlatformEventSource; + this.processHelper = processHelper; this.pathToAdditionalExtensions = new List(); this.vstestConsoleProcessManager.ProcessExited += (sender, args) => this.requestSender.OnProcessExited(); @@ -263,20 +273,29 @@ private void EnsureInitialized() EqtTrace.Info("VsTestConsoleWrapper.EnsureInitialized: Process Started."); this.sessionStarted = this.WaitForConnection(); } - - if (!this.sessionStarted) - { - throw new TransationLayerException("Error connecting to Vstest Command Line"); - } } private bool WaitForConnection() { EqtTrace.Info("VsTestConsoleWrapper.WaitForConnection: Waiting for connection to command line runner."); - var connected = this.requestSender.WaitForRequestHandlerConnection(ConnectionTimeout); - this.testPlatformEventSource.TranslationLayerInitializeStop(); - return connected; + var timeout = EnvironmentHelper.GetConnectionTimeout(); + if (!this.requestSender.WaitForRequestHandlerConnection(timeout * 1000)) + { + var processName = this.processHelper.GetCurrentProcessFileName(); + throw new TransationLayerException( + string.Format( + CultureInfo.CurrentUICulture, + CommunicationUtilitiesResources.ConnectionTimeoutErrorMessage, + processName, + CoreUtilitiesConstants.VstestConsoleProcessName, + timeout, + EnvironmentHelper.VstestConnectionTimeout) + ); + } + + this.testPlatformEventSource.TranslationLayerInitializeStop(); + return true; } } } diff --git a/test/TranslationLayer.UnitTests/VsTestConsoleWrapperTests.cs b/test/TranslationLayer.UnitTests/VsTestConsoleWrapperTests.cs index 1c7f158755..02d2b79de1 100644 --- a/test/TranslationLayer.UnitTests/VsTestConsoleWrapperTests.cs +++ b/test/TranslationLayer.UnitTests/VsTestConsoleWrapperTests.cs @@ -11,6 +11,7 @@ namespace Microsoft.TestPlatform.VsTestConsole.TranslationLayer.UnitTests using Microsoft.VisualStudio.TestPlatform.ObjectModel; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.Interfaces; + using Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -23,6 +24,8 @@ public class VsTestConsoleWrapperTests private Mock mockProcessManager; + private Mock mockProcessHelper; + private Mock mockRequestSender; private readonly List testSources = new List { "Hello", "World" }; @@ -42,11 +45,13 @@ public void TestInitialize() this.mockRequestSender = new Mock(); this.mockProcessManager = new Mock(); + this.mockProcessHelper = new Mock(); this.consoleWrapper = new VsTestConsoleWrapper( this.mockRequestSender.Object, this.mockProcessManager.Object, this.consoleParameters, - new Mock().Object); + new Mock().Object, + this.mockProcessHelper.Object); this.mockRequestSender.Setup(rs => rs.WaitForRequestHandlerConnection(It.IsAny())).Returns(true); this.mockRequestSender.Setup(rs => rs.InitializeCommunication()).Returns(100); @@ -124,9 +129,11 @@ public void InitializeExtensionsShouldSucceed() [TestMethod] public void InitializeExtensionsShouldThrowExceptionOnBadConnection() { + this.mockProcessHelper.Setup(x => x.GetCurrentProcessFileName()).Returns("DummyProcess"); this.mockRequestSender.Setup(rs => rs.WaitForRequestHandlerConnection(It.IsAny())).Returns(false); - Assert.ThrowsException(() => this.consoleWrapper.InitializeExtensions(new List { "Hello", "World" })); + var exception = Assert.ThrowsException(() => this.consoleWrapper.InitializeExtensions(new List { "Hello", "World" })); + 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.InitializeExtensions(It.IsAny>()), Times.Never); } @@ -158,9 +165,11 @@ public void DiscoverTestsShouldCallTestDiscoveryHandler2IfTestDiscoveryHandler1I [TestMethod] public void DiscoverTestsShouldThrowExceptionOnBadConnection() { + this.mockProcessHelper.Setup(x => x.GetCurrentProcessFileName()).Returns("DummyProcess"); this.mockRequestSender.Setup(rs => rs.WaitForRequestHandlerConnection(It.IsAny())).Returns(false); - Assert.ThrowsException(() => this.consoleWrapper.DiscoverTests(new List { "Hello", "World" }, null, null, new Mock().Object)); + 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); }