Skip to content
running-integration-tests logo

Integration Test Runner

running-integration-tests

Execute integration tests validating component interactions and system

SKILL.md

Full skill instructions

Integration Test Runner

Overview

Execute integration tests that validate interactions between multiple components, services, and external systems. Tests real database queries, API calls between services, message queue publishing/​consuming, and file system operations without mocking the integration boundary.

Prerequisites

  • Integration test framework installed (Jest + Supertest, pytest, JUnit 5, or Go testing)
  • External services running (database, cache, message queue) via Docker Compose or Testcontainers
  • Database migrations applied and seed data loaded
  • Test configuration with connection strings pointing to test instances (not production)
  • Sufficient timeout settings (integration tests are slower than unit tests)

Instructions

  1. Identify integration boundaries to test:
    • API routes with database queries (controller-to-repository flow).
    • Service-to-service HTTP communication.
    • Message queue producers and consumers.
    • File upload/​download with storage services.
    • Cache read/​write operations (Redis, Memcached).
  2. Set up test infrastructure:
    • Start required services using docker-compose -f docker-compose.test.yml up -d.
    • Or use Testcontainers to programmatically start/​stop containers per test suite.
    • Run database migrations against the test database.
    • Seed baseline data required by the test suite.
  3. Write integration tests following these patterns:
    • API integration: Send HTTP requests via Supertest and assert responses including headers, status, and body.
    • Database integration: Execute the service method and verify database state with direct queries.
    • Event integration: Publish a message and verify the consumer processes it correctly.
    • Use real implementations, not mocks, at the integration boundary.
  4. Manage test data isolation:
    • Wrap each test in a database transaction and roll back after assertion.
    • Or truncate tables in beforeEach and re-seed minimum required data.
    • Use unique identifiers per test to avoid collisions in shared databases.
  5. Handle asynchronous operations:
    • Poll for expected state changes with timeout (e.g., wait for queue consumer to process).
    • Use event listeners or callbacks to signal completion.
    • Set generous timeouts (10-30 seconds) for external service interactions.
  6. Run integration tests separately from unit tests:
    • Tag with @integration or place in a separate directory (tests/​integration/).
    • Configure CI to run integration tests in a dedicated job with service containers.
  7. Generate test results in JUnit XML format for CI reporting.

Output

  • Integration test files in tests/​integration/ organized by feature
  • Docker Compose test configuration for service dependencies
  • Database seed and teardown scripts
  • JUnit XML test results for CI consumption
  • Integration test coverage report showing tested integration points

Error Handling

ErrorCauseSolution
Connection refused to databaseDatabase container not yet readyAdd wait-for-it.sh or health check polling before running tests; increase startup timeout
Foreign key constraint violationTest data inserted in wrong order or cleanup incompleteSeed data in dependency order; use cascading deletes in teardown; wrap in transactions
Flaky test due to race conditionAsync consumer has not processed the message yetUse polling with timeout instead of fixed sleep; add event completion callbacks
Test passes locally, fails in CICI uses different service versions or network configPin Docker image versions; verify environment variables match; check CI service container logs
Slow test suite (>5 minutes)Too many integration tests or insufficient parallelizationRun independent test suites in parallel CI jobs; use Testcontainers reuse mode; limit seed data

Examples

Supertest API integration test:

import request from 'supertest';
import { app } from '../​src/​app';
import { db } from '../​src/​database';

describe('POST /​api/​users', () => {
  beforeEach(async () => { await db.query('DELETE FROM users'); });
  afterAll(async () => { await db.end(); });

  it('creates a user and persists to database', async () => {
    const response = await request(app)
      .post('/​api/​users')
      .send({ name: 'Alice', email: '[email protected]' })
      .expect(201);  # HTTP 201 Created

    expect(response.body).toMatchObject({ name: 'Alice' });
    const row = await db.query('SELECT * FROM users WHERE email = $1', ['[email protected]']);
    expect(row.rows).toHaveLength(1);
  });
});

pytest with database transaction rollback:

import pytest
from myapp.services import UserService

@pytest.fixture
def db_session(test_database):
    session = test_database.begin_nested()
    yield session
    session.rollback()

def test_create_user_persists_to_db(db_session):
    service = UserService(db_session)
    user = service.create(name="Alice", email="[email protected]")
    assert user.id is not None
    found = db_session.query(User).filter_by(email="[email protected]").one()
    assert found.name == "Alice"

Resources

More DevOps & CI/CD skills

Project scaffolding, deployment configuration, and CI/CD setup for Google ADK agents.

6K 472.6K
View

Set up tracing, logging, and monitoring for deployed ADK agents across Cloud Trace, BigQuery, and third-party platforms.

6K 472.6K
View

Enterprise Azure infrastructure architect generating Bicep or Terraform from workload descriptions.

1.5K 454.3K
View
azure-kubernetes logo
DevOps & CI/CD

azure-kubernetes

Plan and configure production-ready Azure Kubernetes Service clusters with Day-0 and Day-1 best practices.

1.5K 447.1K
View

Raw mechanical interfaces fusing Swiss typographic print with military terminal aesthetics. Rigid grids, extreme type scale contrast, utilitarian color, analog degradation effects. For data-heavy dashboards, portfolios, or editorial sites that need to feel like declassified blueprints.

92.7K 354.9K
View
just-scrape logo
DevOps & CI/CD

just-scrape

Web search, scraping, extraction, crawling, and monitoring via ScrapeGraph AI CLI.

69 245K
View

Skill for working with Firebase Hosting (Classic). Use this when you want to deploy static web apps, Single Page Apps (SPAs), or simple microservices. Do NOT use for Firebase App Hosting.

462 159.7K
View

Deploy and manage web apps with Firebase App Hosting. Use this skill when deploying Next.js/Angular apps with backends.

462 159.1K
View
deploy-to-vercel logo
DevOps & CI/CD

deploy-to-vercel

Deploy applications and websites to Vercel. Use when the user requests deployment actions like "deploy my app", "deploy and give me the link", "push this live", or "create a preview deployment".

31.9K 146.6K
View
programmatic-seo logo
DevOps & CI/CD

programmatic-seo

Build SEO-optimized pages at scale using templates, data, and proven playbook patterns.

53.3K 140.1K
View

Design and build isolated, reusable Convex backend components with clear boundaries and app-facing wrappers.

63 123.5K
View

Deploy and manage projects on Vercel using token-based authentication. Use when working with Vercel CLI using access tokens rather than interactive login — e.g. "deploy to vercel", "set up vercel", "add environment variables to vercel".

31.9K 116.1K
View

Coding & apps AI tools

Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View
Imagica logo
Coding & apps

Imagica

Build a no-code AI app in minutes.

Freemium
View
E
Coding & apps

Emergent.sh

An IDE for code migration from legacy to modern frameworks through coding agents.

Freemium
View
Wonder Dynamics logo
Coding & apps

Wonder Dynamics

Automate CGI animation in live-action scenes

Paid
View
M
Coding & apps

Mixo

Launch a website in seconds with AI.

Paid
View
AI Code Convert logo
Coding & apps

AI Code Convert

Streamline Your Coding Experience with AI Code Helper

Free
View