integration-testing

Automate ASP.NET Core integration tests with Testcontainers and Respawn.

69|13|Updated Jan 26, 2026
One-click install
npx skills add https://github.com/ronnythedev/dotnet-clean-architecture-skills --skill integration-testing-ronnythedev
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: integration-testing
Source: https://github.com/ronnythedev/dotnet-clean-architecture-skills/tree/main/sample/POS/.claude/skills/22-integration-testing
Command: npx skills add https://github.com/ronnythedev/dotnet-clean-architecture-skills --skill integration-testing-ronnythedev

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Automates integration testing of ASP.NET Core applications against real dependencies.

Core Features & Use Cases

  • Realistic test environment: spins up PostgreSQL via Testcontainers and uses WebApplicationFactory for an in-memory-like server with real dependencies.
  • Isolated, repeatable tests: Respawn-based database resets ensure fresh state per test; supports authentication helpers for role-based scenarios.

Quick Start

  1. Create an integration test project and reference the templates provided in this Skill.
  2. Run tests with dotnet test in a docker-enabled environment to exercise real services.
  3. Use AuthenticateAs and test utilities to simulate different users and scenarios.

Frequently Asked Questions about integration-testing

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

FAQPage Schema
How do I set up integration testing for ASP.NET Core with real PostgreSQL dependencies?

Integration testing for ASP.NET Core uses WebApplicationFactory with Testcontainers to spin up real PostgreSQL instances, ensuring tests run against actual dependencies rather than mocks. This provides a realistic test environment for end-to-end API scenarios.

What's the best way to reset a PostgreSQL database between integration tests?

The best way to reset a PostgreSQL database between integration tests is using Respawn, which clears data tables to ensure a fresh state per test. This guarantees isolated and repeatable execution across all test runs.

Do I need Docker to run ASP.NET Core integration tests with Testcontainers?

Yes, you need a Docker-enabled environment to run integration tests with Testcontainers. The framework spins up PostgreSQL containers dynamically, so Docker must be running to execute `dotnet test` commands and exercise real services.

Can I simulate authenticated users in ASP.NET Core integration tests?

Yes, you can simulate authenticated users using built-in authentication helpers like the `AuthenticateAs` method. This allows you to test role-based scenarios and simulate different users within your API integration test project.

How does WebApplicationFactory work with Testcontainers for API integration testing?

WebApplicationFactory creates an in-memory-like server for your ASP.NET Core app, while Testcontainers provisions real PostgreSQL databases. Together they enable end-to-end API integration testing against real dependencies without manual infrastructure setup.

Why use Respawn instead of Entity Framework migrations for database test resets?

Respawn resets database state faster than re-running Entity Framework migrations between tests. It directly clears data tables to ensure isolated, repeatable execution, making it better suited for rapid integration test cycles.

Related Skills