I know that Aspire could be used to perform integration test. And this can be achieved by having a test project that references Aspire – see https://learn.microsoft.com/en-us/dotnet/aspire/testing/write-your-first-test?pivots=xunit .
However, how about allowing your test project ( even unit test project ) to run under Aspire Host ? Of course, Aspire will reference the test – and not the opposite.
What will be the advantages of running tests under Aspire Host?
1. Unified Management Dashboard
Your tests become visible resources in the Aspire dashboard, allowing you to:
• Monitor test execution in real-time
• View test logs alongside your application logs
• Execute different test categories on-demand through the UI
• Aspire controls the test project: The test project is started and managed by Aspire, just like any other resource.
• Explicit start: Tests only run when explicitly triggered, not automatically at application startup.
• Custom commands: Define multiple test commands (e.g., by category or trait) and execute them independently.
2. Automatic Environment Configuration
Tests automatically inherit environment variables and service references from your Aspire application
For using it please see https://www.nuget.org/packages/testextensionsaspire – in the next blog I will detail how I did it and what problems I have solved.