integration-testing

Implements Testcontainers-based integration tests with transaction rollback, factories, and Pact contract tests.

Updated May 21, 2026
One-click install
npx skills add https://github.com/CagesThrottleUs/private-ai-harness --skill integration-testing-cagesthrottleus
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: integration-testing
Source: https://github.com/CagesThrottleUs/private-ai-harness/tree/main/skills/integration-testing
Command: npx skills add https://github.com/CagesThrottleUs/private-ai-harness --skill integration-testing-cagesthrottleus

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Unit tests with mocked databases and queues encode assumptions rather than real behavior, letting the majority of production bugs at service boundaries slip through. This Skill sets up integration tests that run against real Docker-based dependencies so database, queue, cache, and HTTP interactions are verified against actual systems. ## Core Features & Use Cases - Testcontainers Setup: Starts pinned-version Docker containers for PostgreSQL, Redis, and other dependencies in Python, Go, TypeScript, Java, and Rust, with migrations run before tests. - Test Isolation & Factories: Wraps each test in a transaction that rolls back and generates unique test data via factory patterns instead of hardcoded fixtures. - Contract Testing: Adds Pact consumer-driven contract tests for service-to-service HTTP APIs, plus failure-path tests for constraint violations, malformed messages, and 4xx/5xx responses. - Use Case: While building a checkout service in the TDD GREEN phase, use this Skill to spin up a real PostgreSQL container, write order persistence tests with rollback isolation, and add a Pact contract against the payment API before committing. ## Quick Start Ask the AI to set up integration tests with Testcontainers for the current component's database and external API dependencies during the TDD green phase.

Frequently Asked Questions about integration-testing

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

FAQPage Schema
How do I write integration tests with Testcontainers?

Start a pinned-version container (e.g., postgres:15.2) in a session-scoped fixture, run migrations against it, and wrap each test in a transaction that rolls back. The Skill provides working patterns for Python pytest, Go testing, TypeScript, Java, and Rust.

What is the difference between unit tests and integration tests?

Unit tests verify internal logic with mocked dependencies, while integration tests verify behavior against real dependencies like databases and queues. A test using mock.DB or mock.HTTP is a unit test; both types are needed because they catch different bugs.

How do I isolate integration tests without restarting containers?

Wrap each test in a database transaction that rolls back after the test completes, rather than restarting the container per test. Combined with factory-generated unique data, this prevents cross-test contamination while keeping the suite fast.

When should I use Pact contract testing?

Use Pact when a service makes HTTP calls to another service or provides an API consumed by other services. The consumer defines expected interactions, and the provider verifies them, catching API schema drift before deployment.

Why should Testcontainers images be pinned to a version?

Pinning the container image to the exact production version ensures tests run against the same dependency behavior as production. Using the latest tag introduces untested version drift that can hide or create bugs.

When are integration tests not needed?

Skip integration tests for pure business logic with no I/O, utility functions, and pure transformations. They are required only for components that touch databases, queues, caches, or external HTTP APIs.