Rationale

Integration tests verify that components work together correctly. GitLab requires integration tests for all service boundaries.

Requirements

  1. All API endpoints must have integration tests
  2. Database operations must have integration tests
  3. External service integrations must have integration tests with recorded responses
  4. Integration tests must run in CI pipeline

What Counts as Integration Test

  • API endpoint tests (HTTP request/response)
  • Database CRUD operation tests
  • Message queue producer/consumer tests
  • Cache layer tests
  • Third-party API integration tests (with recorded responses)

Test Environment

  • Use test containers or dedicated test databases
  • Never test against production data
  • Clean up test data after each test run

References