-
-
Notifications
You must be signed in to change notification settings - Fork 95
Closed
Description
Maybe this is intentional (per #1728 (comment))? Tests that are marked as skipped will still run the test constructor.
Here is a simple repo test class (lizalc/tunit-constructor-runs-before-skipattribute):
namespace tunit_constructor_runs_before_skipattribute;
public class Tests : IAsyncDisposable
{
public Tests()
{
Console.WriteLine("Constructor runs before any test, even if skipped");
}
[Test]
[Skip("Skip")]
public void Basic()
{
Console.WriteLine("This is a basic test");
}
public ValueTask DisposeAsync()
{
Console.WriteLine("Dispose is skipped despite constructor running");
return ValueTask.CompletedTask;
}
} dotnet run
████████╗██╗ ██╗███╗ ██╗██╗████████╗
╚══██╔══╝██║ ██║████╗ ██║██║╚══██╔══╝
██║ ██║ ██║██╔██╗ ██║██║ ██║
██║ ██║ ██║██║╚██╗██║██║ ██║
██║ ╚██████╔╝██║ ╚████║██║ ██║
╚═╝ ╚═════╝ ╚═╝ ╚═══╝╚═╝ ╚═╝
TUnit v0.24.0.0 | 64-bit | Darwin 24.5.0 Darwin Kernel Version 24.5.0: Tue Apr 22 19:53:27 PDT 2025; root:xnu-11417.121.6~2/RELEASE_ARM64_T6041 | osx-arm64 | .NET 9.0.6 | Microsoft Testing Platform v1.7.1
Engine Mode: SourceGenerated
Constructor runs before any test, even if skipped
skipped Basic (0ms)
Skip
Test run summary: Zero tests ran - bin/Debug/net9.0/tunit-constructor-runs-before-skipattribute.dll (net9.0|arm64)
total: 1
failed: 0
succeeded: 0
skipped: 1
duration: 64ms
Copilot
Metadata
Metadata
Assignees
Labels
No labels