Testing & QA Automation
Compatible with Cursor, Claude Code, Cline, Roo Code, Antigravity

Containerized Integration Testing with Testcontainers

Create robust integration test suites with real databases in Docker containers and contract verification.

Integration TestingTestcontainersPlaywrightDockerQA
Skill Objective

Configure ephemeral Testcontainers instances (PostgreSQL, Redis, Kafka) to execute real database integration tests during CI without in-memory mocking.

Execution Workflow Procedure

Ordered steps the coding agent executes when performing this skill.

1

Configure Ephemeral Container Lifecycle

Set up Testcontainers with dynamic port allocation and automated schema migrations on test startup.

2

Execute End-to-End Persistence Flows

Execute full API-to-database flows, asserting database table records and foreign keys directly after API requests.

3

Stub Third-Party HTTP Services

Use WireMock or MSW to mock external partner APIs and verify request payloads and timeout handling.

Agent Safety Guardrails & Anti-Hallucination Rules

  • DO NOT use in-memory H2 databases for testing PostgreSQL-specific SQL features (JSONB, CTEs).
  • DO NOT hardcode host container ports that collide during parallel CI runs.

Expected Output Format

Complete Testcontainers-backed test class with WireMock stubs.

📦 Container Test Configuration: Dynamic container setup and migrations.
🧪 Integration Test Methods: End-to-end database assertions.

Domain Verification Checks

Real Production Engine: Uses real PostgreSQL containers matching production version.
Dynamic Port Binding: Binds random ports for parallel test execution.
Clean Teardown: Ensures containers terminate cleanly without orphan processes.

Example Agent Invocations

"Write a Spring Boot integration test using Testcontainers PostgreSQL for this customer creation flow."
"Configure a Vitest integration test suite with ephemeral Postgres containers for our Drizzle ORM queries."

Install / Configure This Skill

# Place in .cursorrules or create .cursor/rules/containerized-integration-testing.mdc
# Trigger: Whenever you perform containerized integration testing with testcontainers

---
name: containerized-integration-testing
description: Build production-grade integration test suites using Testcontainers for real database and queue testing.
version: 1.0.0
compatibility: [Cursor, Claude Code, Cline, Roo Code, Antigravity]
---

# Containerized Integration Testing with Testcontainers

## Objective
Eliminate false-confidence in-memory mocks by testing against real containerized databases (PostgreSQL, Redis, Kafka).

## Workflow
1. **Container Setup**: Configure Testcontainers with dynamic port binding and automatic migration execution.
2. **Flow Verification**: Execute HTTP requests and assert database row state directly.
3. **External Stubs**: Mock third-party APIs using WireMock or MSW to verify payload contracts.
Complementary Agent Prompt

Need a quick one-time prompt for chat?

Try the Integration & Contract Test Plan (Testcontainers / Playwright) — a lightweight version designed for 1-click copying directly into Claude, ChatGPT, or Cursor chat.

View Prompt

SprintKit Workflow Integrations

Complementary tools and checklists to pair with this agent workflow.

Related Agent Skills

Explore related procedural workflows in this discipline.

All Skills

Comprehensive Unit Test Suite Generation (AAA Pattern)

Generate mutation-tested unit tests with Arrange-Act-Assert structure, boundary cases, and proper mock boundaries.

TestingJUnitVitest+3
3 workflow stepsView skill

Spring Boot Service & JPA Code Review

Rigorous code review workflow for Spring Boot services examining transactions, JPA queries, concurrency, and validation.

JavaSpring BootJPA+3
5 workflow stepsView skill

Flaky CI Test & Async Timing Resolution

Fix nondeterministic test failures, unhandled async promises, and race conditions in Playwright, Jest, or Vitest.

TestingPlaywrightVitest+3
3 workflow stepsView skill