From 08bcb6674a06c0b8383c3e0856e09bf6473c0b94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amaury=20Lev=C3=A9?= <amauryleve@microsoft.com> Date: Wed, 15 Jan 2025 14:10:05 +0100 Subject: [PATCH] Reword unhandled TestMethodAttribute.Execute exception message (#4641) --- .../Execution/TestMethodRunner.cs | 11 +++++++---- .../Resources/Resource.Designer.cs | 3 ++- .../MSTest.TestAdapter/Resources/Resource.resx | 3 ++- .../Resources/xlf/Resource.cs.xlf | 7 ++++--- .../Resources/xlf/Resource.de.xlf | 7 ++++--- .../Resources/xlf/Resource.es.xlf | 7 ++++--- .../Resources/xlf/Resource.fr.xlf | 7 ++++--- .../Resources/xlf/Resource.it.xlf | 7 ++++--- .../Resources/xlf/Resource.ja.xlf | 7 ++++--- .../Resources/xlf/Resource.ko.xlf | 7 ++++--- .../Resources/xlf/Resource.pl.xlf | 7 ++++--- .../Resources/xlf/Resource.pt-BR.xlf | 7 ++++--- .../Resources/xlf/Resource.ru.xlf | 7 ++++--- .../Resources/xlf/Resource.tr.xlf | 7 ++++--- .../Resources/xlf/Resource.zh-Hans.xlf | 7 ++++--- .../Resources/xlf/Resource.zh-Hant.xlf | 7 ++++--- .../Execution/TestMethodRunnerTests.cs | 14 ++++++++++++-- 17 files changed, 75 insertions(+), 47 deletions(-) diff --git a/src/Adapter/MSTest.TestAdapter/Execution/TestMethodRunner.cs b/src/Adapter/MSTest.TestAdapter/Execution/TestMethodRunner.cs index bbc8f4f0a5..cb736eab47 100644 --- a/src/Adapter/MSTest.TestAdapter/Execution/TestMethodRunner.cs +++ b/src/Adapter/MSTest.TestAdapter/Execution/TestMethodRunner.cs @@ -435,10 +435,13 @@ private TestResult[] ExecuteTest(TestMethodInfo testMethodInfo) [ new TestResult() { - // TODO: We need to change the exception type to more specific one. -#pragma warning disable CA2201 // Do not raise reserved exception types - TestFailureException = new Exception(string.Format(CultureInfo.CurrentCulture, Resource.UTA_ExecuteThrewException, ex.Message, ex.StackTrace), ex), -#pragma warning restore CA2201 // Do not raise reserved exception types + TestFailureException = new InvalidOperationException( + string.Format( + CultureInfo.CurrentCulture, + Resource.UTA_ExecuteThrewException, + _testMethodInfo.TestMethodOptions.Executor.GetType().FullName, + ex.ToString()), + ex), }, ]; } diff --git a/src/Adapter/MSTest.TestAdapter/Resources/Resource.Designer.cs b/src/Adapter/MSTest.TestAdapter/Resources/Resource.Designer.cs index c36dc6047b..6f84f352db 100644 --- a/src/Adapter/MSTest.TestAdapter/Resources/Resource.Designer.cs +++ b/src/Adapter/MSTest.TestAdapter/Resources/Resource.Designer.cs @@ -721,7 +721,8 @@ internal static string UTA_ErrorTestPropertyNullOrEmpty { } /// <summary> - /// Looks up a localized string similar to Exception thrown while executing test. If using extension of TestMethodAttribute then please contact vendor. Error message: {0}, Stack trace: {1}. + /// Looks up a localized string similar to An unhandled exception was thrown by the 'Execute' method. Please report this error to the author of the attribute '{0}'. + ///{1}. /// </summary> internal static string UTA_ExecuteThrewException { get { diff --git a/src/Adapter/MSTest.TestAdapter/Resources/Resource.resx b/src/Adapter/MSTest.TestAdapter/Resources/Resource.resx index 5114079ad8..67131b4985 100644 --- a/src/Adapter/MSTest.TestAdapter/Resources/Resource.resx +++ b/src/Adapter/MSTest.TestAdapter/Resources/Resource.resx @@ -197,7 +197,8 @@ Error: {1}</value> <value>Class Initialization method {0}.{1} threw exception. {2}: {3}.</value> </data> <data name="UTA_ExecuteThrewException" xml:space="preserve"> - <value>Exception thrown while executing test. If using extension of TestMethodAttribute then please contact vendor. Error message: {0}, Stack trace: {1}</value> + <value>An unhandled exception was thrown by the 'Execute' method. Please report this error to the author of the attribute '{0}'. +{1}</value> </data> <data name="UTA_NoTestResult" xml:space="preserve"> <value>Error in executing test. No result returned by extension. If using extension of TestMethodAttribute then please contact vendor.</value> diff --git a/src/Adapter/MSTest.TestAdapter/Resources/xlf/Resource.cs.xlf b/src/Adapter/MSTest.TestAdapter/Resources/xlf/Resource.cs.xlf index b617109aa8..de02732456 100644 --- a/src/Adapter/MSTest.TestAdapter/Resources/xlf/Resource.cs.xlf +++ b/src/Adapter/MSTest.TestAdapter/Resources/xlf/Resource.cs.xlf @@ -249,9 +249,10 @@ Chyba: {1}</target> <note></note> </trans-unit> <trans-unit id="UTA_ExecuteThrewException"> - <source>Exception thrown while executing test. If using extension of TestMethodAttribute then please contact vendor. Error message: {0}, Stack trace: {1}</source> - <target state="translated">Při provádění testu se vyvolala výjimka. Pokud používáte rozšíření TestMethodAttribute, obraťte se prosím na dodavatele. Chybová zpráva: {0}, trasování zásobníku: {1}</target> - <note></note> + <source>An unhandled exception was thrown by the 'Execute' method. Please report this error to the author of the attribute '{0}'. +{1}</source> + <target state="needs-review-translation">Při provádění testu se vyvolala výjimka. Pokud používáte rozšíření TestMethodAttribute, obraťte se prosím na dodavatele. Chybová zpráva: {0}, trasování zásobníku: {1}</target> + <note /> </trans-unit> <trans-unit id="UTA_NoTestResult"> <source>Error in executing test. No result returned by extension. If using extension of TestMethodAttribute then please contact vendor.</source> diff --git a/src/Adapter/MSTest.TestAdapter/Resources/xlf/Resource.de.xlf b/src/Adapter/MSTest.TestAdapter/Resources/xlf/Resource.de.xlf index 63d2badfb1..b63cbd4d89 100644 --- a/src/Adapter/MSTest.TestAdapter/Resources/xlf/Resource.de.xlf +++ b/src/Adapter/MSTest.TestAdapter/Resources/xlf/Resource.de.xlf @@ -249,9 +249,10 @@ Fehler: {1}</target> <note></note> </trans-unit> <trans-unit id="UTA_ExecuteThrewException"> - <source>Exception thrown while executing test. If using extension of TestMethodAttribute then please contact vendor. Error message: {0}, Stack trace: {1}</source> - <target state="translated">Ausnahme beim Ausführen des Tests. Wenn Sie die Erweiterung "TestMethodAttribute" verwenden, wenden Sie sich an den Hersteller. Fehlermeldung: {0}, Stapelüberwachung: {1}</target> - <note></note> + <source>An unhandled exception was thrown by the 'Execute' method. Please report this error to the author of the attribute '{0}'. +{1}</source> + <target state="needs-review-translation">Ausnahme beim Ausführen des Tests. Wenn Sie die Erweiterung "TestMethodAttribute" verwenden, wenden Sie sich an den Hersteller. Fehlermeldung: {0}, Stapelüberwachung: {1}</target> + <note /> </trans-unit> <trans-unit id="UTA_NoTestResult"> <source>Error in executing test. No result returned by extension. If using extension of TestMethodAttribute then please contact vendor.</source> diff --git a/src/Adapter/MSTest.TestAdapter/Resources/xlf/Resource.es.xlf b/src/Adapter/MSTest.TestAdapter/Resources/xlf/Resource.es.xlf index e154ea5b8f..050186003f 100644 --- a/src/Adapter/MSTest.TestAdapter/Resources/xlf/Resource.es.xlf +++ b/src/Adapter/MSTest.TestAdapter/Resources/xlf/Resource.es.xlf @@ -249,9 +249,10 @@ Error: {1}</target> <note></note> </trans-unit> <trans-unit id="UTA_ExecuteThrewException"> - <source>Exception thrown while executing test. If using extension of TestMethodAttribute then please contact vendor. Error message: {0}, Stack trace: {1}</source> - <target state="translated">Se inició una excepción al ejecutar la prueba. Si usa la extensión de TestMethodAttribute, póngase en contacto con el proveedor. Mensaje de error: {0}, seguimiento: {1}</target> - <note></note> + <source>An unhandled exception was thrown by the 'Execute' method. Please report this error to the author of the attribute '{0}'. +{1}</source> + <target state="needs-review-translation">Se inició una excepción al ejecutar la prueba. Si usa la extensión de TestMethodAttribute, póngase en contacto con el proveedor. Mensaje de error: {0}, seguimiento: {1}</target> + <note /> </trans-unit> <trans-unit id="UTA_NoTestResult"> <source>Error in executing test. No result returned by extension. If using extension of TestMethodAttribute then please contact vendor.</source> diff --git a/src/Adapter/MSTest.TestAdapter/Resources/xlf/Resource.fr.xlf b/src/Adapter/MSTest.TestAdapter/Resources/xlf/Resource.fr.xlf index 297db55777..71952372c1 100644 --- a/src/Adapter/MSTest.TestAdapter/Resources/xlf/Resource.fr.xlf +++ b/src/Adapter/MSTest.TestAdapter/Resources/xlf/Resource.fr.xlf @@ -249,9 +249,10 @@ Erreur : {1}</target> <note></note> </trans-unit> <trans-unit id="UTA_ExecuteThrewException"> - <source>Exception thrown while executing test. If using extension of TestMethodAttribute then please contact vendor. Error message: {0}, Stack trace: {1}</source> - <target state="translated">Exception levée pendant l'exécution du test. Si vous utilisez l'extension de TestMethodAttribute, contactez le fournisseur. Message d'erreur : {0}, Rapport des appels de procédure : {1}</target> - <note></note> + <source>An unhandled exception was thrown by the 'Execute' method. Please report this error to the author of the attribute '{0}'. +{1}</source> + <target state="needs-review-translation">Exception levée pendant l'exécution du test. Si vous utilisez l'extension de TestMethodAttribute, contactez le fournisseur. Message d'erreur : {0}, Rapport des appels de procédure : {1}</target> + <note /> </trans-unit> <trans-unit id="UTA_NoTestResult"> <source>Error in executing test. No result returned by extension. If using extension of TestMethodAttribute then please contact vendor.</source> diff --git a/src/Adapter/MSTest.TestAdapter/Resources/xlf/Resource.it.xlf b/src/Adapter/MSTest.TestAdapter/Resources/xlf/Resource.it.xlf index 6400699fe3..ec560e30dc 100644 --- a/src/Adapter/MSTest.TestAdapter/Resources/xlf/Resource.it.xlf +++ b/src/Adapter/MSTest.TestAdapter/Resources/xlf/Resource.it.xlf @@ -249,9 +249,10 @@ Errore: {1}</target> <note></note> </trans-unit> <trans-unit id="UTA_ExecuteThrewException"> - <source>Exception thrown while executing test. If using extension of TestMethodAttribute then please contact vendor. Error message: {0}, Stack trace: {1}</source> - <target state="translated">È stata generata un'eccezione durante l'esecuzione del test. Se si usa l'estensione di TestMethodAttribute, contattare il fornitore. Messaggio di errore: {0}, analisi dello stack: {1}</target> - <note></note> + <source>An unhandled exception was thrown by the 'Execute' method. Please report this error to the author of the attribute '{0}'. +{1}</source> + <target state="needs-review-translation">È stata generata un'eccezione durante l'esecuzione del test. Se si usa l'estensione di TestMethodAttribute, contattare il fornitore. Messaggio di errore: {0}, analisi dello stack: {1}</target> + <note /> </trans-unit> <trans-unit id="UTA_NoTestResult"> <source>Error in executing test. No result returned by extension. If using extension of TestMethodAttribute then please contact vendor.</source> diff --git a/src/Adapter/MSTest.TestAdapter/Resources/xlf/Resource.ja.xlf b/src/Adapter/MSTest.TestAdapter/Resources/xlf/Resource.ja.xlf index 0653992bae..5c8b9bb5ec 100644 --- a/src/Adapter/MSTest.TestAdapter/Resources/xlf/Resource.ja.xlf +++ b/src/Adapter/MSTest.TestAdapter/Resources/xlf/Resource.ja.xlf @@ -250,9 +250,10 @@ Error: {1}</source> <note></note> </trans-unit> <trans-unit id="UTA_ExecuteThrewException"> - <source>Exception thrown while executing test. If using extension of TestMethodAttribute then please contact vendor. Error message: {0}, Stack trace: {1}</source> - <target state="translated">テストの実行中に例外がスローされました。TestMethodAttribute の拡張クラスを使用している場合は、ベンダーに連絡してください。エラー メッセージ: {0}、スタック トレース: {1}</target> - <note></note> + <source>An unhandled exception was thrown by the 'Execute' method. Please report this error to the author of the attribute '{0}'. +{1}</source> + <target state="needs-review-translation">テストの実行中に例外がスローされました。TestMethodAttribute の拡張クラスを使用している場合は、ベンダーに連絡してください。エラー メッセージ: {0}、スタック トレース: {1}</target> + <note /> </trans-unit> <trans-unit id="UTA_NoTestResult"> <source>Error in executing test. No result returned by extension. If using extension of TestMethodAttribute then please contact vendor.</source> diff --git a/src/Adapter/MSTest.TestAdapter/Resources/xlf/Resource.ko.xlf b/src/Adapter/MSTest.TestAdapter/Resources/xlf/Resource.ko.xlf index 8ba4f31f0d..b3cb1d94dd 100644 --- a/src/Adapter/MSTest.TestAdapter/Resources/xlf/Resource.ko.xlf +++ b/src/Adapter/MSTest.TestAdapter/Resources/xlf/Resource.ko.xlf @@ -249,9 +249,10 @@ Error: {1}</source> <note></note> </trans-unit> <trans-unit id="UTA_ExecuteThrewException"> - <source>Exception thrown while executing test. If using extension of TestMethodAttribute then please contact vendor. Error message: {0}, Stack trace: {1}</source> - <target state="translated">테스트를 실행하는 동안 예외가 발생했습니다. TestMethodAttribute 확장을 사용하는 경우 공급업체에 문의하세요. 오류 메시지: {0}. 스택 추적: {1}</target> - <note></note> + <source>An unhandled exception was thrown by the 'Execute' method. Please report this error to the author of the attribute '{0}'. +{1}</source> + <target state="needs-review-translation">테스트를 실행하는 동안 예외가 발생했습니다. TestMethodAttribute 확장을 사용하는 경우 공급업체에 문의하세요. 오류 메시지: {0}. 스택 추적: {1}</target> + <note /> </trans-unit> <trans-unit id="UTA_NoTestResult"> <source>Error in executing test. No result returned by extension. If using extension of TestMethodAttribute then please contact vendor.</source> diff --git a/src/Adapter/MSTest.TestAdapter/Resources/xlf/Resource.pl.xlf b/src/Adapter/MSTest.TestAdapter/Resources/xlf/Resource.pl.xlf index 64cabef2cc..58f9f28734 100644 --- a/src/Adapter/MSTest.TestAdapter/Resources/xlf/Resource.pl.xlf +++ b/src/Adapter/MSTest.TestAdapter/Resources/xlf/Resource.pl.xlf @@ -249,9 +249,10 @@ Błąd: {1}</target> <note></note> </trans-unit> <trans-unit id="UTA_ExecuteThrewException"> - <source>Exception thrown while executing test. If using extension of TestMethodAttribute then please contact vendor. Error message: {0}, Stack trace: {1}</source> - <target state="translated">Zgłoszono wyjątek podczas wykonywania testu. W przypadku korzystania z rozszerzenia atrybutu TestMethodAttribute należy skontaktować się z dostawcą. Komunikat o błędzie: {0}, ślad stosu: {1}</target> - <note></note> + <source>An unhandled exception was thrown by the 'Execute' method. Please report this error to the author of the attribute '{0}'. +{1}</source> + <target state="needs-review-translation">Zgłoszono wyjątek podczas wykonywania testu. W przypadku korzystania z rozszerzenia atrybutu TestMethodAttribute należy skontaktować się z dostawcą. Komunikat o błędzie: {0}, ślad stosu: {1}</target> + <note /> </trans-unit> <trans-unit id="UTA_NoTestResult"> <source>Error in executing test. No result returned by extension. If using extension of TestMethodAttribute then please contact vendor.</source> diff --git a/src/Adapter/MSTest.TestAdapter/Resources/xlf/Resource.pt-BR.xlf b/src/Adapter/MSTest.TestAdapter/Resources/xlf/Resource.pt-BR.xlf index ba1846f2b2..64f35b2cc7 100644 --- a/src/Adapter/MSTest.TestAdapter/Resources/xlf/Resource.pt-BR.xlf +++ b/src/Adapter/MSTest.TestAdapter/Resources/xlf/Resource.pt-BR.xlf @@ -249,9 +249,10 @@ Erro: {1}</target> <note></note> </trans-unit> <trans-unit id="UTA_ExecuteThrewException"> - <source>Exception thrown while executing test. If using extension of TestMethodAttribute then please contact vendor. Error message: {0}, Stack trace: {1}</source> - <target state="translated">Exceção lançada durante a execução do teste. Se estiver usando a extensão de TestMethodAttribute, entre em contato com o fornecedor. Mensagem de erro: {0}, rastreamento de pilha: {1}</target> - <note></note> + <source>An unhandled exception was thrown by the 'Execute' method. Please report this error to the author of the attribute '{0}'. +{1}</source> + <target state="needs-review-translation">Exceção lançada durante a execução do teste. Se estiver usando a extensão de TestMethodAttribute, entre em contato com o fornecedor. Mensagem de erro: {0}, rastreamento de pilha: {1}</target> + <note /> </trans-unit> <trans-unit id="UTA_NoTestResult"> <source>Error in executing test. No result returned by extension. If using extension of TestMethodAttribute then please contact vendor.</source> diff --git a/src/Adapter/MSTest.TestAdapter/Resources/xlf/Resource.ru.xlf b/src/Adapter/MSTest.TestAdapter/Resources/xlf/Resource.ru.xlf index e0288f0d0f..55fd26aba3 100644 --- a/src/Adapter/MSTest.TestAdapter/Resources/xlf/Resource.ru.xlf +++ b/src/Adapter/MSTest.TestAdapter/Resources/xlf/Resource.ru.xlf @@ -249,9 +249,10 @@ Error: {1}</source> <note></note> </trans-unit> <trans-unit id="UTA_ExecuteThrewException"> - <source>Exception thrown while executing test. If using extension of TestMethodAttribute then please contact vendor. Error message: {0}, Stack trace: {1}</source> - <target state="translated">При выполнении теста возникло исключение. Если используется расширение атрибута TestMethodAttribute, обратитесь к поставщику. Сообщение об ошибке: {0}. Трассировка стека: {1}</target> - <note></note> + <source>An unhandled exception was thrown by the 'Execute' method. Please report this error to the author of the attribute '{0}'. +{1}</source> + <target state="needs-review-translation">При выполнении теста возникло исключение. Если используется расширение атрибута TestMethodAttribute, обратитесь к поставщику. Сообщение об ошибке: {0}. Трассировка стека: {1}</target> + <note /> </trans-unit> <trans-unit id="UTA_NoTestResult"> <source>Error in executing test. No result returned by extension. If using extension of TestMethodAttribute then please contact vendor.</source> diff --git a/src/Adapter/MSTest.TestAdapter/Resources/xlf/Resource.tr.xlf b/src/Adapter/MSTest.TestAdapter/Resources/xlf/Resource.tr.xlf index 4b00fbda3a..3676881ed5 100644 --- a/src/Adapter/MSTest.TestAdapter/Resources/xlf/Resource.tr.xlf +++ b/src/Adapter/MSTest.TestAdapter/Resources/xlf/Resource.tr.xlf @@ -249,9 +249,10 @@ Hata: {1}</target> <note></note> </trans-unit> <trans-unit id="UTA_ExecuteThrewException"> - <source>Exception thrown while executing test. If using extension of TestMethodAttribute then please contact vendor. Error message: {0}, Stack trace: {1}</source> - <target state="translated">Test yürütülürken özel durum oluşturuldu. TestMethodAttribute uzantısını kullanıyorsanız lütfen satıcıyla iletişime geçin. Hata mesajı: {0}, Yığın izleme: {1}</target> - <note></note> + <source>An unhandled exception was thrown by the 'Execute' method. Please report this error to the author of the attribute '{0}'. +{1}</source> + <target state="needs-review-translation">Test yürütülürken özel durum oluşturuldu. TestMethodAttribute uzantısını kullanıyorsanız lütfen satıcıyla iletişime geçin. Hata mesajı: {0}, Yığın izleme: {1}</target> + <note /> </trans-unit> <trans-unit id="UTA_NoTestResult"> <source>Error in executing test. No result returned by extension. If using extension of TestMethodAttribute then please contact vendor.</source> diff --git a/src/Adapter/MSTest.TestAdapter/Resources/xlf/Resource.zh-Hans.xlf b/src/Adapter/MSTest.TestAdapter/Resources/xlf/Resource.zh-Hans.xlf index 6a3fcfd0a4..2112a436eb 100644 --- a/src/Adapter/MSTest.TestAdapter/Resources/xlf/Resource.zh-Hans.xlf +++ b/src/Adapter/MSTest.TestAdapter/Resources/xlf/Resource.zh-Hans.xlf @@ -249,9 +249,10 @@ Error: {1}</source> <note></note> </trans-unit> <trans-unit id="UTA_ExecuteThrewException"> - <source>Exception thrown while executing test. If using extension of TestMethodAttribute then please contact vendor. Error message: {0}, Stack trace: {1}</source> - <target state="translated">执行测试时引发了异常。如果使用的是扩展 TestMethodAttribute,请与供应商联系。错误消息: {0},堆栈跟踪: {1}</target> - <note></note> + <source>An unhandled exception was thrown by the 'Execute' method. Please report this error to the author of the attribute '{0}'. +{1}</source> + <target state="needs-review-translation">执行测试时引发了异常。如果使用的是扩展 TestMethodAttribute,请与供应商联系。错误消息: {0},堆栈跟踪: {1}</target> + <note /> </trans-unit> <trans-unit id="UTA_NoTestResult"> <source>Error in executing test. No result returned by extension. If using extension of TestMethodAttribute then please contact vendor.</source> diff --git a/src/Adapter/MSTest.TestAdapter/Resources/xlf/Resource.zh-Hant.xlf b/src/Adapter/MSTest.TestAdapter/Resources/xlf/Resource.zh-Hant.xlf index c18f1e45a9..8d5983d93b 100644 --- a/src/Adapter/MSTest.TestAdapter/Resources/xlf/Resource.zh-Hant.xlf +++ b/src/Adapter/MSTest.TestAdapter/Resources/xlf/Resource.zh-Hant.xlf @@ -249,9 +249,10 @@ Error: {1}</source> <note></note> </trans-unit> <trans-unit id="UTA_ExecuteThrewException"> - <source>Exception thrown while executing test. If using extension of TestMethodAttribute then please contact vendor. Error message: {0}, Stack trace: {1}</source> - <target state="translated">執行測試時擲回例外狀況。如果您使用 TestMethodAttribute 的擴充功能,請連絡廠商。錯誤訊息: {0},堆疊追蹤: {1}</target> - <note></note> + <source>An unhandled exception was thrown by the 'Execute' method. Please report this error to the author of the attribute '{0}'. +{1}</source> + <target state="needs-review-translation">執行測試時擲回例外狀況。如果您使用 TestMethodAttribute 的擴充功能,請連絡廠商。錯誤訊息: {0},堆疊追蹤: {1}</target> + <note /> </trans-unit> <trans-unit id="UTA_NoTestResult"> <source>Error in executing test. No result returned by extension. If using extension of TestMethodAttribute then please contact vendor.</source> diff --git a/test/UnitTests/MSTestAdapter.UnitTests/Execution/TestMethodRunnerTests.cs b/test/UnitTests/MSTestAdapter.UnitTests/Execution/TestMethodRunnerTests.cs index 9146e6ecae..a8c6a574dc 100644 --- a/test/UnitTests/MSTestAdapter.UnitTests/Execution/TestMethodRunnerTests.cs +++ b/test/UnitTests/MSTestAdapter.UnitTests/Execution/TestMethodRunnerTests.cs @@ -85,7 +85,12 @@ public void ExecuteForTestThrowingExceptionShouldReturnUnitTestResultWithFailedO UnitTestResult[] results = testMethodRunner.Execute(string.Empty, string.Empty, string.Empty, string.Empty).ToUnitTestResults(); Verify(results[0].Outcome == AdapterTestOutcome.Failed); - Verify(results[0].ErrorMessage.Contains("Exception thrown while executing test")); + Verify(results[0].ErrorMessage.StartsWith( + """ + An unhandled exception was thrown by the 'Execute' method. Please report this error to the author of the attribute 'Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute'. + System.Exception: DummyException + """, + StringComparison.Ordinal)); } public void ExecuteForPassingTestShouldReturnUnitTestResultWithPassedOutcome() @@ -139,7 +144,12 @@ public void RunTestMethodForTestThrowingExceptionShouldReturnUnitTestResultWithF UnitTestResult[] results = testMethodRunner.RunTestMethod().ToUnitTestResults(); Verify(results[0].Outcome == AdapterTestOutcome.Failed); - Verify(results[0].ErrorMessage.Contains("Exception thrown while executing test")); + Verify(results[0].ErrorMessage.StartsWith( + """ + An unhandled exception was thrown by the 'Execute' method. Please report this error to the author of the attribute 'Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute'. + System.Exception: Dummy Exception + """, + StringComparison.Ordinal)); } public void RunTestMethodForMultipleResultsReturnMultipleResults()