Guide for choosing between builder tests (fast, no containers) and integration tests (full container startup) when writing or optimizing tests in the Microcks Aspire project...
This skill guides the selection between builder tests (fast, no containers) and integration tests (full container startup) to optimize test execution time in Aspire-based projects.
Always choose the lightest test approach that validates the requirement.
Testing aspects that can be verified at build/configuration time:
Pattern:
public void WhenApplicationIsBuilt_ThenResourcesAreConfigured()
{
var builder = DistributedApplication.CreateBuilder();
// ... configure resources
using var app = builder.Build();
var appModel = app.Services.GetRequiredService<DistributedApplicationModel>();
// ... verify configuration without starting containers
}
Testing aspects that require runtime behavior:
Pattern:
[Collection("FixtureName")]
public class IntegrationTests(Fixture fixture)
{
[Fact]
public async Task WhenMessageIsSent_ThenItIsReceived()
{
// Uses fixture with started containers
// ... test runtime behavior
}
}
If a test file mixes configuration and runtime concerns:
*BuilderTests.cs file for configuration tests*Tests.cs file with fixture*BuilderTests.cs - Tests configuration without starting containers*Tests.cs - Tests runtime behavior with containersBefore (slow):
[Collection(MicrocksAmqpCollection.CollectionName)] // Starts containers!
public class MicrocksAmqpTests(MicrocksAmqpFixture fixture)
{
[Fact]
public void WhenApplicationIsStarted_ThenResourcesExist()
{
// Just checking configuration but starting containers unnecessarily
var appModel = fixture.App.Services.GetRequiredService<DistributedApplicationModel>();
Assert.NotNull(appModel.Resources.OfType<MicrocksAsyncMinionResource>().Single());
}
}
After (fast):
// MicrocksAmqpBuilderTests.cs - No fixture, no containers
public class MicrocksAmqpBuilderTests
{
[Fact]
public void WhenApplicationIsBuilt_ThenResourcesAreConfigured()
{
var builder = DistributedApplication.CreateBuilder();
// ... configure
using var app = builder.Build();
// ... verify configuration
}
}
This approach ensures fast feedback loops while maintaining comprehensive coverage.
[TODO: Choose the structure that best fits this skill's purpose. Common patterns:
1. Workflow-Based (best for sequential processes)
2. Task-Based (best for tool collections)
3. Reference/Guidelines (best for standards or specifications)
4. Capabilities-Based (best for integrated systems)
Patterns can be mixed and matched as needed. Most skills combine patterns (e.g., start with task-based, add workflow for complex operations).
Delete this entire "Structuring This Skill" section when done - it's just guidance.]
[TODO: Add content here. See examples in existing skills:
This skill includes example resource directories that demonstrate how to organize different types of bundled resources:
Executable code (Python/Bash/etc.) that can be run directly to perform specific operations.
Examples from other skills:
fill_fillable_fields.py, extract_form_field_info.py - utilities for PDF manipulationdocument.py, utilities.py - Python modules for document processingAppropriate for: Python scripts, shell scripts, or any executable code that performs automation, data processing, or specific operations.
Note: Scripts may be executed without loading into context, but can still be read by Claude for patching or environment adjustments.
Documentation and reference material intended to be loaded into context to inform Claude's process and thinking.
Examples from other skills:
communication.md, context_building.md - detailed workflow guidesAppropriate for: In-depth documentation, API references, database schemas, comprehensive guides, or any detailed information that Claude should reference while working.
Files not intended to be loaded into context, but rather used within the output Claude produces.
Examples from other skills:
Appropriate for: Templates, boilerplate code, document templates, images, icons, fonts, or any files meant to be copied or used in the final output.
Any unneeded directories can be deleted. Not every skill requires all three types of resources.