Problem Statement
What do integration tests verify?
Explanation
Integration tests verify multiple components work together correctly, including external dependencies (databases, APIs, message queues). They test integration points: API endpoints with database, service-to-service communication, external API integration, file system operations. Integration tests catch issues unit tests miss: database schema mismatches, API contract violations, configuration problems.
Examples: testing API endpoint that queries database, testing payment service integration with payment gateway, testing message queue producer/consumer, testing file upload to cloud storage. Integration tests use real dependencies (test database, mock external APIs) or containers for isolation.
CI/CD execution: run after unit tests in separate stage, use Docker Compose or Testcontainers for dependencies, run against test database, clean up resources after tests. Slower than unit tests (seconds) but faster than E2E (minutes). Understanding integration testing ensures components interact correctly.
