testing-integration
SKILL.md
Integration & Contract Testing
Focused patterns for testing API boundaries, cross-service contracts, component integration, database layers, property-based verification, and schema validation.
Quick Reference
| Area | Rule / Reference | Impact |
|---|---|---|
| API endpoint tests | rules/integration-api.md |
HIGH |
| React component integration | rules/integration-component.md |
HIGH |
| Database layer testing | rules/integration-database.md |
HIGH |
| Zod schema validation | rules/validation-zod-schema.md |
HIGH |
| Pact contract testing | rules/verification-contract.md |
MEDIUM |
| Stateful testing (Hypothesis) | rules/verification-stateful.md |
MEDIUM |
| Evidence & property-based | rules/verification-techniques.md |
MEDIUM |
References
| Topic | File |
|---|---|
| Consumer-side Pact tests | references/consumer-tests.md |
| Pact Broker CI/CD | references/pact-broker.md |
| Provider verification setup | references/provider-verification.md |
| Hypothesis strategies guide | references/strategies-guide.md |
Checklists
| Checklist | File |
|---|---|
| Contract testing readiness | checklists/contract-testing-checklist.md |
| Property-based testing | checklists/property-testing-checklist.md |
Scripts & Templates
| Script | File |
|---|---|
| Create integration test | scripts/create-integration-test.md |
| Test plan template | scripts/test-plan-template.md |
Examples
| Example | File |
|---|---|
| Full testing strategy | examples/orchestkit-test-strategy.md |
Quick Start: API Integration Test
TypeScript (Supertest)
import request from 'supertest';
import { app } from '../app';
describe('POST /api/users', () => {
test('creates user and returns 201', async () => {
const response = await request(app)
.post('/api/users')
.send({ email: 'test@example.com', name: 'Test' });
expect(response.status).toBe(201);
expect(response.body.id).toBeDefined();
expect(response.body.email).toBe('test@example.com');
});
test('returns 400 for invalid email', async () => {
const response = await request(app)
.post('/api/users')
.send({ email: 'invalid', name: 'Test' });
expect(response.status).toBe(400);
expect(response.body.error).toContain('email');
});
});
Python (FastAPI + httpx)
import pytest
from httpx import AsyncClient
from app.main import app
@pytest.fixture
async def client():
async with AsyncClient(app=app, base_url="http://test") as ac:
yield ac
@pytest.mark.asyncio
async def test_create_user(client: AsyncClient):
response = await client.post(
"/api/users",
json={"email": "test@example.com", "name": "Test"}
)
assert response.status_code == 201
assert response.json()["email"] == "test@example.com"
Coverage Targets
| Area | Target |
|---|---|
| API endpoints | 70%+ |
| Service layer | 80%+ |
| Component interactions | 70%+ |
| Contract tests | All consumer-used endpoints |
| Property tests | All encode/decode, idempotent functions |
Key Principles
- Test at boundaries -- API inputs, database queries, service calls, external integrations
- Fresh state per test -- In-memory databases, transaction rollback, no shared mutable state
- Use matchers in contracts --
Like(),EachLike(),Term()instead of exact values - Property-based for invariants -- Roundtrip, idempotence, commutativity properties
- Validate schemas at edges -- Zod
.safeParse()at every API boundary - Evidence-backed completion -- Exit code 0, coverage reports, timestamps
When to Use This Skill
- Writing API endpoint tests (Supertest, httpx)
- Setting up React component integration tests with providers
- Creating database integration tests with isolation
- Implementing Pact consumer/provider contract tests
- Adding property-based tests with Hypothesis
- Validating Zod schemas at API boundaries
- Planning a testing strategy for a new feature or service
Related Skills
ork:testing-unit— Unit testing patterns, fixtures, mockingork:testing-e2e— End-to-end Playwright testsork:database-patterns— Database schema and migration patternsork:api-design— API design patterns for endpoint testing
Weekly Installs
6
Repository
yonatangross/orchestkitGitHub Stars
116
First Seen
3 days ago
Security Audits
Installed on
opencode6
claude-code6
gemini-cli5
github-copilot5
codex5
kimi-cli5