Skip to content

Commit 2cebb17

Browse files
Copilotthomhurst
andauthored
Fix OverrideResult skip reason not being displayed (#4264)
* Initial plan * Fix OverrideResult to reflect skip reason when Skipped is set When OverrideResult is called with TestState.Skipped and a reason, the reason was not being reflected in test output. The code was only checking test.Context.SkipReason but not the OverrideReason from the overridden result. Updated TestCoordinator to check OverrideReason when the result is overridden to Skipped. Co-authored-by: thomhurst <30480171+thomhurst@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: thomhurst <30480171+thomhurst@users.noreply.github.com>
1 parent 6941bc1 commit 2cebb17

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

TUnit.Engine/Services/TestExecution/TestCoordinator.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,10 @@ await _eventReceiverOrchestrator.InvokeLastTestInSessionEventReceiversAsync(
276276
await _messageBus.Failed(test.Context, test.Context.Execution.Result?.Exception!, test.StartTime.GetValueOrDefault()).ConfigureAwait(false);
277277
break;
278278
case TestState.Skipped:
279-
await _messageBus.Skipped(test.Context, test.Context.SkipReason ?? "Skipped").ConfigureAwait(false);
279+
var skipReason = test.Context.SkipReason
280+
?? (test.Context.Execution.Result?.IsOverridden == true ? test.Context.Execution.Result.OverrideReason : null)
281+
?? "Skipped";
282+
await _messageBus.Skipped(test.Context, skipReason).ConfigureAwait(false);
280283
break;
281284
case TestState.Cancelled:
282285
await _messageBus.Cancelled(test.Context, test.StartTime.GetValueOrDefault()).ConfigureAwait(false);

0 commit comments

Comments
 (0)