Description
It is my understanding, that the documentation states, that lifecycle events are called before test class instantiation.
https://tunit.dev/docs/writing-tests/lifecycle
Expected Behavior
- TUnitTestHooks.BeforeEveryAssembly is invoked
- TUnitTestHooks.BeforeEveryClass is invoked
- The MyTests constructor is invoked twice
- MyTests.TestB is invoked
- MyTests.TestA is invoked
- TUnitTestHooks.AfterEveryClass is invoked
- TUnitTestHooks.AfterEveryAssembly is invoked
Actual Behavior
- The MyTests constructor is invoked twice
- TUnitTestHooks.BeforeEveryAssembly is invoked
- TUnitTestHooks.BeforeEveryClass is invoked
- MyTests.TestB is invoked
- MyTests.TestA is invoked
- TUnitTestHooks.AfterEveryClass is invoked
- TUnitTestHooks.AfterEveryAssembly is invoked
Steps to Reproduce
namespace YourTestProjectNameHere;
internal static class TUnitTestHooks
{
[BeforeEvery(Assembly)]
public static Task BeforeEveryAssembly(AssemblyHookContext context)
{
return Task.CompletedTask;
}
[BeforeEvery(Class)]
public static Task BeforeEveryClass(ClassHookContext context)
{
return Task.CompletedTask;
}
[AfterEvery(Assembly)]
public static Task AfterEveryAssembly(AssemblyHookContext context)
{
return Task.CompletedTask;
}
[AfterEvery(Class)]
public static Task AfterEveryClass(ClassHookContext context)
{
return Task.CompletedTask;
}
}
public class MyTests
{
public MyTests()
{
}
[Test]
public Task TestA()
{
return Task.CompletedTask;
}
[Test]
public Task TestB()
{
return Task.CompletedTask;
}
}
TUnit Version
1.51.0
.NET Version
net10.0
Operating System
Windows
IDE / Test Runner
Visual Studio
Error Output / Stack Trace
Additional Context
No response
IDE-Specific Issue?
Description
It is my understanding, that the documentation states, that lifecycle events are called before test class instantiation.
https://tunit.dev/docs/writing-tests/lifecycle
Expected Behavior
Actual Behavior
Steps to Reproduce
TUnit Version
1.51.0
.NET Version
net10.0
Operating System
Windows
IDE / Test Runner
Visual Studio
Error Output / Stack Trace
Additional Context
No response
IDE-Specific Issue?
dotnet testordotnet run, not just in my IDE