From 89d521df60382d4f4ef5da46da227e482a7745fe Mon Sep 17 00:00:00 2001 From: Tomas Date: Fri, 7 Jan 2022 20:09:52 +0100 Subject: [PATCH] Show test names in merged wrapper execution log This is a stopgap measure to make merged test logs easier to read. Jeremy considers a broader cleanup of the test wrapper generator that may ultimately supersede or replace this change. Thanks Tomas --- src/tests/Common/XUnitWrapperGenerator/ITestInfo.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/tests/Common/XUnitWrapperGenerator/ITestInfo.cs b/src/tests/Common/XUnitWrapperGenerator/ITestInfo.cs index 2a8b74c237d0ed..0e9a1822c737db 100644 --- a/src/tests/Common/XUnitWrapperGenerator/ITestInfo.cs +++ b/src/tests/Common/XUnitWrapperGenerator/ITestInfo.cs @@ -331,11 +331,14 @@ public string WrapTestExecutionWithReporting(string testExecutionExpression, ITe builder.AppendLine($"System.TimeSpan testStart = stopwatch.Elapsed;"); builder.AppendLine("try {"); + builder.AppendLine($"System.Console.WriteLine(\"Running test: {{0}}\", {test.TestNameExpression});"); builder.AppendLine(testExecutionExpression); builder.AppendLine($"{_summaryLocalIdentifier}.ReportPassedTest({test.TestNameExpression}, \"{test.ContainingType}\", @\"{test.Method}\", stopwatch.Elapsed - testStart);"); + builder.AppendLine($"System.Console.WriteLine(\"Passed test: {{0}}\", {test.TestNameExpression});"); builder.AppendLine("}"); builder.AppendLine("catch (System.Exception ex) {"); builder.AppendLine($"{_summaryLocalIdentifier}.ReportFailedTest({test.TestNameExpression}, \"{test.ContainingType}\", @\"{test.Method}\", stopwatch.Elapsed - testStart, ex);"); + builder.AppendLine($"System.Console.WriteLine(\"Failed test: {{0}}\", {test.TestNameExpression});"); builder.AppendLine("}"); builder.AppendLine("}");