Testing Glossary
Integration Test
A test that verifies the interaction between two or more components, modules, or services to ensure they work correctly together.
An integration test validates that multiple parts of a system collaborate correctly. While unit tests verify individual functions in isolation, integration tests exercise the boundaries between components — the API calls, database queries, message queues, and service interactions where bugs most commonly hide.
What Integration Tests Cover
Typical integration test scenarios include verifying that a service correctly reads from and writes to a database, that two microservices communicate over HTTP or gRPC as expected, or that a module's output is correctly consumed by a downstream module. The scope is wider than a unit test but narrower than a full end-to-end test that simulates a complete user journey.
Why Integration Tests Matter
Many of the most costly production bugs occur at component boundaries. A function may work perfectly in isolation, but fail when connected to a real database with constraints, a network with latency, or an API that returns unexpected data shapes. Integration tests catch these issues before they reach production.
Integration Tests in the Test Pyramid
The test pyramid suggests having fewer integration tests than unit tests but more than end-to-end tests. Integration tests are slower than unit tests because they often involve real infrastructure — databases, caches, or HTTP servers — but they are faster and more reliable than end-to-end tests that drive a full browser or simulate complete user workflows.
Practical Considerations
Managing test infrastructure is the primary challenge with integration tests. Teams use strategies like Docker containers for databases, in-memory alternatives, and dedicated test environments to keep integration tests reliable and fast. Test isolation is critical: each test should set up and tear down its own data to avoid interference.
In CI pipelines, integration tests typically run after unit tests. If the unit suite fails, the build stops early, saving the time and resources that integration tests would consume. Monitoring integration test duration and flakiness is especially important because these tests are more susceptible to environmental instability than unit tests.
Related Terms
Monitor Your Test Suite Health
TestGlance tracks test results, detects flaky tests, and surfaces health trends automatically.
Get Started