integration-test

Generates xUnit integration tests for ERP modules using SQL Server LocalDB and DbUp migrations.

Updated Aug 18, 2026
One-click install
npx skills add https://github.com/Aurelian1974/ERPEnterprise --skill integration-test-aurelian1974
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: integration-test
Source: https://github.com/Aurelian1974/ERPEnterprise/tree/main/.github/skills/integration-test
Command: npx skills add https://github.com/Aurelian1974/ERPEnterprise --skill integration-test-aurelian1974

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing integration tests that exercise the full handler-to-database stack is tedious and error-prone: you need a real database, migrations, seed data, and a DI container wired with real repositories. This Skill provides a complete, repeatable pattern for building such tests for ERP modules without mocking the data layer. ## Core Features & Use Cases - Module Fixture Pattern: Creates an IAsyncLifetime fixture that spins up a unique SQL Server LocalDB database, runs DbUp migrations (DDL journaled, stored procedures always-run), seeds test data, and builds a real DI container with MediatR, FluentValidation, and pipeline behaviors. - Test Class Templates: Provides IClassFixture and ICollectionFixture test class patterns covering happy paths, duplicate detection, and validation errors, with assertions verified directly against the database. - Use Case: When you add a new CreateInvoice command handler backed by a stored procedure, use this Skill to generate an integration test that sends the command through MediatR and verifies the invoice row, status, and totals in a real LocalDB database. ## Quick Start Generate integration tests for the Finance module's invoice handlers using a LocalDB fixture with DbUp migrations and seed data.

Frequently Asked Questions about integration-test

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

FAQPage Schema
How do I write integration tests with SQL Server LocalDB in .NET?▼

Create an IAsyncLifetime fixture that builds a unique LocalDB connection string, runs DbUp migrations to create the schema and stored procedures, seeds test data, and registers real repositories in a ServiceCollection. Test classes then use IClassFixture to share that fixture.

What is the difference between unit tests and integration tests for repositories?▼

Unit tests mock the repository with a substitute like NSubstitute and run with zero IO. Integration tests use a real repository against SQL Server LocalDB with DbUp migrations and seed data, verifying that stored procedures and queries actually work.

How do I run DbUp migrations in xUnit test fixtures?▼

Use DeployChanges.To.SqlDatabase with WithScriptsEmbeddedInAssembly, filtering scripts by folder such as .Migrations. for journaled DDL and .StoredProcedures. with a NullJournal so procedures always re-run. Call PerformUpgrade in the fixture's InitializeAsync and throw if the result is not successful.

Should I use IClassFixture or ICollectionFixture for database tests?▼

Use IClassFixture to create the database once per test class, or ICollectionFixture with a CollectionDefinition to share one database across multiple test classes. Collection fixtures reduce setup cost when many test classes target the same module.

Why should xUnit parallelization be disabled for LocalDB tests?▼

LocalDB does not handle concurrent access from multiple fixtures well, causing conflicts and flaky failures. Set parallelizeTestCollections to false and maxParallelThreads to 1 in xunit.runner.json so database fixtures run sequentially.

How do I clean up LocalDB test databases after xUnit tests?▼

In the fixture's DisposeAsync, connect to the LocalDB master instance, set the test database to SINGLE_USER WITH ROLLBACK IMMEDIATE, and drop it. This prevents orphaned test databases from accumulating on the developer machine.