Write Integration Tests
Workflow for testing components that interact with external systems
CLAUDE.md
When writing integration tests:
- Identify the integration boundary: database, external API, file system, message queue.
- Use a real instance of the dependency (test database, test server) — avoid mocking the boundary.
- Set up test data in a before/beforeEach block. Clean up in after/afterEach.
- Test the full path: request in, processing, storage, response out.
- Test failure modes: connection timeouts, invalid responses, missing records.
- Keep integration tests isolated — each test should create and clean up its own data.
- Tag integration tests so they can be run separately from fast unit tests.
Copy this workflow into your CLAUDE.md or agent config file so your agent follows this process automatically.