From 3af6c5ede50cec5931b5e33af2e61872bcb3db9a Mon Sep 17 00:00:00 2001 From: Copilot <223556219+Copilot@users.noreply.github.com> Date: Fri, 19 Jun 2026 12:19:35 +0200 Subject: [PATCH 1/4] Make TestRunSummaryHelper shareable: move its strings into TerminalResources Toward sharing the terminal reporter source with dotnet/sdk: TestRunSummaryHelper (used by both the reporter and SimplifiedConsoleOutputDeviceBase) referenced PlatformResources, which blocked the reporter from compiling standalone. Switch it to the dedicated TerminalResources and add the 4 verdict strings (Failed, Passed, ZeroTestsRan, MinimumExpectedTestsPolicyViolation) that #9188 had moved out of the terminal folder. 44 keys total. Verified: MTP builds clean (net9.0); full unit suite 1196 passed / 0 failed. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../Terminal/TerminalResources.cs | 69 ++++++++++--------- .../Terminal/TerminalResources.resx | 13 ++++ .../Terminal/xlf/TerminalResources.cs.xlf | 20 ++++++ .../Terminal/xlf/TerminalResources.de.xlf | 20 ++++++ .../Terminal/xlf/TerminalResources.es.xlf | 20 ++++++ .../Terminal/xlf/TerminalResources.fr.xlf | 20 ++++++ .../Terminal/xlf/TerminalResources.it.xlf | 20 ++++++ .../Terminal/xlf/TerminalResources.ja.xlf | 20 ++++++ .../Terminal/xlf/TerminalResources.ko.xlf | 20 ++++++ .../Terminal/xlf/TerminalResources.pl.xlf | 20 ++++++ .../Terminal/xlf/TerminalResources.pt-BR.xlf | 20 ++++++ .../Terminal/xlf/TerminalResources.ru.xlf | 20 ++++++ .../Terminal/xlf/TerminalResources.tr.xlf | 20 ++++++ .../xlf/TerminalResources.zh-Hans.xlf | 20 ++++++ .../xlf/TerminalResources.zh-Hant.xlf | 20 ++++++ .../OutputDevice/TestRunSummaryHelper.cs | 22 +++--- 16 files changed, 321 insertions(+), 43 deletions(-) diff --git a/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/TerminalResources.cs b/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/TerminalResources.cs index 80ca42eec7..e3fc923e8a 100644 --- a/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/TerminalResources.cs +++ b/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/TerminalResources.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. #if !IS_CORE_MTP @@ -15,11 +15,8 @@ namespace Microsoft.Testing.Platform.OutputDevice.Terminal; -// Strongly-typed accessor for TerminalResources.resx. In core MTP the accessor is generated by Arcade -// (GenerateSource). We add this [Embedded] partial so the type is embedded per-assembly when the terminal -// reporter source is shared with external consumers (e.g. dotnet/sdk's 'dotnet test'). When linked into an -// assembly that does NOT compile the resx (e.g. the unit-test project), the !IS_CORE_MTP block provides a -// ResourceManager pointing at the core MTP assembly, mirroring the PlatformResources pattern. +// Strongly-typed accessor for TerminalResources.resx; [Embedded] so it is per-assembly when shared. The +// !IS_CORE_MTP branch points the ResourceManager at the core MTP assembly for in-repo linked consumers. [Embedded] internal static partial class TerminalResources { @@ -32,83 +29,91 @@ internal static partial class TerminalResources internal static string @Aborted => GetResourceString("Aborted"); + internal static string @ActiveTestsRunning_FullTestsCount => GetResourceString("ActiveTestsRunning_FullTestsCount"); + + internal static string @ActiveTestsRunning_MoreTestsCount => GetResourceString("ActiveTestsRunning_MoreTestsCount"); + internal static string @Actual => GetResourceString("Actual"); internal static string @CancelledLowercase => GetResourceString("CancelledLowercase"); internal static string @CancellingTestSession => GetResourceString("CancellingTestSession"); - internal static string @PressCtrlCAgainToForceExit => GetResourceString("PressCtrlCAgainToForceExit"); + internal static string @ConsoleIsAlreadyInBatchingMode => GetResourceString("ConsoleIsAlreadyInBatchingMode"); + + internal static string @DurationLowercase => GetResourceString("DurationLowercase"); internal static string @Expected => GetResourceString("Expected"); + internal static string @Failed => GetResourceString("Failed"); + internal static string @FailedLowercase => GetResourceString("FailedLowercase"); internal static string @ForTest => GetResourceString("ForTest"); internal static string @InProcessArtifactsProduced => GetResourceString("InProcessArtifactsProduced"); - internal static string @OutOfProcessArtifactsProduced => GetResourceString("OutOfProcessArtifactsProduced"); + internal static string @MinimumExpectedTestsPolicyViolation => GetResourceString("MinimumExpectedTestsPolicyViolation"); - internal static string @PassedLowercase => GetResourceString("PassedLowercase"); - - internal static string @SkippedLowercase => GetResourceString("SkippedLowercase"); + internal static string @OutOfProcessArtifactsProduced => GetResourceString("OutOfProcessArtifactsProduced"); - internal static string @TotalLowercase => GetResourceString("TotalLowercase"); + internal static string @Passed => GetResourceString("Passed"); - internal static string @ConsoleIsAlreadyInBatchingMode => GetResourceString("ConsoleIsAlreadyInBatchingMode"); + internal static string @PassedLowercase => GetResourceString("PassedLowercase"); - internal static string @DurationLowercase => GetResourceString("DurationLowercase"); + internal static string @PressCtrlCAgainToForceExit => GetResourceString("PressCtrlCAgainToForceExit"); - internal static string @TestRunSummary => GetResourceString("TestRunSummary"); + internal static string @SkippedLowercase => GetResourceString("SkippedLowercase"); internal static string @StackFrameAt => GetResourceString("StackFrameAt"); internal static string @StackFrameIn => GetResourceString("StackFrameIn"); - internal static string @TerminalNoAnsiOptionDescription => GetResourceString("TerminalNoAnsiOptionDescription"); + internal static string @StandardError => GetResourceString("StandardError"); + + internal static string @StandardOutput => GetResourceString("StandardOutput"); + + internal static string @SucceededLowercase => GetResourceString("SucceededLowercase"); internal static string @TerminalAnsiOptionDescription => GetResourceString("TerminalAnsiOptionDescription"); internal static string @TerminalAnsiOptionInvalidArgument => GetResourceString("TerminalAnsiOptionInvalidArgument"); + internal static string @TerminalNoAnsiOptionDescription => GetResourceString("TerminalNoAnsiOptionDescription"); + internal static string @TerminalNoProgressOptionDescription => GetResourceString("TerminalNoProgressOptionDescription"); - internal static string @TerminalProgressOptionDescription => GetResourceString("TerminalProgressOptionDescription"); + internal static string @TerminalOutputOptionDescription => GetResourceString("TerminalOutputOptionDescription"); - internal static string @TerminalProgressOptionInvalidArgument => GetResourceString("TerminalProgressOptionInvalidArgument"); + internal static string @TerminalOutputOptionInvalidArgument => GetResourceString("TerminalOutputOptionInvalidArgument"); internal static string @TerminalProgressHeartbeat => GetResourceString("TerminalProgressHeartbeat"); internal static string @TerminalProgressHeartbeatActiveSuffix => GetResourceString("TerminalProgressHeartbeatActiveSuffix"); - internal static string @TerminalProgressSlowTest => GetResourceString("TerminalProgressSlowTest"); - - internal static string @TerminalTestReporterDescription => GetResourceString("TerminalTestReporterDescription"); - - internal static string @TerminalTestReporterDisplayName => GetResourceString("TerminalTestReporterDisplayName"); + internal static string @TerminalProgressOptionDescription => GetResourceString("TerminalProgressOptionDescription"); - internal static string @TerminalOutputOptionDescription => GetResourceString("TerminalOutputOptionDescription"); + internal static string @TerminalProgressOptionInvalidArgument => GetResourceString("TerminalProgressOptionInvalidArgument"); - internal static string @TerminalOutputOptionInvalidArgument => GetResourceString("TerminalOutputOptionInvalidArgument"); + internal static string @TerminalProgressSlowTest => GetResourceString("TerminalProgressSlowTest"); - internal static string @TerminalShowStdoutOptionDescription => GetResourceString("TerminalShowStdoutOptionDescription"); + internal static string @TerminalShowOutputOptionInvalidArgument => GetResourceString("TerminalShowOutputOptionInvalidArgument"); internal static string @TerminalShowStderrOptionDescription => GetResourceString("TerminalShowStderrOptionDescription"); - internal static string @TerminalShowOutputOptionInvalidArgument => GetResourceString("TerminalShowOutputOptionInvalidArgument"); + internal static string @TerminalShowStdoutOptionDescription => GetResourceString("TerminalShowStdoutOptionDescription"); - internal static string @StandardError => GetResourceString("StandardError"); + internal static string @TerminalTestReporterDescription => GetResourceString("TerminalTestReporterDescription"); - internal static string @StandardOutput => GetResourceString("StandardOutput"); + internal static string @TerminalTestReporterDisplayName => GetResourceString("TerminalTestReporterDisplayName"); internal static string @TestDiscoverySummarySingular => GetResourceString("TestDiscoverySummarySingular"); - internal static string @ActiveTestsRunning_MoreTestsCount => GetResourceString("ActiveTestsRunning_MoreTestsCount"); + internal static string @TestRunSummary => GetResourceString("TestRunSummary"); - internal static string @ActiveTestsRunning_FullTestsCount => GetResourceString("ActiveTestsRunning_FullTestsCount"); + internal static string @TotalLowercase => GetResourceString("TotalLowercase"); - internal static string @SucceededLowercase => GetResourceString("SucceededLowercase"); + internal static string @ZeroTestsRan => GetResourceString("ZeroTestsRan"); #endif } diff --git a/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/TerminalResources.resx b/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/TerminalResources.resx index e917c2d321..f9a29f9686 100644 --- a/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/TerminalResources.resx +++ b/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/TerminalResources.resx @@ -136,6 +136,9 @@ Expected + + Failed + failed @@ -146,9 +149,16 @@ In process file artifacts produced: + + Minimum expected tests policy violation, tests ran {0}, minimum expected {1} + {0} is the number of tests that ran. {1} is the minimum expected number of tests. + Out of process file artifacts produced: + + Passed + passed @@ -158,6 +168,9 @@ total + + Zero tests ran + Console is already in batching mode. Exception that is thrown when console is already collecting input into a batch (into a string builder), and code asks to enable batching mode again. diff --git a/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/xlf/TerminalResources.cs.xlf b/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/xlf/TerminalResources.cs.xlf index 71476aebb8..74fb91043d 100644 --- a/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/xlf/TerminalResources.cs.xlf +++ b/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/xlf/TerminalResources.cs.xlf @@ -37,6 +37,11 @@ Očekáváno + + Failed + Neúspěšné + + failed selhalo @@ -52,6 +57,11 @@ Vytvořené artefakty souboru v procesu: + + Minimum expected tests policy violation, tests ran {0}, minimum expected {1} + Minimální očekávané porušení zásad testů, spuštěné testy: {0}, očekávané minimum: {1} + {0} is the number of tests that ran. {1} is the minimum expected number of tests. + and {0} more a ještě {0} @@ -67,6 +77,11 @@ Vytvořené artefakty souboru mimo proces: + + Passed + Úspěšné + + passed úspěch @@ -215,6 +230,11 @@ Platné hodnoty jsou All, Failed, None. Výchozí hodnota je All (nebo Failed, k Souhrn testovacího běhu: + + Zero tests ran + Spustila se nula testů + + total celkem diff --git a/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/xlf/TerminalResources.de.xlf b/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/xlf/TerminalResources.de.xlf index d0974c4a92..7862af3829 100644 --- a/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/xlf/TerminalResources.de.xlf +++ b/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/xlf/TerminalResources.de.xlf @@ -37,6 +37,11 @@ Erwartet + + Failed + Fehler + + failed fehlerhaft @@ -52,6 +57,11 @@ In Bearbeitung Dateiartefakte erstellt: + + Minimum expected tests policy violation, tests ran {0}, minimum expected {1} + Mindestens erwartete Testrichtlinienverletzung, {0} Tests wurden ausgeführt, mindestens erwartet: {1} + {0} is the number of tests that ran. {1} is the minimum expected number of tests. + and {0} more und {0} weitere @@ -67,6 +77,11 @@ Nicht verarbeitete Dateiartefakte erstellt: + + Passed + Bestanden + + passed erfolgreich @@ -215,6 +230,11 @@ Gültige Werte sind „All“, „Failed“ und „None“. Der Standardwert ist Testlaufzusammenfassung: + + Zero tests ran + Es wurden keine Tests ausgeführt. + + total gesamt diff --git a/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/xlf/TerminalResources.es.xlf b/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/xlf/TerminalResources.es.xlf index 67a0ff5f7d..1abcbd5148 100644 --- a/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/xlf/TerminalResources.es.xlf +++ b/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/xlf/TerminalResources.es.xlf @@ -37,6 +37,11 @@ Se esperaba + + Failed + Error + + failed con errores @@ -52,6 +57,11 @@ Artefactos de archivo en proceso producidos: + + Minimum expected tests policy violation, tests ran {0}, minimum expected {1} + Infracción de directiva de pruebas mínimas esperadas, pruebas ejecutadas {0}, mínimas esperadas {1} + {0} is the number of tests that ran. {1} is the minimum expected number of tests. + and {0} more y {0} más @@ -67,6 +77,11 @@ Artefactos de archivo fuera de proceso producidos: + + Passed + Correcta + + passed correcto @@ -215,6 +230,11 @@ Los valores válidos son "All", "Failed", "None". El valor predeterminado es "Al Resumen de la serie de pruebas: + + Zero tests ran + No se ejecutaron pruebas + + total total diff --git a/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/xlf/TerminalResources.fr.xlf b/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/xlf/TerminalResources.fr.xlf index 75a6f42bf3..ed9ad88b58 100644 --- a/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/xlf/TerminalResources.fr.xlf +++ b/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/xlf/TerminalResources.fr.xlf @@ -37,6 +37,11 @@ Attendu + + Failed + Échec + + failed échec @@ -52,6 +57,11 @@ Artéfacts produits dans les dossiers en cours de traitement : + + Minimum expected tests policy violation, tests ran {0}, minimum expected {1} + Violation de stratégie de tests minimale attendue, tests exécutés {0}, minimum attendu {1} + {0} is the number of tests that ran. {1} is the minimum expected number of tests. + and {0} more et {0} de plus @@ -67,6 +77,11 @@ Artefacts de fichier hors processus produits : + + Passed + Réussite + + passed réussite @@ -215,6 +230,11 @@ Les valeurs valides sont « All », « Failed » et « None ». La valeur Résumé de série de tests : + + Zero tests ran + Zéro tests exécutés + + total total diff --git a/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/xlf/TerminalResources.it.xlf b/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/xlf/TerminalResources.it.xlf index 870691db61..4a27db74b8 100644 --- a/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/xlf/TerminalResources.it.xlf +++ b/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/xlf/TerminalResources.it.xlf @@ -37,6 +37,11 @@ Previsto + + Failed + Errore + + failed operazione non riuscita @@ -52,6 +57,11 @@ Artefatti file in fase di elaborazione prodotti: + + Minimum expected tests policy violation, tests ran {0}, minimum expected {1} + Violazione minima dei criteri di test previsti, test eseguiti {0}, minimo previsto {1} + {0} is the number of tests that ran. {1} is the minimum expected number of tests. + and {0} more e altri {0} @@ -67,6 +77,11 @@ Artefatti file non in elaborazione prodotti: + + Passed + Superato + + passed superato @@ -215,6 +230,11 @@ I valori validi sono 'All', 'Failed', 'None'. L'impostazione predefinita è 'All Riepilogo esecuzione test: + + Zero tests ran + Nessun test eseguito + + total totali diff --git a/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/xlf/TerminalResources.ja.xlf b/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/xlf/TerminalResources.ja.xlf index 57b9cb667a..c51b657a25 100644 --- a/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/xlf/TerminalResources.ja.xlf +++ b/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/xlf/TerminalResources.ja.xlf @@ -37,6 +37,11 @@ 予想 + + Failed + 失敗 + + failed 失敗 @@ -52,6 +57,11 @@ インプロセスのファイル成果物が生成されました: + + Minimum expected tests policy violation, tests ran {0}, minimum expected {1} + 予想されるテストの最小ポリシー違反、テストの実行数 {0} 件、予想される最小数 {1} 件 + {0} is the number of tests that ran. {1} is the minimum expected number of tests. + and {0} more その他 {0} 件 @@ -67,6 +77,11 @@ アウトプロセスのファイル成果物が生成されました: + + Passed + 成功 + + passed 合格しました @@ -215,6 +230,11 @@ Valid values are 'All', 'Failed', 'None'. Default is 'All' (or 'Failed' when an テストの実行の概要: + + Zero tests ran + 0 件のテストが実行されました + + total 合計 diff --git a/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/xlf/TerminalResources.ko.xlf b/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/xlf/TerminalResources.ko.xlf index 3f75bd79af..6ad5ad3691 100644 --- a/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/xlf/TerminalResources.ko.xlf +++ b/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/xlf/TerminalResources.ko.xlf @@ -37,6 +37,11 @@ 필요 + + Failed + 실패 + + failed 실패 @@ -52,6 +57,11 @@ 생성된 In process 파일 아티팩트: + + Minimum expected tests policy violation, tests ran {0}, minimum expected {1} + 예상되는 최소 테스트 정책 위반, 테스트 실행 {0}, 필요한 최소 {1} + {0} is the number of tests that ran. {1} is the minimum expected number of tests. + and {0} more 외 {0}개 @@ -67,6 +77,11 @@ 생성된 Out of process 파일 아티팩트: + + Passed + 통과 + + passed 통과 @@ -215,6 +230,11 @@ Valid values are 'All', 'Failed', 'None'. Default is 'All' (or 'Failed' when an 테스트 실행 요약: + + Zero tests ran + 테스트가 0개 실행됨 + + total 합계 diff --git a/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/xlf/TerminalResources.pl.xlf b/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/xlf/TerminalResources.pl.xlf index 89e39e7552..d43df880e8 100644 --- a/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/xlf/TerminalResources.pl.xlf +++ b/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/xlf/TerminalResources.pl.xlf @@ -37,6 +37,11 @@ Oczekiwane + + Failed + Niepowodzenie + + failed zakończone niepowodzeniem @@ -52,6 +57,11 @@ Wygenerowane artefakty pliku w trakcie procesu: + + Minimum expected tests policy violation, tests ran {0}, minimum expected {1} + Minimalne oczekiwane naruszenie zasad testów, uruchomione testy: {0}, oczekiwane minimum: {1} + {0} is the number of tests that ran. {1} is the minimum expected number of tests. + and {0} more i {0} więcej @@ -67,6 +77,11 @@ Wygenerowane artefakty pliku poza procesem: + + Passed + Powodzenie + + passed zakończone powodzeniem @@ -215,6 +230,11 @@ Prawidłowe wartości to „All”, „Failed”, „None”. Wartość domyśln Podsumowanie przebiegu testu: + + Zero tests ran + Uruchomiono zero testów + + total łącznie diff --git a/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/xlf/TerminalResources.pt-BR.xlf b/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/xlf/TerminalResources.pt-BR.xlf index 50a17cfe63..7b3cd8df4f 100644 --- a/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/xlf/TerminalResources.pt-BR.xlf +++ b/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/xlf/TerminalResources.pt-BR.xlf @@ -37,6 +37,11 @@ Esperado + + Failed + Falhou + + failed com falha @@ -52,6 +57,11 @@ Artefatos de arquivo de processo produzidos: + + Minimum expected tests policy violation, tests ran {0}, minimum expected {1} + Violação de política de testes mínimos esperados, {0} testes executados, mínimo esperado {1} + {0} is the number of tests that ran. {1} is the minimum expected number of tests. + and {0} more e mais {0} @@ -67,6 +77,11 @@ Artefatos de arquivo fora do processo produzidos: + + Passed + Aprovado + + passed aprovado @@ -215,6 +230,11 @@ Os valores válidos são 'All', 'Failed', 'None'. O padrão é 'All' (ou 'Failed Resumo da execução de teste: + + Zero tests ran + Zero testes executados + + total total diff --git a/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/xlf/TerminalResources.ru.xlf b/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/xlf/TerminalResources.ru.xlf index 537c1dd9e7..108d86c697 100644 --- a/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/xlf/TerminalResources.ru.xlf +++ b/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/xlf/TerminalResources.ru.xlf @@ -37,6 +37,11 @@ Ожидалось + + Failed + Сбой + + failed сбой @@ -52,6 +57,11 @@ Созданные в процессе артефакты файлов: + + Minimum expected tests policy violation, tests ran {0}, minimum expected {1} + Нарушение политики минимального ожидаемого числа тестов, тесты выполнено: {0}, ожидаемый минимум: {1} + {0} is the number of tests that ran. {1} is the minimum expected number of tests. + and {0} more и еще {0} @@ -67,6 +77,11 @@ Созданные вне процесса артефакты файлов: + + Passed + Пройден + + passed пройдено @@ -215,6 +230,11 @@ Valid values are 'All', 'Failed', 'None'. Default is 'All' (or 'Failed' when an Сводка тестового запуска: + + Zero tests ran + Запущено ноль тестов + + total всего diff --git a/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/xlf/TerminalResources.tr.xlf b/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/xlf/TerminalResources.tr.xlf index ecf9265e56..e507532f0d 100644 --- a/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/xlf/TerminalResources.tr.xlf +++ b/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/xlf/TerminalResources.tr.xlf @@ -37,6 +37,11 @@ Beklenen + + Failed + Başarısız + + failed başarısız @@ -52,6 +57,11 @@ Üretilen işlem içi dosya yapıtları: + + Minimum expected tests policy violation, tests ran {0}, minimum expected {1} + Beklenen minimum test ilke ihlali, yürütülen test: {0}, beklenen minimum test: {1} + {0} is the number of tests that ran. {1} is the minimum expected number of tests. + and {0} more ve {0} tane daha @@ -67,6 +77,11 @@ Üretilen işlem dışı dosya yapıtları: + + Passed + Başarılı + + passed başarılı @@ -215,6 +230,11 @@ Geçerli değerler: 'All', 'Failed', 'None'. Varsayılan değer 'All' (veya bir Test çalıştırması özeti: + + Zero tests ran + Sıfır test çalıştırıldı + + total toplam diff --git a/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/xlf/TerminalResources.zh-Hans.xlf b/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/xlf/TerminalResources.zh-Hans.xlf index 6c94f4aec6..d5c4f06e62 100644 --- a/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/xlf/TerminalResources.zh-Hans.xlf +++ b/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/xlf/TerminalResources.zh-Hans.xlf @@ -37,6 +37,11 @@ 预期 + + Failed + 失败 + + failed 失败 @@ -52,6 +57,11 @@ 生成的进程内文件项目: + + Minimum expected tests policy violation, tests ran {0}, minimum expected {1} + 最低预期测试策略冲突,测试已运行 {0} 次,最低预期 {1} 次 + {0} is the number of tests that ran. {1} is the minimum expected number of tests. + and {0} more 和其他 {0} 项 @@ -67,6 +77,11 @@ 生成的进程外文件项目: + + Passed + 已通过 + + passed 已通过 @@ -215,6 +230,11 @@ Valid values are 'All', 'Failed', 'None'. Default is 'All' (or 'Failed' when an 测试运行摘要: + + Zero tests ran + 运行了零个测试 + + total 总计 diff --git a/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/xlf/TerminalResources.zh-Hant.xlf b/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/xlf/TerminalResources.zh-Hant.xlf index dcfe375665..929728208a 100644 --- a/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/xlf/TerminalResources.zh-Hant.xlf +++ b/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/xlf/TerminalResources.zh-Hant.xlf @@ -37,6 +37,11 @@ 預期 + + Failed + 失敗 + + failed 已失敗 @@ -52,6 +57,11 @@ 產生的流程内檔案成品: + + Minimum expected tests policy violation, tests ran {0}, minimum expected {1} + 預期測試原則違反的最小值,{0} 個執行的測試,預期的最小值為 {1} + {0} is the number of tests that ran. {1} is the minimum expected number of tests. + and {0} more 和其他 {0} 個 @@ -67,6 +77,11 @@ 產生的流程外檔案成品: + + Passed + 成功 + + passed 已通過 @@ -215,6 +230,11 @@ Valid values are 'All', 'Failed', 'None'. Default is 'All' (or 'Failed' when an 測試回合摘要: + + Zero tests ran + 已執行零項測試 + + total 總計 diff --git a/src/Platform/Microsoft.Testing.Platform/OutputDevice/TestRunSummaryHelper.cs b/src/Platform/Microsoft.Testing.Platform/OutputDevice/TestRunSummaryHelper.cs index e580d82320..0b6a29c1ec 100644 --- a/src/Platform/Microsoft.Testing.Platform/OutputDevice/TestRunSummaryHelper.cs +++ b/src/Platform/Microsoft.Testing.Platform/OutputDevice/TestRunSummaryHelper.cs @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -using Microsoft.Testing.Platform.Resources; +using Microsoft.Testing.Platform.OutputDevice.Terminal; namespace Microsoft.Testing.Platform.OutputDevice; @@ -30,11 +30,11 @@ internal static bool IsRunFailed(int totalTests, int failedTests, int skippedTes internal static string GetVerdictText(int totalTests, int failedTests, int skippedTests, bool wasCancelled, int minimumExpectedTests) => true switch { - _ when wasCancelled => PlatformResources.Aborted, - _ when totalTests < minimumExpectedTests => string.Format(CultureInfo.CurrentCulture, PlatformResources.MinimumExpectedTestsPolicyViolation, totalTests, minimumExpectedTests), - _ when totalTests == 0 || totalTests == skippedTests => PlatformResources.ZeroTestsRan, - _ when failedTests > 0 => $"{PlatformResources.Failed}!", - _ => $"{PlatformResources.Passed}!", + _ when wasCancelled => TerminalResources.Aborted, + _ when totalTests < minimumExpectedTests => string.Format(CultureInfo.CurrentCulture, TerminalResources.MinimumExpectedTestsPolicyViolation, totalTests, minimumExpectedTests), + _ when totalTests == 0 || totalTests == skippedTests => TerminalResources.ZeroTestsRan, + _ when failedTests > 0 => $"{TerminalResources.Failed}!", + _ => $"{TerminalResources.Passed}!", }; /// @@ -47,11 +47,11 @@ internal static string FormatSummaryText(int totalTests, int failedTests, int pa string verdict = GetVerdictText(totalTests, failedTests, skippedTests, wasCancelled, minimumExpectedTests); return $""" - {PlatformResources.TestRunSummary} {verdict} - {PlatformResources.TotalLowercase}: {totalTests} - {PlatformResources.FailedLowercase}: {failedTests} - {PlatformResources.SucceededLowercase}: {passedTests} - {PlatformResources.SkippedLowercase}: {skippedTests} + {TerminalResources.TestRunSummary} {verdict} + {TerminalResources.TotalLowercase}: {totalTests} + {TerminalResources.FailedLowercase}: {failedTests} + {TerminalResources.SucceededLowercase}: {passedTests} + {TerminalResources.SkippedLowercase}: {skippedTests} """; } } From c186e7cc4d8dbca94d3ed00f8569bb567337932f Mon Sep 17 00:00:00 2001 From: Copilot <223556219+Copilot@users.noreply.github.com> Date: Fri, 19 Jun 2026 13:04:00 +0200 Subject: [PATCH 2/4] Decouple ApplicationStateGuard from PlatformResources (option a) ApplicationStateGuard is a foundational, platform-wide helper that the terminal reporter depends on. Its Ensure()/Unreachable() used two localized PlatformResources strings, which was the last thing preventing the terminal reporter source from compiling standalone (no Microsoft.Testing.Platform reference). These are internal invariant-violation diagnostics for 'impossible' states, never expected to surface to end users (cf. System.Diagnostics.UnreachableException), so we inline them as constants and drop their localization. Removed the now-dead UnexpectedStateErrorMessage / UnreachableLocationErrorMessage from PlatformResources .resx + accessor and regenerated the xlf via UpdateXlf. With this, the terminal reporter source closure compiles fully standalone (verified via a throwaway consumer with no MTP reference). Platform builds clean (net8.0/net9.0/netstandard2.0); full unit suite 1196 passed / 0 failed. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../Helpers/ApplicationStateGuard.cs | 11 ++++++++--- .../Resources/PlatformResources.cs | 4 ---- .../Resources/PlatformResources.resx | 8 -------- .../Resources/xlf/PlatformResources.cs.xlf | 10 ---------- .../Resources/xlf/PlatformResources.de.xlf | 10 ---------- .../Resources/xlf/PlatformResources.es.xlf | 10 ---------- .../Resources/xlf/PlatformResources.fr.xlf | 10 ---------- .../Resources/xlf/PlatformResources.it.xlf | 10 ---------- .../Resources/xlf/PlatformResources.ja.xlf | 10 ---------- .../Resources/xlf/PlatformResources.ko.xlf | 10 ---------- .../Resources/xlf/PlatformResources.pl.xlf | 10 ---------- .../Resources/xlf/PlatformResources.pt-BR.xlf | 10 ---------- .../Resources/xlf/PlatformResources.ru.xlf | 10 ---------- .../Resources/xlf/PlatformResources.tr.xlf | 10 ---------- .../Resources/xlf/PlatformResources.zh-Hans.xlf | 10 ---------- .../Resources/xlf/PlatformResources.zh-Hant.xlf | 10 ---------- 16 files changed, 8 insertions(+), 145 deletions(-) diff --git a/src/Platform/Microsoft.Testing.Platform/Helpers/ApplicationStateGuard.cs b/src/Platform/Microsoft.Testing.Platform/Helpers/ApplicationStateGuard.cs index e5c29e26d6..66d765cf20 100644 --- a/src/Platform/Microsoft.Testing.Platform/Helpers/ApplicationStateGuard.cs +++ b/src/Platform/Microsoft.Testing.Platform/Helpers/ApplicationStateGuard.cs @@ -2,13 +2,18 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. using Microsoft.CodeAnalysis; -using Microsoft.Testing.Platform.Resources; namespace Microsoft.Testing.Platform.Helpers; [Embedded] internal static class ApplicationStateGuard { + // These are internal invariant-violation diagnostics for "impossible" states; they are intentionally NOT + // localized (matching e.g. System.Diagnostics.UnreachableException) so that this foundational helper has no + // dependency on PlatformResources and can be shared as source (e.g. with dotnet/sdk's terminal reporter). + private const string UnexpectedStateErrorMessage = "Unexpected state in file '{0}' at line '{1}'"; + private const string UnreachableLocationErrorMessage = "This program location is thought to be unreachable. File='{0}' Line={1}"; + public static void Ensure([DoesNotReturnIf(false)] bool condition, string errorMessage) { if (!condition) @@ -23,7 +28,7 @@ public static void Ensure([DoesNotReturnIf(false)] bool condition, [CallerFilePa { throw new InvalidOperationException(string.Format( CultureInfo.InvariantCulture, - PlatformResources.UnexpectedStateErrorMessage, + UnexpectedStateErrorMessage, path, line)); } } @@ -31,6 +36,6 @@ public static void Ensure([DoesNotReturnIf(false)] bool condition, [CallerFilePa public static InvalidOperationException Unreachable([CallerFilePath] string? path = null, [CallerLineNumber] int line = 0) => new(string.Format( CultureInfo.InvariantCulture, - PlatformResources.UnreachableLocationErrorMessage, + UnreachableLocationErrorMessage, path, line)); } diff --git a/src/Platform/Microsoft.Testing.Platform/Resources/PlatformResources.cs b/src/Platform/Microsoft.Testing.Platform/Resources/PlatformResources.cs index 9a558bf456..5357fec186 100644 --- a/src/Platform/Microsoft.Testing.Platform/Resources/PlatformResources.cs +++ b/src/Platform/Microsoft.Testing.Platform/Resources/PlatformResources.cs @@ -30,10 +30,6 @@ internal static partial class PlatformResources [MethodImpl(MethodImplOptions.AggressiveInlining)] internal static string GetResourceString(string resourceKey) => ResourceManager.GetString(resourceKey, null)!; - internal static string @UnexpectedStateErrorMessage => GetResourceString("UnexpectedStateErrorMessage"); - - internal static string @UnreachableLocationErrorMessage => GetResourceString("UnreachableLocationErrorMessage"); - internal static string @InternalLoopAsyncDidNotExitSuccessfullyErrorMessage => GetResourceString("InternalLoopAsyncDidNotExitSuccessfullyErrorMessage"); #if IS_MTP_UNIT_TESTS diff --git a/src/Platform/Microsoft.Testing.Platform/Resources/PlatformResources.resx b/src/Platform/Microsoft.Testing.Platform/Resources/PlatformResources.resx index e759f4adaa..ac60ca5070 100644 --- a/src/Platform/Microsoft.Testing.Platform/Resources/PlatformResources.resx +++ b/src/Platform/Microsoft.Testing.Platform/Resources/PlatformResources.resx @@ -342,14 +342,6 @@ {0} {0} is the exception ToString output. {Locked="FileLogger.WriteLogToFileAsync"} - - Unexpected state in file '{0}' at line '{1}' - {0} is the source file path. {1} is the source line number. - - - This program location is thought to be unreachable. File='{0}' Line={1} - {0} is the source file path. {1} is the source line number. - Retry failed after {0} times {0} is the retry count. diff --git a/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.cs.xlf b/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.cs.xlf index f2d57113bb..91b21d9658 100644 --- a/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.cs.xlf +++ b/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.cs.xlf @@ -1133,21 +1133,11 @@ Platné hodnoty jsou All, Failed, None. Výchozí hodnota je All (nebo Failed, k {0} {0} is the exception ToString output. {Locked="FileLogger.WriteLogToFileAsync"} - - Unexpected state in file '{0}' at line '{1}' - Neočekávaný stav v souboru {0} na řádku {1} - {0} is the source file path. {1} is the source line number. - [ServerTestHost.OnTaskSchedulerUnobservedTaskException] Unhandled exception: {0} [ServerTestHost.OnTaskSchedulerUnobservedTaskException] Neošetřená výjimka: {0} {0} is the exception that was unhandled/unobserved. {Locked="ServerTestHost.OnTaskSchedulerUnobservedTaskException"} - - This program location is thought to be unreachable. File='{0}' Line={1} - Toto umístění programu se považuje za nedostupné. File={0}, Line={1} - {0} is the source file path. {1} is the source line number. - Waiting for debugger to attach (TESTINGPLATFORM_WAIT_ATTACH_DEBUGGER=1) is not supported in browser environments. Čekání na připojení ladicího programu (TESTINGPLATFORM_WAIT_ATTACH_DEBUGGER=1) se v prostředích prohlížeče nepodporuje. diff --git a/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.de.xlf b/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.de.xlf index 362910e343..3e0746dc3e 100644 --- a/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.de.xlf +++ b/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.de.xlf @@ -1133,21 +1133,11 @@ Gültige Werte sind „All“, „Failed“ und „None“. Der Standardwert ist {0} {0} is the exception ToString output. {Locked="FileLogger.WriteLogToFileAsync"} - - Unexpected state in file '{0}' at line '{1}' - Unerwarteter Status in Datei "{0}" in Zeile "{1}" - {0} is the source file path. {1} is the source line number. - [ServerTestHost.OnTaskSchedulerUnobservedTaskException] Unhandled exception: {0} [ServerTestHost.OnTaskSchedulerUnobservedTaskException] Ausnahmefehler: {0} {0} is the exception that was unhandled/unobserved. {Locked="ServerTestHost.OnTaskSchedulerUnobservedTaskException"} - - This program location is thought to be unreachable. File='{0}' Line={1} - Dieser Programmspeicherort wird als nicht erreichbar betrachtet. File='{0}' Line={1} - {0} is the source file path. {1} is the source line number. - Waiting for debugger to attach (TESTINGPLATFORM_WAIT_ATTACH_DEBUGGER=1) is not supported in browser environments. Das Warten auf das Anfügen des Debuggers (TESTINGPLATFORM_WAIT_ATTACH_DEBUGGER=1) wird in Browserumgebungen nicht unterstützt. diff --git a/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.es.xlf b/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.es.xlf index 48cb18c211..60dd4f4688 100644 --- a/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.es.xlf +++ b/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.es.xlf @@ -1133,21 +1133,11 @@ Los valores válidos son "All", "Failed", "None". El valor predeterminado es "Al {0} {0} is the exception ToString output. {Locked="FileLogger.WriteLogToFileAsync"} - - Unexpected state in file '{0}' at line '{1}' - Estado inesperado en el archivo “{0}” en la línea “{1}” - {0} is the source file path. {1} is the source line number. - [ServerTestHost.OnTaskSchedulerUnobservedTaskException] Unhandled exception: {0} [ServerTestHost.OnTaskSchedulerUnobservedTaskException] excepción no controlada: {0} {0} is the exception that was unhandled/unobserved. {Locked="ServerTestHost.OnTaskSchedulerUnobservedTaskException"} - - This program location is thought to be unreachable. File='{0}' Line={1} - Se considera que esta ubicación del programa es inaccesible. Archivo=''{0}'' Línea={1} - {0} is the source file path. {1} is the source line number. - Waiting for debugger to attach (TESTINGPLATFORM_WAIT_ATTACH_DEBUGGER=1) is not supported in browser environments. La espera para que se adjunte el depurador (TESTINGPLATFORM_WAIT_ATTACH_DEBUGGER=1) no es compatible con los entornos de explorador. diff --git a/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.fr.xlf b/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.fr.xlf index c49c40a09e..6510539a9d 100644 --- a/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.fr.xlf +++ b/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.fr.xlf @@ -1133,21 +1133,11 @@ Les valeurs valides sont « All », « Failed » et « None ». La valeur {0} {0} is the exception ToString output. {Locked="FileLogger.WriteLogToFileAsync"} - - Unexpected state in file '{0}' at line '{1}' - État inattendu dans le fichier « {0} » à la ligne « {1} » - {0} is the source file path. {1} is the source line number. - [ServerTestHost.OnTaskSchedulerUnobservedTaskException] Unhandled exception: {0} [ServerTestHost.OnTaskSchedulerUnobservedTaskException] exception non prise en charge : {0} {0} is the exception that was unhandled/unobserved. {Locked="ServerTestHost.OnTaskSchedulerUnobservedTaskException"} - - This program location is thought to be unreachable. File='{0}' Line={1} - Cet emplacement du programme est considéré comme inaccessible. File=« {0} », Ligne={1} - {0} is the source file path. {1} is the source line number. - Waiting for debugger to attach (TESTINGPLATFORM_WAIT_ATTACH_DEBUGGER=1) is not supported in browser environments. L’attente de la connexion du débogueur (TESTINGPLATFORM_WAIT_ATTACH_DEBUGGER=1) n’est pas prise en charge dans les environnements navigateur. diff --git a/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.it.xlf b/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.it.xlf index 6351dd23f3..4689cea623 100644 --- a/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.it.xlf +++ b/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.it.xlf @@ -1133,21 +1133,11 @@ I valori validi sono 'All', 'Failed', 'None'. L'impostazione predefinita è 'All {0} {0} is the exception ToString output. {Locked="FileLogger.WriteLogToFileAsync"} - - Unexpected state in file '{0}' at line '{1}' - Stato imprevisto nel file '{0}' alla riga '{1}' - {0} is the source file path. {1} is the source line number. - [ServerTestHost.OnTaskSchedulerUnobservedTaskException] Unhandled exception: {0} [ServerTestHost.OnTaskSchedulerUnobservedTaskException] eccezione non gestita: {0} {0} is the exception that was unhandled/unobserved. {Locked="ServerTestHost.OnTaskSchedulerUnobservedTaskException"} - - This program location is thought to be unreachable. File='{0}' Line={1} - La posizione del programma è ritenuta non raggiungibile. File='{0}', Riga={1} - {0} is the source file path. {1} is the source line number. - Waiting for debugger to attach (TESTINGPLATFORM_WAIT_ATTACH_DEBUGGER=1) is not supported in browser environments. L'attesa per il collegamento di (TESTINGPLATFORM_WAIT_ATTACH_DEBUGGER=1) non è supportata negli ambienti browser. diff --git a/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.ja.xlf b/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.ja.xlf index 7c7af24390..a7525a03d9 100644 --- a/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.ja.xlf +++ b/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.ja.xlf @@ -1134,21 +1134,11 @@ Valid values are 'All', 'Failed', 'None'. Default is 'All' (or 'Failed' when an {0} {0} is the exception ToString output. {Locked="FileLogger.WriteLogToFileAsync"} - - Unexpected state in file '{0}' at line '{1}' - ファイル '{0}' の行 '{1}' の予期しない状態 - {0} is the source file path. {1} is the source line number. - [ServerTestHost.OnTaskSchedulerUnobservedTaskException] Unhandled exception: {0} ハンドルされない例外 [ServerTestHost.OnTaskSchedulerUnobservedTaskException]: {0} {0} is the exception that was unhandled/unobserved. {Locked="ServerTestHost.OnTaskSchedulerUnobservedTaskException"} - - This program location is thought to be unreachable. File='{0}' Line={1} - このプログラムの場所に到達できないと考えられます。ファイル='{0}'、行={1} - {0} is the source file path. {1} is the source line number. - Waiting for debugger to attach (TESTINGPLATFORM_WAIT_ATTACH_DEBUGGER=1) is not supported in browser environments. デバッガーのアタッチの待機 (TESTINGPLATFORM_WAIT_ATTACH_DEBUGGER=1) は、ブラウザー環境ではサポートされていません。 diff --git a/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.ko.xlf b/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.ko.xlf index 4ba1e76eae..53885ac085 100644 --- a/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.ko.xlf +++ b/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.ko.xlf @@ -1133,21 +1133,11 @@ Valid values are 'All', 'Failed', 'None'. Default is 'All' (or 'Failed' when an {0} {0} is the exception ToString output. {Locked="FileLogger.WriteLogToFileAsync"} - - Unexpected state in file '{0}' at line '{1}' - '{1}' 줄의 '{0}' 파일에 예기치 않은 상태가 있습니다. - {0} is the source file path. {1} is the source line number. - [ServerTestHost.OnTaskSchedulerUnobservedTaskException] Unhandled exception: {0} 처리되지 않은 예외 [ServerTestHost.OnTaskSchedulerUnobservedTaskException]: {0} {0} is the exception that was unhandled/unobserved. {Locked="ServerTestHost.OnTaskSchedulerUnobservedTaskException"} - - This program location is thought to be unreachable. File='{0}' Line={1} - 이 프로그램 위치에 연결할 수 없는 것으로 생각됩니다. File='{0}' Line={1} - {0} is the source file path. {1} is the source line number. - Waiting for debugger to attach (TESTINGPLATFORM_WAIT_ATTACH_DEBUGGER=1) is not supported in browser environments. 디버거 연결 대기(TESTINGPLATFORM_WAIT_ATTACH_DEBUGGER=1)는 브라우저 환경에서 지원되지 않습니다. diff --git a/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.pl.xlf b/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.pl.xlf index 6f4046a478..7578d479bf 100644 --- a/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.pl.xlf +++ b/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.pl.xlf @@ -1133,21 +1133,11 @@ Prawidłowe wartości to „All”, „Failed”, „None”. Wartość domyśln {0} {0} is the exception ToString output. {Locked="FileLogger.WriteLogToFileAsync"} - - Unexpected state in file '{0}' at line '{1}' - Nieoczekiwany stan w pliku „{0}” w wierszu „{1}” - {0} is the source file path. {1} is the source line number. - [ServerTestHost.OnTaskSchedulerUnobservedTaskException] Unhandled exception: {0} [ServerTestHost.OnTaskSchedulerUnobservedTaskException] Nieobsługiwany wyjątek: {0} {0} is the exception that was unhandled/unobserved. {Locked="ServerTestHost.OnTaskSchedulerUnobservedTaskException"} - - This program location is thought to be unreachable. File='{0}' Line={1} - Ta lokalizacja programu jest uważana za nieosiągalną. Plik=„{0}”, Wiersz={1} - {0} is the source file path. {1} is the source line number. - Waiting for debugger to attach (TESTINGPLATFORM_WAIT_ATTACH_DEBUGGER=1) is not supported in browser environments. Oczekiwanie na dołączenie debugera (TESTINGPLATFORM_WAIT_ATTACH_DEBUGGER=1) nie jest obsługiwane w środowiskach przeglądarki. diff --git a/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.pt-BR.xlf b/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.pt-BR.xlf index cb0a3dbd93..560d44c4a5 100644 --- a/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.pt-BR.xlf +++ b/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.pt-BR.xlf @@ -1133,21 +1133,11 @@ Os valores válidos são 'All', 'Failed', 'None'. O padrão é 'All' (ou 'Failed {0} {0} is the exception ToString output. {Locked="FileLogger.WriteLogToFileAsync"} - - Unexpected state in file '{0}' at line '{1}' - Estado inesperado no arquivo '{0}' na linha '{1}' - {0} is the source file path. {1} is the source line number. - [ServerTestHost.OnTaskSchedulerUnobservedTaskException] Unhandled exception: {0} [ServerTestHost.OnTaskSchedulerUnobservedTaskException] exceção sem tratamento: {0} {0} is the exception that was unhandled/unobserved. {Locked="ServerTestHost.OnTaskSchedulerUnobservedTaskException"} - - This program location is thought to be unreachable. File='{0}' Line={1} - Este local do programa é considerado inacessível. Arquivo='{0}' Linha={1} - {0} is the source file path. {1} is the source line number. - Waiting for debugger to attach (TESTINGPLATFORM_WAIT_ATTACH_DEBUGGER=1) is not supported in browser environments. Não há suporte para aguardar a anexação do depurador (TESTINGPLATFORM_WAIT_ATTACH_DEBUGGER=1) em ambientes de navegador. diff --git a/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.ru.xlf b/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.ru.xlf index 971f075b17..5259d386e5 100644 --- a/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.ru.xlf +++ b/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.ru.xlf @@ -1133,21 +1133,11 @@ Valid values are 'All', 'Failed', 'None'. Default is 'All' (or 'Failed' when an {0} {0} is the exception ToString output. {Locked="FileLogger.WriteLogToFileAsync"} - - Unexpected state in file '{0}' at line '{1}' - Непредвиденное состояние в файле "{0}" в строке "{1}" - {0} is the source file path. {1} is the source line number. - [ServerTestHost.OnTaskSchedulerUnobservedTaskException] Unhandled exception: {0} [ServerTestHost.OnTaskSchedulerUnobservedTaskException] необработанное исключение: {0} {0} is the exception that was unhandled/unobserved. {Locked="ServerTestHost.OnTaskSchedulerUnobservedTaskException"} - - This program location is thought to be unreachable. File='{0}' Line={1} - Похоже, что это расположение программы является недоступным. Файл="{0}", строка={1} - {0} is the source file path. {1} is the source line number. - Waiting for debugger to attach (TESTINGPLATFORM_WAIT_ATTACH_DEBUGGER=1) is not supported in browser environments. Ожидание подключения отладчика (TESTINGPLATFORM_WAIT_ATTACH_DEBUGGER=1) не поддерживается в браузерных средах. diff --git a/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.tr.xlf b/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.tr.xlf index 7010b11d68..22ad8839cf 100644 --- a/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.tr.xlf +++ b/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.tr.xlf @@ -1133,21 +1133,11 @@ Geçerli değerler: 'All', 'Failed', 'None'. Varsayılan değer 'All' (veya bir {0} {0} is the exception ToString output. {Locked="FileLogger.WriteLogToFileAsync"} - - Unexpected state in file '{0}' at line '{1}' - '{0}' dosyasında '{1}' satırındaki durum beklenmiyordu - {0} is the source file path. {1} is the source line number. - [ServerTestHost.OnTaskSchedulerUnobservedTaskException] Unhandled exception: {0} [ServerTestHost.OnTaskSchedulerUnobservedTaskException] özel durum: {0} {0} is the exception that was unhandled/unobserved. {Locked="ServerTestHost.OnTaskSchedulerUnobservedTaskException"} - - This program location is thought to be unreachable. File='{0}' Line={1} - Bu program konumu erişilemez olarak görülüyor. Dosya='{0}', Satır={1} - {0} is the source file path. {1} is the source line number. - Waiting for debugger to attach (TESTINGPLATFORM_WAIT_ATTACH_DEBUGGER=1) is not supported in browser environments. Hata ayıklayıcısının eklenmesini bekleme (TESTINGPLATFORM_WAIT_ATTACH_DEBUGGER=1) tarayıcı ortamlarında desteklenmez. diff --git a/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.zh-Hans.xlf b/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.zh-Hans.xlf index f47b0679f9..7346a20001 100644 --- a/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.zh-Hans.xlf +++ b/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.zh-Hans.xlf @@ -1133,21 +1133,11 @@ Valid values are 'All', 'Failed', 'None'. Default is 'All' (or 'Failed' when an {0} {0} is the exception ToString output. {Locked="FileLogger.WriteLogToFileAsync"} - - Unexpected state in file '{0}' at line '{1}' - 文件“{0}”中第“{1}”行出现意外状态 - {0} is the source file path. {1} is the source line number. - [ServerTestHost.OnTaskSchedulerUnobservedTaskException] Unhandled exception: {0} [ServerTestHost.OnTaskSchedulerUnobservedTaskException] 未经处理的异常: {0} {0} is the exception that was unhandled/unobserved. {Locked="ServerTestHost.OnTaskSchedulerUnobservedTaskException"} - - This program location is thought to be unreachable. File='{0}' Line={1} - 此程序位置被视为无法访问。文件='{0}',行={1} - {0} is the source file path. {1} is the source line number. - Waiting for debugger to attach (TESTINGPLATFORM_WAIT_ATTACH_DEBUGGER=1) is not supported in browser environments. 浏览器环境不支持等待调试器附加(TESTINGPLATFORM_WAIT_ATTACH_DEBUGGER=1)。 diff --git a/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.zh-Hant.xlf b/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.zh-Hant.xlf index 32912ad50d..4ba7e39a22 100644 --- a/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.zh-Hant.xlf +++ b/src/Platform/Microsoft.Testing.Platform/Resources/xlf/PlatformResources.zh-Hant.xlf @@ -1133,21 +1133,11 @@ Valid values are 'All', 'Failed', 'None'. Default is 'All' (or 'Failed' when an {0} {0} is the exception ToString output. {Locked="FileLogger.WriteLogToFileAsync"} - - Unexpected state in file '{0}' at line '{1}' - 檔案 '{0}' 的第 '{1}' 行出現未預期的狀態 - {0} is the source file path. {1} is the source line number. - [ServerTestHost.OnTaskSchedulerUnobservedTaskException] Unhandled exception: {0} [ServerTestHost.OnTaskSchedulerUnobservedTaskException] 未處理的例外狀況: {0} {0} is the exception that was unhandled/unobserved. {Locked="ServerTestHost.OnTaskSchedulerUnobservedTaskException"} - - This program location is thought to be unreachable. File='{0}' Line={1} - 此程式位置被認為無法連線。File='{0}' Line={1} - {0} is the source file path. {1} is the source line number. - Waiting for debugger to attach (TESTINGPLATFORM_WAIT_ATTACH_DEBUGGER=1) is not supported in browser environments. 瀏覽器環境不支援等待除錯器附加 (TESTINGPLATFORM_WAIT_ATTACH_DEBUGGER=1)。 From db0439c8b2c8d7d1e07d5f9dd65523e8052de862 Mon Sep 17 00:00:00 2001 From: Copilot <223556219+Copilot@users.noreply.github.com> Date: Fri, 19 Jun 2026 13:11:50 +0200 Subject: [PATCH 3/4] Add TerminalReporterContract.props + standalone consumer test (decoupling gate) Establishes the single-source-of-truth share for the terminal reporter, mirroring the DotnetTestProtocol contract (#9218): - TerminalReporterContract.props: shared-source manifest listing the reporter + rendering + state source, the small platform abstractions it needs (IConsole/IStopwatch/IColor/ System*, RoslynString/ApplicationStateGuard/StackTraceHelper/TargetFrameworkParser/ TestRunSummaryHelper) and TerminalResources.resx. Excludes the MTP-CLI-specific TerminalTestReporterCommandLineOptionsProvider and the hand-written resx accessor. - Microsoft.Testing.Platform.TerminalReporterContract.UnitTests: an independent project that does NOT reference MTP's terminal types; it compiles the shared source into its own assembly via the .props, proving the reporter is self-contained and consumable the same way dotnet/sdk's 'dotnet test' will consume it. Verified: the consumer compiles on net8.0/net9.0 and its smoke tests pass (TerminalResources resolve from the consumer's own embedded resx; shared types usable). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- TestFx.slnx | 1 + .../Terminal/TerminalReporterContract.props | 71 +++++++++++++++++++ .../BannedSymbols.txt | 1 + ....TerminalReporterContract.UnitTests.csproj | 38 ++++++++++ .../Program.cs | 42 +++++++++++ .../TerminalReporterContractTests.cs | 39 ++++++++++ 6 files changed, 192 insertions(+) create mode 100644 src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/TerminalReporterContract.props create mode 100644 test/UnitTests/Microsoft.Testing.Platform.TerminalReporterContract.UnitTests/BannedSymbols.txt create mode 100644 test/UnitTests/Microsoft.Testing.Platform.TerminalReporterContract.UnitTests/Microsoft.Testing.Platform.TerminalReporterContract.UnitTests.csproj create mode 100644 test/UnitTests/Microsoft.Testing.Platform.TerminalReporterContract.UnitTests/Program.cs create mode 100644 test/UnitTests/Microsoft.Testing.Platform.TerminalReporterContract.UnitTests/TerminalReporterContractTests.cs diff --git a/TestFx.slnx b/TestFx.slnx index 5d7f088626..a761d01781 100644 --- a/TestFx.slnx +++ b/TestFx.slnx @@ -136,6 +136,7 @@ + diff --git a/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/TerminalReporterContract.props b/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/TerminalReporterContract.props new file mode 100644 index 0000000000..b2cb7b6e4b --- /dev/null +++ b/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/TerminalReporterContract.props @@ -0,0 +1,71 @@ + + + + + + <_TerminalContractPlatform>$(MSBuildThisFileDirectory)..\.. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/UnitTests/Microsoft.Testing.Platform.TerminalReporterContract.UnitTests/BannedSymbols.txt b/test/UnitTests/Microsoft.Testing.Platform.TerminalReporterContract.UnitTests/BannedSymbols.txt new file mode 100644 index 0000000000..ab9946cf24 --- /dev/null +++ b/test/UnitTests/Microsoft.Testing.Platform.TerminalReporterContract.UnitTests/BannedSymbols.txt @@ -0,0 +1 @@ +N:AwesomeAssertions; Use MSTest assertions instead. diff --git a/test/UnitTests/Microsoft.Testing.Platform.TerminalReporterContract.UnitTests/Microsoft.Testing.Platform.TerminalReporterContract.UnitTests.csproj b/test/UnitTests/Microsoft.Testing.Platform.TerminalReporterContract.UnitTests/Microsoft.Testing.Platform.TerminalReporterContract.UnitTests.csproj new file mode 100644 index 0000000000..7c37a1af53 --- /dev/null +++ b/test/UnitTests/Microsoft.Testing.Platform.TerminalReporterContract.UnitTests/Microsoft.Testing.Platform.TerminalReporterContract.UnitTests.csproj @@ -0,0 +1,38 @@ + + + + $(SupportedNetFrameworks) + true + Exe + + $(NoWarn);CS0436 + + + + + + + + + + + + + + + diff --git a/test/UnitTests/Microsoft.Testing.Platform.TerminalReporterContract.UnitTests/Program.cs b/test/UnitTests/Microsoft.Testing.Platform.TerminalReporterContract.UnitTests/Program.cs new file mode 100644 index 0000000000..87d438ae64 --- /dev/null +++ b/test/UnitTests/Microsoft.Testing.Platform.TerminalReporterContract.UnitTests/Program.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using Microsoft.Testing.Extensions; + +using OpenTelemetry.Metrics; +using OpenTelemetry.Trace; + +using ExecutionScope = Microsoft.VisualStudio.TestTools.UnitTesting.ExecutionScope; + +[assembly: Parallelize(Scope = ExecutionScope.MethodLevel, Workers = 0)] + +// Opt-out telemetry +Environment.SetEnvironmentVariable("DOTNET_CLI_TELEMETRY_OPTOUT", "1"); + +ITestApplicationBuilder builder = await TestApplication.CreateBuilderAsync(args); + +builder.AddMSTest(() => [Assembly.GetEntryAssembly()!]); + +#if ENABLE_CODECOVERAGE +builder.AddCodeCoverageProvider(); +#endif +builder.AddCrashDumpProvider(); + +#if !NETFRAMEWORK +if (!OperatingSystem.IsBrowser()) +#endif +{ + builder.AddHangDumpProvider(); +} + +builder.AddTrxReportProvider(); +builder.AddJUnitReportProvider(); +builder.AddAzureDevOpsProvider(); +builder.AddCtrfReportProvider(); + +builder.AddOpenTelemetryProvider( + tracing => tracing.AddTestingPlatformInstrumentation(), + metrics => metrics.AddTestingPlatformInstrumentation()); + +ITestApplication app = await builder.BuildAsync(); +return await app.RunAsync(); diff --git a/test/UnitTests/Microsoft.Testing.Platform.TerminalReporterContract.UnitTests/TerminalReporterContractTests.cs b/test/UnitTests/Microsoft.Testing.Platform.TerminalReporterContract.UnitTests/TerminalReporterContractTests.cs new file mode 100644 index 0000000000..7e5263c102 --- /dev/null +++ b/test/UnitTests/Microsoft.Testing.Platform.TerminalReporterContract.UnitTests/TerminalReporterContractTests.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using Microsoft.Testing.Platform.OutputDevice.Terminal; + +namespace Microsoft.Testing.Platform.TerminalReporterContract.UnitTests; + +/// +/// Verifies the shared terminal-reporter source, compiled into this independent assembly via +/// TerminalReporterContract.props. +/// +/// +/// This project does not reference Microsoft.Testing.Platform's terminal reporter types; it compiles the same +/// source files (reporter + rendering + state + the small platform abstractions) and the TerminalResources +/// resx into its own assembly. The fact that this assembly compiles at all is the proof that the reporter is +/// self-contained and consumable with a single source of truth (the same way dotnet/sdk's 'dotnet test' will +/// consume it), instead of being hard-forked. +/// +[TestClass] +public sealed class TerminalReporterContractTests +{ + [TestMethod] + public void TerminalResources_AreCompiledIntoThisAssembly() + { + // Resolves from TerminalResources.resx GenerateSource'd into THIS assembly, not from + // Microsoft.Testing.Platform. A missing/renamed string would fail the build, not just this test. + Assert.IsFalse(string.IsNullOrEmpty(TerminalResources.TestRunSummary)); + Assert.IsFalse(string.IsNullOrEmpty(TerminalResources.Passed)); + } + + [TestMethod] + public void SharedTerminalTypes_AreUsable() + { + Assert.IsNotEmpty(Enum.GetValues()); + + string rendered = HumanReadableDurationFormatter.Render(TimeSpan.FromSeconds(1)); + Assert.Contains("1s", rendered); + } +} From 3a5b45c62754c6792773f35eb3c0415621086461 Mon Sep 17 00:00:00 2001 From: Copilot <223556219+Copilot@users.noreply.github.com> Date: Fri, 19 Jun 2026 13:41:36 +0200 Subject: [PATCH 4/4] Address review: correct TerminalReporterContract.props doc comments - Clarify that only the reporter/rendering/state types are [Embedded]; the small platform abstractions (IConsole/IStopwatch/IColor/System*) are not, so consumers that also reference Microsoft.Testing.Platform get benign CS0436 (and should suppress it). - Drop the incorrect 'under IS_CORE_MTP' wording: the resx generates the accessor unconditionally and TerminalResources.cs (the only IS_CORE_MTP-conditional file) is excluded. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../Terminal/TerminalReporterContract.props | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/TerminalReporterContract.props b/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/TerminalReporterContract.props index b2cb7b6e4b..bd41933e6f 100644 --- a/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/TerminalReporterContract.props +++ b/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/TerminalReporterContract.props @@ -16,17 +16,25 @@ command-line specific - the SDK has its own CLI) and TerminalResources.cs (the hand-written [Embedded] accessor used by in-repo IVT-linked consumers; standalone consumers compile the resx instead - see below). - All the contract types are [Microsoft.CodeAnalysis.Embedded] so each consumer compiles them into its OWN - assembly without leaking across assembly boundaries. + The reporter + rendering + state types are [Microsoft.CodeAnalysis.Embedded], so a consumer that also + references Microsoft.Testing.Platform never sees them as conflicting types. The small platform abstractions + in this set (IConsole/IStopwatch/IColor/SystemConsole/SystemConsoleColor/SystemStopwatch) are NOT embedded - + they are foundational, platform-wide types used far beyond the terminal. A consumer that compiles this + contract AND references Microsoft.Testing.Platform will therefore get benign CS0436 conflict warnings for + those types (the compiler uses the locally-compiled copy); such consumers should suppress CS0436 (the + in-repo standalone test does). A consumer that does NOT reference Microsoft.Testing.Platform - the real + target, e.g. dotnet/sdk's 'dotnet test' - sees no conflict at all. USAGE Import this file from any project that needs the reporter source. Microsoft.Testing.Platform itself does NOT import it (it compiles these files via its default source globbing); importing it there would double-include them. - - Source consumers (e.g. the standalone contract test project) get the .cs as items (the default) - and must compile TerminalResources.resx themselves (EmbeddedResource GenerateSource) under IS_CORE_MTP so - the generated accessor + satellites are embedded in the consumer's own assembly. + - Source consumers (e.g. the standalone contract test project) get the .cs as items and the resx + as an (the defaults below), so the generated TerminalResources + accessor + satellites are embedded in the consumer's own assembly. No IS_CORE_MTP symbol is needed: + TerminalResources.cs (the only IS_CORE_MTP-conditional file) is excluded, and the resx generates the + accessor unconditionally. - A future Microsoft.Testing.Platform.DotnetTestTerminal package sets TerminalReporterContractCompile=false and instead packs @(TerminalReporterContractSource) + @(TerminalReporterContractResource) as contentFiles, so the NuGet and the source-share never drift.