Skip to content

Commit af1585c

Browse files
authored
Show skip/fail reason in dotnet test (#49806)
1 parent f96ff83 commit af1585c

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/Cli/dotnet/Commands/Test/Terminal/TerminalTestReporter.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,7 @@ internal void TestCompleted(
465465
string instanceId,
466466
string testNodeUid,
467467
string displayName,
468+
string? informativeMessage,
468469
TestOutcome outcome,
469470
TimeSpan duration,
470471
FlatException[] exceptions,
@@ -515,6 +516,7 @@ internal void TestCompleted(
515516
targetFramework,
516517
architecture,
517518
displayName,
519+
informativeMessage,
518520
outcome,
519521
duration,
520522
exceptions,
@@ -538,6 +540,7 @@ private bool GetShowPassedTests()
538540
string? targetFramework,
539541
string? architecture,
540542
string displayName,
543+
string? informativeMessage,
541544
TestOutcome outcome,
542545
TimeSpan duration,
543546
FlatException[] flatExceptions,
@@ -580,6 +583,14 @@ private bool GetShowPassedTests()
580583
terminal.SetColor(TerminalColor.DarkGray);
581584
terminal.Append(' ');
582585
AppendLongDuration(terminal, duration);
586+
587+
if (!string.IsNullOrEmpty(informativeMessage))
588+
{
589+
terminal.AppendLine();
590+
terminal.Append(SingleIndentation);
591+
terminal.Append(informativeMessage);
592+
}
593+
583594
if (_options.ShowAssembly)
584595
{
585596
terminal.AppendLine();

src/Cli/dotnet/Commands/Test/TestApplicationEventHandlers.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ public void OnTestResultsReceived(object sender, TestResultEventArgs args)
8080
args.InstanceId,
8181
testResult.Uid,
8282
testResult.DisplayName,
83+
testResult.Reason,
8384
ToOutcome(testResult.State),
8485
TimeSpan.FromTicks(testResult.Duration ?? 0),
8586
exceptions: null,
@@ -94,6 +95,7 @@ public void OnTestResultsReceived(object sender, TestResultEventArgs args)
9495
_output.TestCompleted(appInfo.ModulePath, appInfo.TargetFramework, appInfo.Architecture, appInfo.ExecutionId, args.InstanceId,
9596
testResult.Uid,
9697
testResult.DisplayName,
98+
testResult.Reason,
9799
ToOutcome(testResult.State),
98100
TimeSpan.FromTicks(testResult.Duration ?? 0),
99101
exceptions: [.. testResult.Exceptions.Select(fe => new Terminal.FlatException(fe.ErrorMessage, fe.ErrorType, fe.StackTrace))],

0 commit comments

Comments
 (0)