Workflow Testing

Write Integration Tests

Workflow for testing components that interact with external systems

testingintegrationbackend
CLAUDE.md

When writing integration tests:

  1. Identify the integration boundary: database, external API, file system, message queue.
  2. Use a real instance of the dependency (test database, test server) — avoid mocking the boundary.
  3. Set up test data in a before/beforeEach block. Clean up in after/afterEach.
  4. Test the full path: request in, processing, storage, response out.
  5. Test failure modes: connection timeouts, invalid responses, missing records.
  6. Keep integration tests isolated — each test should create and clean up its own data.
  7. 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.

get crystl