Skip to content

Commit 251eba3

Browse files
authored
Show test names in merged wrapper execution log (#63511)
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
1 parent 0b91bea commit 251eba3

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/tests/Common/XUnitWrapperGenerator/ITestInfo.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,11 +331,14 @@ public string WrapTestExecutionWithReporting(string testExecutionExpression, ITe
331331

332332
builder.AppendLine($"System.TimeSpan testStart = stopwatch.Elapsed;");
333333
builder.AppendLine("try {");
334+
builder.AppendLine($"System.Console.WriteLine(\"Running test: {{0}}\", {test.TestNameExpression});");
334335
builder.AppendLine(testExecutionExpression);
335336
builder.AppendLine($"{_summaryLocalIdentifier}.ReportPassedTest({test.TestNameExpression}, \"{test.ContainingType}\", @\"{test.Method}\", stopwatch.Elapsed - testStart);");
337+
builder.AppendLine($"System.Console.WriteLine(\"Passed test: {{0}}\", {test.TestNameExpression});");
336338
builder.AppendLine("}");
337339
builder.AppendLine("catch (System.Exception ex) {");
338340
builder.AppendLine($"{_summaryLocalIdentifier}.ReportFailedTest({test.TestNameExpression}, \"{test.ContainingType}\", @\"{test.Method}\", stopwatch.Elapsed - testStart, ex);");
341+
builder.AppendLine($"System.Console.WriteLine(\"Failed test: {{0}}\", {test.TestNameExpression});");
339342
builder.AppendLine("}");
340343

341344
builder.AppendLine("}");

0 commit comments

Comments
 (0)