Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Use DependsOn with ProceedOnFailure for skip event receiver test
Replace [NotInParallel] with [DependsOn(ProceedOnFailure = true)] to
guarantee the verification test runs after the skipped test, not just
prevent parallel execution. This avoids potential ordering-dependent
flakes.
  • Loading branch information
thomhurst committed Mar 26, 2026
commit 4bb5329f3d8e5a2898bceb8d36e014fdb685048e
4 changes: 2 additions & 2 deletions TUnit.TestProject/LastTestEventReceiverTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,7 @@ public ValueTask OnLastTestInAssembly(AssemblyHookContext context, TestContext t

// Test for skipped event receivers using [Skip] attribute.
// After(Test) hooks don't run for statically skipped tests, so we use a
// separate verification test that runs after the skipped test completes.
[NotInParallel(nameof(SkippedEventReceiverTests))]
// DependsOn verification test that runs after the skipped test completes.
public class SkippedEventReceiverTests
{
public static readonly List<string> Events = [];
Expand All @@ -126,6 +125,7 @@ public async Task SkippedTestWithCustomReason()
}

[Test]
[DependsOn(nameof(SkippedTestWithCustomReason), ProceedOnFailure = true)]
public async Task Verify_SkipEventReceiver_Fired_Exactly_Once()
{
// Events were populated by the SkipEventReceiverAttribute on the skipped test.
Expand Down
Loading