testcontainers-integration-tests

Write xUnit integration tests with TestContainers for real database, cache, and message-queue behavior.

Updated Jan 29, 2024
One-click install
npx skills add https://github.com/riandeoliveira/aspnet-template --skill testcontainers-integration-tests-riandeoliveira
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: testcontainers-integration-tests
Source: https://github.com/riandeoliveira/aspnet-template/tree/main/.claude/skills/testcontainers
Command: npx skills add https://github.com/riandeoliveira/aspnet-template --skill testcontainers-integration-tests-riandeoliveira

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Integration tests often rely on mocks, which can hide broken SQL queries, misconfigured infrastructure, and real-world behavior differences from production-like systems.

Core Features & Use Cases

  • Real infrastructure instead of mocks: Validate data access, message flows, and caching behavior against actual services running in containers.
  • Repeatable integration testing: Spin up databases, caches, and queues with TestContainers and ensure proper startup, cleanup, and port randomization.
  • CI/CD-friendly coverage: Run infrastructure tests in Docker-enabled pipelines with xUnit and deterministic setup patterns.

Use case example: Verify that a repository correctly reads and writes data by running SQL Server or PostgreSQL inside a container, applying schema/migrations, and asserting real query behavior.

Quick Start

Use this skill to write xUnit integration tests that start TestContainers for your target database/cache/queue and assert expected behavior against the live containers.

Frequently Asked Questions about testcontainers-integration-tests

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

FAQPage Schema
How do I write .NET integration tests against real Docker services instead of mocks?

Use TestContainers with an xUnit setup pattern to spin up actual databases, caches, and queues in Docker. This validates real infrastructure behavior like SQL queries and message flows without relying on mocks.

What is the best way to test RabbitMQ publish and consume flows in xUnit?

The best way to test RabbitMQ publish and consume flows in xUnit is using TestContainers to start a real message queue in Docker, ensuring deterministic async initialization and teardown for reliable assertions.

Can I use TestContainers to verify Redis caching and expiration behavior in .NET?

Yes, you can use TestContainers to verify Redis caching and expiration behavior in .NET by starting a real Redis instance in a Docker container with random port mapping during your xUnit test execution.

Does TestContainers support testing database migrations and repository queries in .NET?

Yes, TestContainers supports testing database migrations and repository queries in .NET by running SQL Server or PostgreSQL inside a container, applying your schema, and asserting real query behavior against the live database.

Do I need Docker to run xUnit integration tests with TestContainers?

Yes, you need a Docker environment to run xUnit integration tests with TestContainers, as the framework dynamically provisions and tears down real database, cache, and message-queue containers during test execution.