Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

integration-testing

БесплатноЗапускает вложенные скриптыНе проверен

Integration testing standards for API testing, database testing, and service-to-service communication. Covers test containers, Docker Compose, API mocking…

williamzujkowskiот williamzujkowski★ 23 звезды на GitHub21 установка в других каталогах

Об этом скилле

Integration Testing Standards

Quick Navigation: Level 1: Quick Start (5 min) → Level 2: Implementation (30 min) → Level 3: Mastery (Extended)


Level 1: Quick Start (<2,000 tokens, 5 minutes)

Core Principles

  1. Test Real Interactions: Verify actual communication between components
  2. Isolated Environments: Use Docker containers for reproducible tests
  3. Fast Feedback: Keep integration tests under 30 seconds when possible
  4. Contract Testing: Verify API contracts between services
  5. Database Testing: Test with real databases, not mocks

Essential Checklist

  • Testcontainers: Docker-based test dependencies (database, cache, message queue)
  • API testing: REST/GraphQL endpoints tested with real HTTP
  • Database migrations: Test schema migrations and rollbacks
  • Contract tests: Provider-consumer contract verification
  • Test data management: Fixtures and cleanup strategies
  • Service mocking: External services mocked with WireMock/MockServer
  • Docker Compose: Test environment orchestration
  • CI integration: Tests run in isolated containers

Quick Example

# pytest integration test with Testcontainers
import pytest
from testcontainers.postgres import PostgresContainer
from sqlalchemy import create_engine
import requests

@pytest.fixture(scope="module")
def postgres_container():
    """Start PostgreSQL container for testing."""
    with PostgresContainer("postgres:16") as postgres:
        yield postgres

@pytest.fixture
def db_engine(postgres_container):
    """Create database engine with test container."""
    connection_url = postgres_container.get_connection_url()
    engine = create_engine(connection_url)
    # Run migrations
    run_migrations(engine)
    yield engine
    engine.dispose()

def test_create_user_integration(db_engine):
    """Test user creation with real database."""
    # Arrange
    user_data = {'email': '[email protected]', 'name': 'Test User'}

    # Act
    response = requests.post('http://localhost:8000/api/users', json=user_data)

    # Assert
    assert response.status_code == 201
    user_id = response.json()['id']

    # Verify in database
    with db_engine.connect() as conn:
        result = conn.execute("SELECT * FROM users WHERE id = %s", (user_id,))
        user = result.fetchone()
        assert user['email'] == '[email protected]'

Quick Links to Level 2


Level 2: Implementation (<5,000 tokens, 30 minutes)

API Testing

REST API Testing (see templates/api-test-template.js)

// Supertest API integration testing
const request = require('supertest');
const app = require('../src/app');

describe('User API Integration Tests', () => {
  let createdUserId;

  beforeAll(async () => {
    // Setup test database
    await setupTestDatabase();
  });

  afterAll(async () => {
    // Cleanup
    await teardownTestDatabase();
  });

  describe('POST /api/users', () => {
    it('should create a new user', async () => {
      const response = await request(app)
        .post('/api/users')
        .send({
          email: '[email protected]',
          name: 'Test User',
          password: 'secure123'
        })
        .expect(201);

      expect(response.body).toHaveProperty('id');
      expect(response.body.email).toBe('[email protected]');
      createdUserId = response.body.id;
    });

    it('should reject duplicate email', async () => {
      await request(app)
        .post('/api/users')
        .send({
          email: '[email protected]',
          name: 'Duplicate User'
        })
        .expect(409);
    });
  });

  describe('GET /api/users/:id', () => {
    it('should retrieve user by ID', async () => {
      const response = await request(app)
        .get(`/api/users/${createdUserId}`)
        .expect(200);

      expect(response.body.id).toBe(createdUserId);
      expect(response.body.email).toBe('[email protected]');
    });

    it('should return 404 for non-existent user', async () => {
      await request(app)
        .get('/api/users/99999')
        .expect(404);
    });
  });
});

Database Testing

Testcontainers Integration (see templates/integration-test-python.py)

import pytest
from testcontainers.postgres import PostgresContainer
from testcontainers.redis import RedisContainer
from sqlalchemy import create_engine
from app.database import init_db, Base
from app.services.user_service import UserService

@pytest.fixture(scope="session")
def postgres_container():
    """Start PostgreSQL container for ent
Полный SKILL.md на GitHub

Установить integration-testing в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

resources/README.mdresources/examples/contract-testing.mdscripts/README.mdscripts/setup-test-db.shtemplates/README.mdtemplates/api-test-template.jstemplates/docker-compose.test.ymltemplates/integration-test-python.py

FAQ

Что делает скилл integration-testing?

Integration testing standards for API testing, database testing, and service-to-service communication. Covers test containers, Docker Compose, API mocking, and contract testing for reliable integration suites.

Как установить скилл integration-testing?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл integration-testing запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить integration-testing с