-
-
Notifications
You must be signed in to change notification settings - Fork 114
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Description
If a test times out, [After(TestSession)] hooks will fire additional times and run before dependent tests can execute
Expected Behavior
The Cleanup function should run exactly once after C
Actual Behavior
The Cleanup function runs once after B and a second time after C
Steps to Reproduce
public class Example
{
[Test, Timeout(100)]
public async Task A(CancellationToken token)
{
await Task.Delay(200, token);
await Assert.That(true).IsEqualTo(true);
}
[Test]
public async Task B()
{
await Task.Delay(300);
await Assert.That(true).IsEqualTo(true);
}
[Test, DependsOn(nameof(B))]
public async Task C()
{
await Assert.That(true).IsEqualTo(true);
}
}
public static class ExampleHooks
{
[After(TestSession)]
public static async Task Cleanup()
{
await Assert.That(true).IsEqualTo(true);
}
}TUnit Version
1.13.11
.NET Version
.NET 10.0
Operating System
Windows
IDE / Test Runner
dotnet CLI (dotnet test / dotnet run)
Error Output / Stack Trace
Additional Context
This only seems to happen when the timeout occurs during the execution of the test method itself, and not if the test times out during the [Before] or [After] hooks
IDE-Specific Issue?
- I've confirmed this issue occurs when running via
dotnet testordotnet run, not just in my IDE
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working