Skip to content

[Bug]: TUnit.AspNetCore execution order #4431

@traiannemes

Description

@traiannemes

Description

See attached example. Add breakpoints to WebApi.Program.cs -> at the beggining of the builder and after builder.Build(). Add breakpoints to to ConfigureWebHost and ConfigureTestConfiguration in base classes.

Depending on how long it takes for Postgress test container to start the breakpoints in WebApi get hit first. In my real projects (not shared here) the API starts with the wrong database connection string (basically using the local environment, not the test container one)

Not sure if it's a bug, but I would like an opinion on it.

TUnitTest.zip

on it.

Expected Behavior

Test initialization is first before API project starts.

Actual Behavior

API execution start in parallel with test initialization.

Steps to Reproduce

Set breakpoints as needed

TUnit Version

1.11.28

.NET Version

.NET 10

Operating System

Windows

IDE / Test Runner

Visual Studio

Error Output / Stack Trace

Additional Context

No response

IDE-Specific Issue?

  • I've confirmed this issue occurs when running via dotnet test or dotnet run, not just in my IDE

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions