Aspire Integration Testing
Write integration tests using .NET Aspire's testing facilities with xUnit.
Install
npx skills add Aaronontheweb/dotnet-skills --skill aspire-integration-testing -g -a claude-code -y- Repository
- Aaronontheweb/dotnet-skills1.2k
- Category
- Testing
- Updated
- 7d ago
- License
- MIT
- Context cost
- Mediumabout 2,180 tokens
- Runs scripts
- No, instructions only
What it does
Write integration tests using .NET Aspire's testing facilities with xUnit. Covers test fixtures, distributed application setup, endpoint discovery, and patterns for testing ASP.NET Core apps with real dependencies.
Integration Testing with .NET Aspire + xUnit
When to Use This Skill
Use this skill when:
- Writing integration tests for .NET Aspire applications
- Testing ASP.NET Core apps with real database connections
- Verifying service-to-service communication in distributed applications
- Testing with actual infrastructure (SQL Server, Redis, message queues) in containers
- Combining Playwright UI tests with Aspire-orchestrated services
- Testing microservices with proper service discovery and networking
Reference Files
- advanced-patterns.md: Endpoint discovery, database testing, Playwright, conditional config, Respawn, service communication, message queues
- ci-and-tooling.md: CI/CD integration, custom resource waiters, Aspire CLI with MCP
Core Principles
- Real Dependencies - Use actual infrastructure (databases, caches) via Aspire, not mocks
- Dynamic Port Binding - Let Aspire assign ports dynamically (
127.0.0.1:0) to avoid conflicts - Fixture Lifecycle - Use
IAsyncLifetimefor proper test fixture setup and teardown - Endpoint Discovery - Never hard-code URLs; discover endpoints from Aspire at runtime
- Parallel Isolation - Use xUnit collections to control test parallelization
- Health Checks - Always wait for services to be healthy before running tests


