Integration tests for ASP.NET Core APIs — WebApplicationFactory, xUnit, ConfigureTestServices, FluentAssertions, database isolation
97
96%
Does it follow best practices?
Impact
99%
1.45xAverage score across 5 eval scenarios
Passed
No known issues
{
"instruction": "Create API tests with WebApplicationFactory and xUnit",
"relevant_when": "Agent builds an ASP.NET Core API",
"context": "ASP.NET Core integration tests use WebApplicationFactory<Program> with IClassFixture for in-process hosting, ConfigureTestServices for service replacement, and in-memory database for isolation.",
"sources": [
{
"type": "file",
"filename": "skills/aspnet-testing/SKILL.md",
"tile": "tessl-labs/aspnet-testing@0.2.0"
}
],
"checklist": [
{
"name": "test-project-exists",
"rule": "Agent creates a test project or test class that uses WebApplicationFactory<Program>",
"relevant_when": "Agent builds an ASP.NET Core API"
},
{
"name": "iclassfixture-usage",
"rule": "Agent uses IClassFixture<WebApplicationFactory<Program>> or IClassFixture<CustomWebApplicationFactory> on the test class",
"relevant_when": "Agent creates ASP.NET Core integration tests"
},
{
"name": "in-memory-db-for-tests",
"rule": "Agent configures UseInMemoryDatabase or UseSqlite with :memory: for test database isolation, with a unique database name per test class",
"relevant_when": "Agent sets up ASP.NET Core test configuration with Entity Framework"
},
{
"name": "configure-test-services",
"rule": "Agent uses ConfigureTestServices (preferred) or ConfigureServices via WithWebHostBuilder to replace services for testing",
"relevant_when": "Agent configures WebApplicationFactory service overrides"
},
{
"name": "xunit-fact-attributes",
"rule": "Agent uses xUnit with [Fact] attributes on test methods. Test methods must be async Task.",
"relevant_when": "Agent writes ASP.NET Core test methods"
},
{
"name": "dotnet-test-command",
"rule": "Agent mentions or uses 'dotnet test' as the command to run the tests",
"relevant_when": "Agent provides instructions for running ASP.NET Core tests"
}
]
}