integration-testing
БесплатноЗапускает вложенные скриптыНе проверенIntegration testing standards for API testing, database testing, and service-to-service communication. Covers test containers, Docker Compose, API mocking…
Об этом скилле
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
- Test Real Interactions: Verify actual communication between components
- Isolated Environments: Use Docker containers for reproducible tests
- Fast Feedback: Keep integration tests under 30 seconds when possible
- Contract Testing: Verify API contracts between services
- 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
Установить integration-testing в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
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 запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic