diff --git a/src/Adapter/MSTestAdapter.PlatformServices/Helpers/MSTestDiscovererHelpers.cs b/src/Adapter/MSTestAdapter.PlatformServices/Helpers/MSTestDiscovererHelpers.cs index 6f183af4d9..593c6b73f5 100644 --- a/src/Adapter/MSTestAdapter.PlatformServices/Helpers/MSTestDiscovererHelpers.cs +++ b/src/Adapter/MSTestAdapter.PlatformServices/Helpers/MSTestDiscovererHelpers.cs @@ -31,14 +31,12 @@ internal static bool InitializeDiscovery(IEnumerable sources, IDiscovery try { MSTestSettings.PopulateSettings(discoveryContext, messageLogger, configuration); + return true; } catch (AdapterSettingsException ex) { messageLogger.SendMessage(TestMessageLevel.Error, ex.Message); return false; } - - // Scenarios that include testsettings or forcing a run via the legacy adapter are currently not supported in MSTestAdapter. - return !MSTestSettings.IsLegacyScenario(messageLogger); } } diff --git a/src/Adapter/MSTestAdapter.PlatformServices/MSTestSettings.cs b/src/Adapter/MSTestAdapter.PlatformServices/MSTestSettings.cs index 44e176179a..1d8692e804 100644 --- a/src/Adapter/MSTestAdapter.PlatformServices/MSTestSettings.cs +++ b/src/Adapter/MSTestAdapter.PlatformServices/MSTestSettings.cs @@ -52,7 +52,6 @@ public MSTestSettings() MapInconclusiveToFailed = false; MapNotRunnableToFailed = true; TreatDiscoveryWarningsAsErrors = true; - TestSettingsFile = null; DisableParallelization = false; ConsiderEmptyDataSourceAsInconclusive = false; TestTimeout = 0; @@ -92,11 +91,6 @@ public static RunConfigurationSettings RunConfigurationSettings /// public bool CaptureDebugTraces { get; private set; } - /// - /// Gets the path to settings file. - /// - public string? TestSettingsFile { get; private set; } - /// /// Gets a value indicating whether an inconclusive result be mapped to failed test. /// @@ -206,7 +200,6 @@ public static void PopulateSettings(MSTestSettings settings) CurrentSettings.ParallelizationWorkers = settings.ParallelizationWorkers; CurrentSettings.TestCleanupTimeout = settings.TestCleanupTimeout; CurrentSettings.TestInitializeTimeout = settings.TestInitializeTimeout; - CurrentSettings.TestSettingsFile = settings.TestSettingsFile; CurrentSettings.TestTimeout = settings.TestTimeout; CurrentSettings.TreatDiscoveryWarningsAsErrors = settings.TreatDiscoveryWarningsAsErrors; CurrentSettings.LaunchDebuggerOnAssertionFailure = settings.LaunchDebuggerOnAssertionFailure; @@ -297,22 +290,6 @@ internal static void PopulateSettings(IDiscoveryContext? context, IMessageLogger RunConfigurationSettings = runConfigurationSettings; } - /// - /// Get the MSTestV1 adapter settings from the context. - /// - /// The logger for messages. - /// Returns true if test settings is provided.. - public static bool IsLegacyScenario(IMessageLogger logger) - { - if (!StringEx.IsNullOrEmpty(CurrentSettings.TestSettingsFile)) - { - logger.SendMessage(TestMessageLevel.Warning, Resource.LegacyScenariosNotSupportedWarning); - return true; - } - - return false; - } - /// /// Gets the adapter specific settings from the xml. /// @@ -388,7 +365,6 @@ private static MSTestSettings ToSettings(XmlReader reader, IMessageLogger? logge // (or) // // - // ..\..\Local.testsettings // true // MSTestSettings settings = new(); @@ -466,22 +442,6 @@ private static MSTestSettings ToSettings(XmlReader reader, IMessageLogger? logge break; } - case "SETTINGSFILE": - { - string fileName = reader.ReadInnerXml(); - - if (!StringEx.IsNullOrEmpty(fileName)) - { - settings.TestSettingsFile = fileName; - } - else - { - logger?.SendMessage(TestMessageLevel.Warning, string.Format(CultureInfo.CurrentCulture, Resource.InvalidValue, fileName, "SettingsFile")); - } - - break; - } - case "PARALLELIZE": { SetParallelSettings(reader.ReadSubtree(), settings); diff --git a/src/Adapter/MSTestAdapter.PlatformServices/Resources/Resource.resx b/src/Adapter/MSTestAdapter.PlatformServices/Resources/Resource.resx index 2c18d945a9..4aa2f48189 100644 --- a/src/Adapter/MSTestAdapter.PlatformServices/Resources/Resource.resx +++ b/src/Adapter/MSTestAdapter.PlatformServices/Resources/Resource.resx @@ -289,9 +289,6 @@ but received {4} argument(s), with types '{5}'. Invalid settings '{0}'. Unexpected XmlAttribute: '{1}'. - - Warning : A testsettings file or a vsmdi file is not supported with the MSTest V2 Adapter. - An older version of MSTestV2 package is loaded in assembly, test discovery might fail to discover all data tests if they depend on `.runsettings` file. diff --git a/src/Adapter/MSTestAdapter.PlatformServices/Resources/xlf/Resource.cs.xlf b/src/Adapter/MSTestAdapter.PlatformServices/Resources/xlf/Resource.cs.xlf index c38d5243bd..c98f8cefe8 100644 --- a/src/Adapter/MSTestAdapter.PlatformServices/Resources/xlf/Resource.cs.xlf +++ b/src/Adapter/MSTestAdapter.PlatformServices/Resources/xlf/Resource.cs.xlf @@ -255,11 +255,6 @@ byl však přijat tento počet argumentů: {4} s typy {5}. Neplatná hodnota {0} pro položku runsettings {1}. Nastavení bude ignorováno. - - Warning : A testsettings file or a vsmdi file is not supported with the MSTest V2 Adapter. - Upozornění: Adaptér MSTest V2 nepodporuje soubor testsettings ani vsmdi. - - Test Run deployment issue: The assembly or module '{0}' was not found. Reason: {1} Problém nasazení testovacího běhu: Sestavení nebo modul {0} se nenašly. Důvod: {1} diff --git a/src/Adapter/MSTestAdapter.PlatformServices/Resources/xlf/Resource.de.xlf b/src/Adapter/MSTestAdapter.PlatformServices/Resources/xlf/Resource.de.xlf index ba69e54b16..267a98ece4 100644 --- a/src/Adapter/MSTestAdapter.PlatformServices/Resources/xlf/Resource.de.xlf +++ b/src/Adapter/MSTestAdapter.PlatformServices/Resources/xlf/Resource.de.xlf @@ -255,11 +255,6 @@ aber empfing {4} Argument(e) mit den Typen „{5}“. Ungültiger Wert "{0}" für runsettings-Eintrag "{1}". Die Einstellung wird ignoriert. - - Warning : A testsettings file or a vsmdi file is not supported with the MSTest V2 Adapter. - Warnung: Eine TESTSETTINGS-Datei oder eine VSMDI-Datei wird vom MSTest-V2-Adapter nicht unterstützt. - - Test Run deployment issue: The assembly or module '{0}' was not found. Reason: {1} Problem bei der Testlaufbereitstellung: Die Assembly oder das Modul "{0}" wurde nicht gefunden. Ursache: {1} diff --git a/src/Adapter/MSTestAdapter.PlatformServices/Resources/xlf/Resource.es.xlf b/src/Adapter/MSTestAdapter.PlatformServices/Resources/xlf/Resource.es.xlf index 3dc717f3b7..1443052200 100644 --- a/src/Adapter/MSTestAdapter.PlatformServices/Resources/xlf/Resource.es.xlf +++ b/src/Adapter/MSTestAdapter.PlatformServices/Resources/xlf/Resource.es.xlf @@ -255,11 +255,6 @@ pero recibió {4} argumentos, con los tipos '{5}'. Valor ''{0}'' no válido para la entrada runsettings ''{1}'', se omitirá la configuración. - - Warning : A testsettings file or a vsmdi file is not supported with the MSTest V2 Adapter. - Advertencia: No se admite un archivo testsettings o vsmdi con el adaptador de MSTest V2. - - Test Run deployment issue: The assembly or module '{0}' was not found. Reason: {1} Problema de implementación en la serie de pruebas: no se encontró el ensamblado o el módulo '{0}'. Motivo: {1} diff --git a/src/Adapter/MSTestAdapter.PlatformServices/Resources/xlf/Resource.fr.xlf b/src/Adapter/MSTestAdapter.PlatformServices/Resources/xlf/Resource.fr.xlf index 6202a7529b..9ee5036f55 100644 --- a/src/Adapter/MSTestAdapter.PlatformServices/Resources/xlf/Resource.fr.xlf +++ b/src/Adapter/MSTestAdapter.PlatformServices/Resources/xlf/Resource.fr.xlf @@ -255,11 +255,6 @@ mais a reçu {4} argument(s), avec les types « {5} ». Valeur non valide '{0}' pour l’entrée runsettings '{1}', le paramètre sera ignoré. - - Warning : A testsettings file or a vsmdi file is not supported with the MSTest V2 Adapter. - Avertissement : L'adaptateur MSTest V2 ne prend pas en charge les fichiers testsettings ou vsmdi. - - Test Run deployment issue: The assembly or module '{0}' was not found. Reason: {1} Problème de déploiement de la série de tests : l'assembly ou le module '{0}' est introuvable. Raison : {1} diff --git a/src/Adapter/MSTestAdapter.PlatformServices/Resources/xlf/Resource.it.xlf b/src/Adapter/MSTestAdapter.PlatformServices/Resources/xlf/Resource.it.xlf index e789f7bfc7..a8ffd371bb 100644 --- a/src/Adapter/MSTestAdapter.PlatformServices/Resources/xlf/Resource.it.xlf +++ b/src/Adapter/MSTestAdapter.PlatformServices/Resources/xlf/Resource.it.xlf @@ -255,11 +255,6 @@ ma ha ricevuto {4} argomenti, con tipi '{5}'. Valore non valido '{0}' per la voce runsettings '{1}'. L'impostazione verrà ignorata. - - Warning : A testsettings file or a vsmdi file is not supported with the MSTest V2 Adapter. - Avviso: con l'adattatore MSTest V2 non è possibile usare un file testsettings o un file vsmdi. - - Test Run deployment issue: The assembly or module '{0}' was not found. Reason: {1} Problema di distribuzione dell'esecuzione dei test: l'assembly o il modulo '{0}' non è stato trovato. Motivo: {1} diff --git a/src/Adapter/MSTestAdapter.PlatformServices/Resources/xlf/Resource.ja.xlf b/src/Adapter/MSTestAdapter.PlatformServices/Resources/xlf/Resource.ja.xlf index 8a81b5b464..5b5a963c0e 100644 --- a/src/Adapter/MSTestAdapter.PlatformServices/Resources/xlf/Resource.ja.xlf +++ b/src/Adapter/MSTestAdapter.PlatformServices/Resources/xlf/Resource.ja.xlf @@ -256,11 +256,6 @@ but received {4} argument(s), with types '{5}'. runsettings エントリ '{1}' の値 '{0}' は無効です。設定は無視されます。 - - Warning : A testsettings file or a vsmdi file is not supported with the MSTest V2 Adapter. - 警告: testsettings ファイル、vsmdi ファイルは MSTest V2 アダプターではサポートされていません。 - - Test Run deployment issue: The assembly or module '{0}' was not found. Reason: {1} テストの実行の配置問題です: アセンブリまたはモジュール '{0}' が見つかりませんでした。理由: {1} diff --git a/src/Adapter/MSTestAdapter.PlatformServices/Resources/xlf/Resource.ko.xlf b/src/Adapter/MSTestAdapter.PlatformServices/Resources/xlf/Resource.ko.xlf index 5f49661feb..052ccf9601 100644 --- a/src/Adapter/MSTestAdapter.PlatformServices/Resources/xlf/Resource.ko.xlf +++ b/src/Adapter/MSTestAdapter.PlatformServices/Resources/xlf/Resource.ko.xlf @@ -255,11 +255,6 @@ but received {4} argument(s), with types '{5}'. runsettings 항목 '{1}'에 대해 '{0}' 값이 잘못되었습니다. 설정은 무시됩니다. - - Warning : A testsettings file or a vsmdi file is not supported with the MSTest V2 Adapter. - 경고: MSTest V2 어댑터에서는 testsettings 파일 또는 vsmdi 파일이 지원되지 않습니다. - - Test Run deployment issue: The assembly or module '{0}' was not found. Reason: {1} 테스트 실행 배포 문제: 어셈블리 또는 모듈 '{0}'을(를) 찾을 수 없습니다. 이유: {1} diff --git a/src/Adapter/MSTestAdapter.PlatformServices/Resources/xlf/Resource.pl.xlf b/src/Adapter/MSTestAdapter.PlatformServices/Resources/xlf/Resource.pl.xlf index a9045db750..8309926eff 100644 --- a/src/Adapter/MSTestAdapter.PlatformServices/Resources/xlf/Resource.pl.xlf +++ b/src/Adapter/MSTestAdapter.PlatformServices/Resources/xlf/Resource.pl.xlf @@ -255,11 +255,6 @@ ale odebrał argumenty {4} z typami „{5}”. Nieprawidłowa wartość „{0}” dla wpisu runsettings „{1}”. Ustawienie zostanie zignorowane. - - Warning : A testsettings file or a vsmdi file is not supported with the MSTest V2 Adapter. - Ostrzeżenie: Plik testsettings lub plik vsmdi nie jest obsługiwany przez adapter MSTest w wersji 2. - - Test Run deployment issue: The assembly or module '{0}' was not found. Reason: {1} Problem wdrażania przebiegu testu: nie znaleziono zestawu lub modułu „{0}”. Przyczyna: {1} diff --git a/src/Adapter/MSTestAdapter.PlatformServices/Resources/xlf/Resource.pt-BR.xlf b/src/Adapter/MSTestAdapter.PlatformServices/Resources/xlf/Resource.pt-BR.xlf index ebe363360f..fd105b2b91 100644 --- a/src/Adapter/MSTestAdapter.PlatformServices/Resources/xlf/Resource.pt-BR.xlf +++ b/src/Adapter/MSTestAdapter.PlatformServices/Resources/xlf/Resource.pt-BR.xlf @@ -255,11 +255,6 @@ mas {4} argumentos recebidos, com tipos '{5}'. Valor inválido "{0}" para a entrada runsettings "{1}", a configuração será ignorada. - - Warning : A testsettings file or a vsmdi file is not supported with the MSTest V2 Adapter. - Aviso: um arquivo testsettings ou um arquivo vsmdi não tem suporte no MSTest V2 Adapter. - - Test Run deployment issue: The assembly or module '{0}' was not found. Reason: {1} Problema de implantação de Execução de Teste: o assembly ou módulo '{0}' não foi encontrado. Motivo: {1} diff --git a/src/Adapter/MSTestAdapter.PlatformServices/Resources/xlf/Resource.ru.xlf b/src/Adapter/MSTestAdapter.PlatformServices/Resources/xlf/Resource.ru.xlf index 8439ce3c89..1f92136321 100644 --- a/src/Adapter/MSTestAdapter.PlatformServices/Resources/xlf/Resource.ru.xlf +++ b/src/Adapter/MSTestAdapter.PlatformServices/Resources/xlf/Resource.ru.xlf @@ -255,11 +255,6 @@ but received {4} argument(s), with types '{5}'. Недопустимое значение "{0}" для записи runsettings "{1}", параметр будет пропущен. - - Warning : A testsettings file or a vsmdi file is not supported with the MSTest V2 Adapter. - Внимание! Адаптер MSTest версии 2 не поддерживает файл TESTSETTINGS или VSMDI. - - Test Run deployment issue: The assembly or module '{0}' was not found. Reason: {1} Ошибка развертывания тестового запуска: не удалось найти сборку или модуль "{0}". Причина: {1} diff --git a/src/Adapter/MSTestAdapter.PlatformServices/Resources/xlf/Resource.tr.xlf b/src/Adapter/MSTestAdapter.PlatformServices/Resources/xlf/Resource.tr.xlf index 69f8814894..9e39ef1f9b 100644 --- a/src/Adapter/MSTestAdapter.PlatformServices/Resources/xlf/Resource.tr.xlf +++ b/src/Adapter/MSTestAdapter.PlatformServices/Resources/xlf/Resource.tr.xlf @@ -255,11 +255,6 @@ ancak, '{5}' türünde {4} bağımsız değişken aldı. '{1}' çalıştırma ayarları girişi için '{0}' değeri geçersiz, ayar yoksayılacak. - - Warning : A testsettings file or a vsmdi file is not supported with the MSTest V2 Adapter. - Uyarı : MSTest V2 Adapter ile bir testsettings dosyası veya bir vsmdi dosyası desteklenmez. - - Test Run deployment issue: The assembly or module '{0}' was not found. Reason: {1} Test Çalıştırması dağıtım sorunu: '{0}' adlı bütünleştirilmiş kod veya modül bulunamadı. Nedeni: {1} diff --git a/src/Adapter/MSTestAdapter.PlatformServices/Resources/xlf/Resource.zh-Hans.xlf b/src/Adapter/MSTestAdapter.PlatformServices/Resources/xlf/Resource.zh-Hans.xlf index 492d93e442..11c20a8082 100644 --- a/src/Adapter/MSTestAdapter.PlatformServices/Resources/xlf/Resource.zh-Hans.xlf +++ b/src/Adapter/MSTestAdapter.PlatformServices/Resources/xlf/Resource.zh-Hans.xlf @@ -255,11 +255,6 @@ but received {4} argument(s), with types '{5}'. runsettings 项 ‘{1}’ 的值 ‘{0}’ 无效,将忽略设置。 - - Warning : A testsettings file or a vsmdi file is not supported with the MSTest V2 Adapter. - 警告: MSTest V2 适配器不支持 testsettings 文件或 vsmdi 文件。 - - Test Run deployment issue: The assembly or module '{0}' was not found. Reason: {1} 测试运行部署问题: 找不到程序集或模块“{0}”。原因: {1} diff --git a/src/Adapter/MSTestAdapter.PlatformServices/Resources/xlf/Resource.zh-Hant.xlf b/src/Adapter/MSTestAdapter.PlatformServices/Resources/xlf/Resource.zh-Hant.xlf index 171e03c4af..2e942c2bf9 100644 --- a/src/Adapter/MSTestAdapter.PlatformServices/Resources/xlf/Resource.zh-Hant.xlf +++ b/src/Adapter/MSTestAdapter.PlatformServices/Resources/xlf/Resource.zh-Hant.xlf @@ -255,11 +255,6 @@ but received {4} argument(s), with types '{5}'. runsettings 項目 '{1}' 的值 '{0}' 無效,將忽略設定。 - - Warning : A testsettings file or a vsmdi file is not supported with the MSTest V2 Adapter. - 警告: MSTest V2 配接器不支援 testsettings 檔案 vsmdi 檔案。 - - Test Run deployment issue: The assembly or module '{0}' was not found. Reason: {1} 測試回合部署問題: 找不到組件或模組 '{0}'。原因: {1} diff --git a/test/UnitTests/MSTestAdapter.PlatformServices.UnitTests/Discovery/AssemblyEnumeratorTests.cs b/test/UnitTests/MSTestAdapter.PlatformServices.UnitTests/Discovery/AssemblyEnumeratorTests.cs index e59d468d52..2766c1f9da 100644 --- a/test/UnitTests/MSTestAdapter.PlatformServices.UnitTests/Discovery/AssemblyEnumeratorTests.cs +++ b/test/UnitTests/MSTestAdapter.PlatformServices.UnitTests/Discovery/AssemblyEnumeratorTests.cs @@ -52,7 +52,7 @@ public void ConstructorShouldPopulateSettings() """ - DummyPath\TestSettings1.testsettings + 12 """; @@ -70,7 +70,7 @@ public void ConstructorShouldPopulateSettings() // Constructor has the side effect of populating the passed settings to MSTestSettings.CurrentSettings _ = new AssemblyEnumerator(adapterSettings); - MSTestSettings.CurrentSettings.TestSettingsFile.Should().Be("DummyPath\\TestSettings1.testsettings"); + MSTestSettings.CurrentSettings.TestTimeout.Should().Be(12); } #endregion diff --git a/test/UnitTests/MSTestAdapter.PlatformServices.UnitTests/Execution/UnitTestRunnerTests.cs b/test/UnitTests/MSTestAdapter.PlatformServices.UnitTests/Execution/UnitTestRunnerTests.cs index d621009b9f..bda570ed00 100644 --- a/test/UnitTests/MSTestAdapter.PlatformServices.UnitTests/Execution/UnitTestRunnerTests.cs +++ b/test/UnitTests/MSTestAdapter.PlatformServices.UnitTests/Execution/UnitTestRunnerTests.cs @@ -53,7 +53,7 @@ public void ConstructorShouldPopulateSettings() """ - DummyPath\TestSettings1.testsettings + 12 """; @@ -69,7 +69,7 @@ public void ConstructorShouldPopulateSettings() adapterSettings.Should().NotBeNull(); var assemblyEnumerator = new UnitTestRunner(adapterSettings, []); - MSTestSettings.CurrentSettings.TestSettingsFile.Should().Be("DummyPath\\TestSettings1.testsettings"); + MSTestSettings.CurrentSettings.TestTimeout.Should().Be(12); } #endregion diff --git a/test/UnitTests/MSTestAdapter.PlatformServices.UnitTests/MSTestSettingsTests.cs b/test/UnitTests/MSTestAdapter.PlatformServices.UnitTests/MSTestSettingsTests.cs index 5869db72ff..139e743396 100644 --- a/test/UnitTests/MSTestAdapter.PlatformServices.UnitTests/MSTestSettingsTests.cs +++ b/test/UnitTests/MSTestAdapter.PlatformServices.UnitTests/MSTestSettingsTests.cs @@ -6,7 +6,6 @@ using Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter; using Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.ObjectModel; using Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Interface; -using Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Resources; using Microsoft.VisualStudio.TestPlatform.MSTestAdapter.UnitTests.TestableImplementations; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging; @@ -107,7 +106,6 @@ public void RunSettings_WithInvalidValues_GettingAWarningForEachInvalidSetting() timeout 3 timeout - 3 3 3 @@ -119,7 +117,7 @@ public void RunSettings_WithInvalidValues_GettingAWarningForEachInvalidSetting() var adapterSettings = MSTestSettings.GetSettings(runSettingsXml, MSTestSettings.SettingsNameAlias, _mockMessageLogger.Object); - _mockMessageLogger.Verify(lm => lm.SendMessage(TestMessageLevel.Warning, It.IsAny()), Times.Exactly(14)); + _mockMessageLogger.Verify(lm => lm.SendMessage(TestMessageLevel.Warning, It.IsAny()), Times.Exactly(13)); _mockMessageLogger.Verify(lm => lm.SendMessage(TestMessageLevel.Warning, "Invalid value '3' for runsettings entry 'CooperativeCancellationTimeout', setting will be ignored."), Times.Once); _mockMessageLogger.Verify(lm => lm.SendMessage(TestMessageLevel.Warning, "Invalid value 'timeout' for runsettings entry 'TestCleanupTimeout', setting will be ignored."), Times.Once); _mockMessageLogger.Verify(lm => lm.SendMessage(TestMessageLevel.Warning, "Invalid value 'timeout' for runsettings entry 'ClassCleanupTimeout', setting will be ignored."), Times.Once); @@ -130,7 +128,6 @@ public void RunSettings_WithInvalidValues_GettingAWarningForEachInvalidSetting() _mockMessageLogger.Verify(lm => lm.SendMessage(TestMessageLevel.Warning, "Invalid value 'timeout' for runsettings entry 'ClassInitializeTimeout', setting will be ignored."), Times.Once); _mockMessageLogger.Verify(lm => lm.SendMessage(TestMessageLevel.Warning, "Invalid value 'timeout' for runsettings entry 'AssemblyInitializeTimeout', setting will be ignored."), Times.Once); _mockMessageLogger.Verify(lm => lm.SendMessage(TestMessageLevel.Warning, "Invalid value 'timeout' for runsettings entry 'TestTimeout', setting will be ignored."), Times.Once); - _mockMessageLogger.Verify(lm => lm.SendMessage(TestMessageLevel.Warning, "Invalid value '' for runsettings entry 'SettingsFile', setting will be ignored."), Times.Once); _mockMessageLogger.Verify(lm => lm.SendMessage(TestMessageLevel.Warning, "Invalid value '3' for runsettings entry 'TreatDiscoveryWarningsAsErrors', setting will be ignored."), Times.Once); _mockMessageLogger.Verify(lm => lm.SendMessage(TestMessageLevel.Warning, "Invalid value '3' for runsettings entry 'MapInconclusiveToFailed', setting will be ignored."), Times.Once); _mockMessageLogger.Verify(lm => lm.SendMessage(TestMessageLevel.Warning, "Invalid value '3' for runsettings entry 'ConsiderEmptyDataSourceAsInconclusive', setting will be ignored."), Times.Once); @@ -152,37 +149,6 @@ public void MapNotRunnableToFailedShouldBeConsumedFromRunSettingsWhenSpecified() adapterSettings.MapNotRunnableToFailed.Should().BeTrue(); } - public void TestSettingsFileIsByDefaultNullWhenNotSpecified() - { - string runSettingsXml = - """ - - - - - """; - - MSTestSettings adapterSettings = MSTestSettings.GetSettings(runSettingsXml, MSTestSettings.SettingsName, _mockMessageLogger.Object)!; - - adapterSettings.TestSettingsFile.Should().BeNull(); - } - - public void TestSettingsFileShouldNotBeNullWhenSpecifiedInRunSettings() - { - string runSettingsXml = - """ - - - DummyPath\\TestSettings1.testsettings - - - """; - - MSTestSettings adapterSettings = MSTestSettings.GetSettings(runSettingsXml, MSTestSettings.SettingsName, _mockMessageLogger.Object)!; - - adapterSettings.TestSettingsFile.Should().NotBeNull(); - } - public void CaptureDebugTracesShouldBeTrueByDefault() { string runSettingsXml = @@ -482,14 +448,14 @@ public void GetSettingsShouldBeAbleToReadAfterParallelizationSettings() - DummyPath\\TestSettings1.testsettings + 12 """; MSTestSettings adapterSettings = MSTestSettings.GetSettings(runSettingsXml, MSTestSettings.SettingsNameAlias, _mockMessageLogger.Object)!; - adapterSettings.TestSettingsFile.Should().NotBeNull(); + adapterSettings.TestTimeout.Should().Be(12); } public void GetSettingsShouldBeAbleToReadAfterParallelizationSettingsWithData() @@ -502,14 +468,14 @@ public void GetSettingsShouldBeAbleToReadAfterParallelizationSettingsWithData() 127 MethodLevel - DummyPath\\TestSettings1.testsettings + 12 """; MSTestSettings adapterSettings = MSTestSettings.GetSettings(runSettingsXml, MSTestSettings.SettingsNameAlias, _mockMessageLogger.Object)!; - adapterSettings.TestSettingsFile.Should().NotBeNull(); + adapterSettings.TestTimeout.Should().Be(12); adapterSettings.ParallelizationWorkers.Should().Be(127); adapterSettings.ParallelizationScope.Should().Be(ExecutionScope.MethodLevel); } @@ -521,14 +487,14 @@ public void GetSettingsShouldBeAbleToReadAfterParallelizationSettingsOnEmptyPara - DummyPath\\TestSettings1.testsettings + 12 """; MSTestSettings adapterSettings = MSTestSettings.GetSettings(runSettingsXml, MSTestSettings.SettingsNameAlias, _mockMessageLogger.Object)!; - adapterSettings.TestSettingsFile.Should().NotBeNull(); + adapterSettings.TestTimeout.Should().Be(12); } public void DisableParallelizationShouldBeFalseByDefault() @@ -643,7 +609,7 @@ public void GetSettingsShouldBeAbleToReadSettingsAfterThePlatformServiceReadsIts True True True - DummyPath\\TestSettings1.testsettings + 12 """; @@ -683,7 +649,7 @@ public void GetSettingsShouldBeAbleToReadSettingsAfterThePlatformServiceReadsIts dummyPlatformSpecificSetting.Should().BeTrue(); adapterSettings.MapInconclusiveToFailed.Should().BeTrue(); adapterSettings.MapNotRunnableToFailed.Should().BeTrue(); - adapterSettings.TestSettingsFile.Should().Be("DummyPath\\\\TestSettings1.testsettings"); + adapterSettings.TestTimeout.Should().Be(12); } public void GetSettingsShouldBeAbleToReadSettingsIfThePlatformServiceDoesNotUnderstandASetting() @@ -696,7 +662,7 @@ public void GetSettingsShouldBeAbleToReadSettingsIfThePlatformServiceDoesNotUnde True foobar True - DummyPath\\TestSettings1.testsettings + 12 """; @@ -736,7 +702,7 @@ public void GetSettingsShouldBeAbleToReadSettingsIfThePlatformServiceDoesNotUnde dummyPlatformSpecificSetting.Should().BeTrue(); adapterSettings.MapInconclusiveToFailed.Should().BeTrue(); adapterSettings.MapNotRunnableToFailed.Should().BeTrue(); - adapterSettings.TestSettingsFile.Should().Be("DummyPath\\\\TestSettings1.testsettings"); + adapterSettings.TestTimeout.Should().Be(12); } public void GetSettingsShouldOnlyReadTheAdapterSection() @@ -859,7 +825,7 @@ public void CurrentSettingShouldReturnCachedLoadedSettings() """ - DummyPath\\TestSettings1.testsettings + 12 """; @@ -872,7 +838,7 @@ public void CurrentSettingShouldReturnCachedLoadedSettings() MSTestSettings adapterSettings2 = MSTestSettings.CurrentSettings; adapterSettings.Should().NotBeNull(); - adapterSettings.TestSettingsFile.Should().NotBeNullOrEmpty(); + adapterSettings.TestTimeout.Should().Be(12); (adapterSettings == adapterSettings2).Should().BeTrue(); } @@ -890,7 +856,7 @@ public void PopulateSettingsShouldFillInSettingsFromSettingsObject() False True True - DummyPath\\TestSettings1.testsettings + 12 """; @@ -902,7 +868,7 @@ public void PopulateSettingsShouldFillInSettingsFromSettingsObject() MSTestSettings.CurrentSettings.CaptureDebugTraces.Should().BeFalse(); MSTestSettings.CurrentSettings.MapInconclusiveToFailed.Should().BeTrue(); MSTestSettings.CurrentSettings.MapNotRunnableToFailed.Should().BeTrue(); - MSTestSettings.CurrentSettings.TestSettingsFile.Should().NotBeNullOrEmpty(); + MSTestSettings.CurrentSettings.TestTimeout.Should().Be(12); } public void PopulateSettingsShouldInitializeDefaultAdapterSettingsWhenDiscoveryContextIsNull() @@ -945,7 +911,7 @@ public void PopulateSettingsShouldInitializeSettingsToDefaultIfNotSpecified() """ - DummyPath\\TestSettings1.testsettings + 12 """; @@ -970,7 +936,7 @@ public void PopulateSettingsShouldInitializeSettingsFromMSTestSection() True True - DummyPath\\TestSettings1.testsettings + 12 """; @@ -985,7 +951,7 @@ public void PopulateSettingsShouldInitializeSettingsFromMSTestSection() adapterSettings.MapInconclusiveToFailed.Should().BeTrue(); adapterSettings.MapNotRunnableToFailed.Should().BeTrue(); - adapterSettings.TestSettingsFile.Should().NotBeNullOrEmpty(); + adapterSettings.TestTimeout.Should().Be(12); } public void PopulateSettingsShouldInitializeSettingsFromMSTestV2Section() @@ -996,7 +962,7 @@ public void PopulateSettingsShouldInitializeSettingsFromMSTestV2Section() True True - DummyPath\\TestSettings1.testsettings + 12 """; @@ -1011,7 +977,7 @@ public void PopulateSettingsShouldInitializeSettingsFromMSTestV2Section() adapterSettings.MapInconclusiveToFailed.Should().BeTrue(); adapterSettings.MapNotRunnableToFailed.Should().BeTrue(); - adapterSettings.TestSettingsFile.Should().NotBeNullOrEmpty(); + adapterSettings.TestTimeout.Should().Be(12); } public void PopulateSettingsShouldInitializeSettingsFromMSTestV2OverMSTestV1Section() @@ -1025,7 +991,7 @@ public void PopulateSettingsShouldInitializeSettingsFromMSTestV2OverMSTestV1Sect False - DummyPath\\TestSettings1.testsettings + 12 """; @@ -1041,66 +1007,7 @@ public void PopulateSettingsShouldInitializeSettingsFromMSTestV2OverMSTestV1Sect adapterSettings.MapInconclusiveToFailed.Should().BeTrue(); adapterSettings.MapNotRunnableToFailed.Should().BeTrue(); adapterSettings.CaptureDebugTraces.Should().BeTrue(); - adapterSettings.TestSettingsFile.Should().BeNullOrEmpty(); - } - - #endregion - - #region IsLegacyScenario tests - - public void IsLegacyScenarioReturnsFalseWhenDiscoveryContextIsNull() - { - MSTestSettings.PopulateSettings(null, _mockMessageLogger.Object, null); - MSTestSettings.IsLegacyScenario(null!).Should().BeFalse(); - } - - public void IsLegacyScenarioReturnsFalseWhenTestSettingsFileIsNotGiven() - { - string runSettingsXml = - """ - - - - - """; - - _mockDiscoveryContext.Setup(dc => dc.RunSettings).Returns(_mockRunSettings.Object); - _mockRunSettings.Setup(rs => rs.SettingsXml).Returns(runSettingsXml); - MSTestSettings.PopulateSettings(_mockDiscoveryContext.Object, _mockMessageLogger.Object, null); - MSTestSettings.IsLegacyScenario(_mockMessageLogger.Object).Should().BeFalse(); - } - - public void IsLegacyScenarioReturnsTrueWhenTestSettingsFileIsGiven() - { - string runSettingsXml = - """ - - - DummyPath\\TestSettings1.testsettings - - - """; - _mockDiscoveryContext.Setup(dc => dc.RunSettings).Returns(_mockRunSettings.Object); - _mockRunSettings.Setup(rs => rs.SettingsXml).Returns(runSettingsXml); - MSTestSettings.PopulateSettings(_mockDiscoveryContext.Object, _mockMessageLogger.Object, null); - MSTestSettings.IsLegacyScenario(_mockMessageLogger.Object).Should().BeTrue(); - } - - public void LegacyScenariosNotSupportedWarningIsPrintedWhenVsmdiFileIsGiven() - { - string runSettingsXml = - """ - - - DummyPath\\vsmdiFile.vsmdi - - - """; - _mockDiscoveryContext.Setup(dc => dc.RunSettings).Returns(_mockRunSettings.Object); - _mockRunSettings.Setup(rs => rs.SettingsXml).Returns(runSettingsXml); - MSTestSettings.PopulateSettings(_mockDiscoveryContext.Object, _mockMessageLogger.Object, null); - MSTestSettings.IsLegacyScenario(_mockMessageLogger.Object).Should().BeTrue(); - _mockMessageLogger.Verify(logger => logger.SendMessage(TestMessageLevel.Warning, Resource.LegacyScenariosNotSupportedWarning), Times.Once); + adapterSettings.TestTimeout.Should().Be(0); } #endregion diff --git a/test/UnitTests/MSTestAdapter.PlatformServices.UnitTests/RunConfigurationSettingsTests.cs b/test/UnitTests/MSTestAdapter.PlatformServices.UnitTests/RunConfigurationSettingsTests.cs index 96ad8939f5..4820b9c62f 100644 --- a/test/UnitTests/MSTestAdapter.PlatformServices.UnitTests/RunConfigurationSettingsTests.cs +++ b/test/UnitTests/MSTestAdapter.PlatformServices.UnitTests/RunConfigurationSettingsTests.cs @@ -89,7 +89,7 @@ public void PopulateSettingsShouldInitializeSettingsToDefaultIfNotSpecified() """ - DummyPath\\TestSettings1.testsettings + 12 """; diff --git a/test/UnitTests/MSTestAdapter.UnitTests/MSTestDiscovererTests.cs b/test/UnitTests/MSTestAdapter.UnitTests/MSTestDiscovererTests.cs index ff1c32bd94..6721312648 100644 --- a/test/UnitTests/MSTestAdapter.UnitTests/MSTestDiscovererTests.cs +++ b/test/UnitTests/MSTestAdapter.UnitTests/MSTestDiscovererTests.cs @@ -158,28 +158,6 @@ public void DiscoverTestsShouldDiscoverTests() private static string GetCurrentAssembly() => Assembly.GetExecutingAssembly().Location.Replace(".exe", ".dll"); - public void DiscoveryShouldNotHappenIfTestSettingsIsGiven() - { - string runSettingsXml = - """ - - - DummyPath\\TestSettings1.testsettings - true - - - """; - _mockDiscoveryContext.Setup(dc => dc.RunSettings).Returns(_mockRunSettings.Object); - _mockRunSettings.Setup(rs => rs.SettingsXml).Returns(runSettingsXml); - _mockTestSourceHandler.SetupGet(ts => ts.ValidSourceExtensions).Returns(new List { ".dll" }); - - string source = GetCurrentAssembly(); - _discoverer.DiscoverTests(new List { source }, _mockDiscoveryContext.Object, _mockMessageLogger.Object, _mockTestCaseDiscoverySink.Object); - - // Assert. - _mockTestCaseDiscoverySink.Verify(ds => ds.SendTestCase(It.IsAny()), Times.Never); - } - public void DiscoveryShouldReportAndBailOutOnSettingsException() { string runSettingsXml = diff --git a/test/UnitTests/MSTestAdapter.UnitTests/MSTestExecutorTests.cs b/test/UnitTests/MSTestAdapter.UnitTests/MSTestExecutorTests.cs index 4ae976f894..6d3b772d43 100644 --- a/test/UnitTests/MSTestAdapter.UnitTests/MSTestExecutorTests.cs +++ b/test/UnitTests/MSTestAdapter.UnitTests/MSTestExecutorTests.cs @@ -38,27 +38,6 @@ public void MSTestExecutorShouldProvideTestExecutionUri() extensionUriString.ExtensionUri.Should().Be(EngineConstants.ExecutorUriString); } - public async Task RunTestsShouldNotExecuteTestsIfTestSettingsIsGiven() - { - var testCase = new TestCase("DummyName", new Uri("executor://MSTestAdapter/v4"), Assembly.GetExecutingAssembly().Location); - TestCase[] tests = [testCase]; - string runSettingsXml = - """ - - - DummyPath\\TestSettings1.testsettings - true - - - """; - _mockRunContext.Setup(dc => dc.RunSettings).Returns(_mockRunSettings.Object); - _mockRunSettings.Setup(rs => rs.SettingsXml).Returns(runSettingsXml); - await _mstestExecutor.RunTestsAsync(tests, _mockRunContext.Object, _mockFrameworkHandle.Object, null); - - // Test should not start if TestSettings is given. - _mockFrameworkHandle.Verify(fh => fh.RecordStart(tests[0]), Times.Never); - } - public async Task RunTestsShouldReportErrorAndBailOutOnSettingsException() { var testCase = new TestCase("DummyName", new Uri("executor://MSTestAdapter/v4"), Assembly.GetExecutingAssembly().Location); @@ -84,26 +63,6 @@ public async Task RunTestsShouldReportErrorAndBailOutOnSettingsException() _mockFrameworkHandle.Verify(fh => fh.SendMessage(TestPlatform.ObjectModel.Logging.TestMessageLevel.Error, "Invalid value 'Pond' specified for 'Scope'. Supported scopes are ClassLevel, MethodLevel."), Times.Once); } - public async Task RunTestsWithSourcesShouldNotExecuteTestsIfTestSettingsIsGiven() - { - var sources = new List { Assembly.GetExecutingAssembly().Location }; - string runSettingsXml = - """ - - - DummyPath\\TestSettings1.testsettings - true - - - """; - _mockRunContext.Setup(dc => dc.RunSettings).Returns(_mockRunSettings.Object); - _mockRunSettings.Setup(rs => rs.SettingsXml).Returns(runSettingsXml); - await _mstestExecutor.RunTestsAsync(sources, _mockRunContext.Object, _mockFrameworkHandle.Object, null, isMTP: false); - - // Test should not start if TestSettings is given. - _mockFrameworkHandle.Verify(fh => fh.RecordStart(It.IsAny()), Times.Never); - } - public async Task RunTestsWithSourcesShouldReportErrorAndBailOutOnSettingsException() { var sources = new List { Assembly.GetExecutingAssembly().Location };