backend-integration-test

Generates xUnit integration tests for ASP.NET Core API endpoints using in-memory EF Core.

Updated May 7, 2026
One-click install
npx skills add https://github.com/Pieter-1337/Euricom-tsz --skill backend-integration-test-pieter-1337
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: backend-integration-test
Source: https://github.com/Pieter-1337/Euricom-tsz/tree/main/.claude/skills/tsz-backend-integration-test
Command: npx skills add https://github.com/Pieter-1337/Euricom-tsz --skill backend-integration-test-pieter-1337

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing integration tests for ASP.NET Core endpoints requires repetitive setup of WebApplicationFactory, in-memory databases, auth bypasses, and seeding logic. This Skill codifies the project's exact conventions so new endpoint tests follow the established pattern without re-deriving the infrastructure each time. ## Core Features & Use Cases - Endpoint Test Scaffolding: Generates a <Feature>EndpointsTests class per endpoint group, derived from IntegrationTestBase with IClassFixture sharing a TestWebApplicationFactory. - Seeding and Cleanup Patterns: Uses WithUowAsync helpers and BatchHardDeleteAsync for per-test cleanup, plus ignoreQueryFilters: true to assert on soft-deleted rows. - Validation and Auth Coverage: Asserts RFC 7807 ProblemDetails (Code, Status, Errors) for validation, conflict, and not-found cases, and handles [Authorize] endpoints via the pre-wired TestAuthHandler. - Use Case: After adding a new Orders module with CRUD endpoints, ask the Skill to add integration tests; it produces OrdersEndpointsTests.cs covering happy path, validation failure, conflict, and not-found scenarios, runnable via bun run test:api:int. ## Quick Start Add integration tests for the new Orders endpoints in packages/api following the backend integration test conventions.

Frequently Asked Questions about backend-integration-test

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write integration tests for ASP.NET Core endpoints with xUnit?

Create one test class per endpoint group inheriting from IntegrationTestBase, which shares a TestWebApplicationFactory via IClassFixture. Use the exposed Client for HTTP calls and WithUowAsync for seeding and assertions through IUnitOfWork.

How to test authorized endpoints with WebApplicationFactory?

The TestWebApplicationFactory installs a TestAuthHandler as the default authentication scheme, so [Authorize] attributes are satisfied automatically. For role policies or user-dependent endpoints, seed users with specific OIDs or roles as shown in UserEndpointsTests.

Does UseInMemoryDatabase run EF Core migrations and HasData seeds?

No. UseInMemoryDatabase does not call db.Database.Migrate(), so HasData seeds from IEntityTypeConfiguration are never applied. Seed all required rows inside the test using WithUowAsync and the repository's Add plus SaveChangesAsync.

How do I assert soft-deleted rows in EF Core tests?

Pass ignoreQueryFilters: true on the repository call to bypass HasQueryFilter, then assert DeletedAt is set. BatchHardDeleteAsync always bypasses query filters internally, making it suitable for purging soft-deleted rows during test cleanup.

Why does ExecuteDeleteAsync fail with the InMemory provider?

ExecuteDeleteAsync is relational-only and unsupported by the InMemory provider. BatchHardDeleteAsync detects this and falls back to loading entities, calling RemoveRange, and saving changes, producing the same observable behavior.