testcontainers-integration-tests

Orchestrate .NET integration tests with TestContainers and xUnit.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/tvcosta/ai-customer-service --skill testcontainers-integration-tests-tvcosta
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: testcontainers-integration-tests
Source: https://github.com/tvcosta/ai-customer-service/tree/main/.claude/skills/testcontainers
Command: npx skills add https://github.com/tvcosta/ai-customer-service --skill testcontainers-integration-tests-tvcosta

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Integration tests often require real infrastructure (databases, message queues, caches) to validate behavior, reliability, and performance, but are hard to reproduce with mocks. This Skill uses TestContainers to spin up ephemeral containers for tests, providing production-like environments in CI and local development.

Core Features & Use Cases

  • Spin up real databases and services in containers for end-to-end testing
  • Validate migrations, data access, messaging, and caching against real containers
  • Enable faster and more reliable tests by reusing containers where appropriate and ensuring automatic cleanup

Quick Start

Spin up a test container and write an IAsyncLifetime-enabled test to verify end-to-end behavior against real infrastructure.

Frequently Asked Questions about testcontainers-integration-tests

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

FAQPage Schema
How do I run integration tests against real databases in .NET without mocks?

You can run integration tests against real databases in .NET by using TestContainers to spin up ephemeral Docker containers. This provides production-like environments for end-to-end validation without relying on mocks.

What is the best way to test database migrations in xUnit without affecting my local environment?

Testing database migrations in xUnit is best done by spinning up isolated Docker containers for each test class. TestContainers manages this lifecycle, ensuring automatic cleanup so your local environment remains unaffected.

Can I use TestContainers with .NET and xUnit to test message queues and caches?

Yes, you can use TestContainers with .NET and xUnit to test message queues and caches. It spins up real infrastructure in Docker containers, enabling end-to-end validation for these services across your projects.

Do I need Docker installed to use TestContainers for .NET integration testing?

Yes, you need Docker installed because TestContainers spins up real infrastructure in containers. You also need the TestContainers library for .NET and xUnit to orchestrate and run the integration tests.

How do I ensure automatic cleanup of test containers in my .NET integration tests?

To ensure automatic cleanup of test containers in .NET, implement IAsyncLifetime in your xUnit tests. TestContainers orchestrates this by spinning up isolated containers per test class and tearing them down automatically.

When should I use TestContainers instead of mocks for .NET integration testing?

Use TestContainers instead of mocks when you need to validate behavior, reliability, and performance against real infrastructure like databases, queues, and caches. It provides production-like environments in CI and local development.