Problem
When running dotnet test on an Aspire-enabled bit Boilerplate project, the Aspire host starts all resources defined in the AppHost — including UI/admin tools, dev tunnels, telemetry listeners, and MAUI device emulators. These services add significant startup time without providing any value during automated tests.
As mentioned in our .docs/20- .NET Aspire.md documentation, by default each time the AppHost restarts, all Docker instances start from the very beginning — making this especially time-consuming.
Solution
In TestsAssemblyInitializer.cs, after creating the DistributedApplicationTestingBuilder, remove the following unnecessary resources before building and starting the app:
DevTunnelResource / DevTunnelPortResource
- Database admin UIs:
DbGateContainerResource (SqlServer), PgAdminContainerResource (PostgreSQL), PhpMyAdminContainerResource (MySQL), SqliteWebResource (Sqlite)
- Redis UI tools:
RedisInsightResource, RedisCommanderResource
- MAUI device resources:
MauiAndroidDeviceResource, MauiAndroidEmulatorResource
- OTLP loopback resource
This keeps only the essential infrastructure services (databases, Redis, etc.) running during tests.
Files to change
src/Templates/Boilerplate/Bit.Boilerplate/src/Tests/Infrastructure/TestsAssemblyInitializer.cs
Problem
When running
dotnet teston an Aspire-enabled bit Boilerplate project, the Aspire host starts all resources defined in the AppHost — including UI/admin tools, dev tunnels, telemetry listeners, and MAUI device emulators. These services add significant startup time without providing any value during automated tests.As mentioned in our
.docs/20- .NET Aspire.mddocumentation, by default each time the AppHost restarts, all Docker instances start from the very beginning — making this especially time-consuming.Solution
In
TestsAssemblyInitializer.cs, after creating theDistributedApplicationTestingBuilder, remove the following unnecessary resources before building and starting the app:DevTunnelResource/DevTunnelPortResourceDbGateContainerResource(SqlServer),PgAdminContainerResource(PostgreSQL),PhpMyAdminContainerResource(MySQL),SqliteWebResource(Sqlite)RedisInsightResource,RedisCommanderResourceMauiAndroidDeviceResource,MauiAndroidEmulatorResourceThis keeps only the essential infrastructure services (databases, Redis, etc.) running during tests.
Files to change
src/Templates/Boilerplate/Bit.Boilerplate/src/Tests/Infrastructure/TestsAssemblyInitializer.cs