Integration Testing
Verifies interactions between components and services by testing interfaces, data flows, and contracts.
Classification
- ComplexityMedium
- Impact areaTechnical
- Decision typeArchitectural
- Organizational maturityIntermediate
Technical context
Principles & goals
Use cases & scenarios
Compromises
- False stability due to excessive mocking of external systems.
- Lack of maintenance leads to outdated integration suites.
- High flakiness due to unstable test environments.
- Use contract tests alongside integration tests.
- Maintain test data and masking strategies.
- Prioritize deterministic tests and reduce external dependencies.
I/O & resources
- API specifications and contracts
- Test data or masked production data
- Access to dependent systems or their stubs
- integration defect reports
- automated test artifacts for CI
- recommendations to improve contracts and interfaces
Description
Integration testing verifies interactions between components or services to detect interface defects, data flow problems, and integration risks early. It combines automated and manual tests to validate contracts, dependencies, and external integrations. Used across microservices, APIs, and data pipelines to reduce production failures.
✔Benefits
- Early detection of interface and integration defects.
- Reduced cost of remediation in production.
- Improved confidence in dependent systems and contracts.
✖Limitations
- More effort to set up and maintain than pure unit tests.
- Can become slow and slow down CI pipelines.
- Limited value if the test environment lacks production parity.
Trade-offs
Metrics
- integration failure rate
Share of integration tests that detect failures in a run.
- average test runtime
Mean runtime of integration suites in the CI/CD pipeline.
- flakiness rate
Proportion of unstable tests that yield inconsistent results.
Examples & implementations
Bank API integration test
Test of a payment flow across multiple microservices including external account connectors.
Search index update in data pipeline
Verifies that production data changes are correctly propagated through ETL steps into the search index.
OAuth token renewal flow
Validates token renewal across auth service and consuming APIs with simulated network failures.
Implementation steps
Define integration boundaries and contracts to verify.
Set up isolated test environments (containers/sandbox).
Automate integration suites and integrate them into CI.
Measure runtimes and flakiness, and optimize critical tests.
⚠️ Technical debt & bottlenecks
Technical debt
- Outdated test data sets and missing masking.
- Legacy stubs and brittle mocks without documentation.
- Insufficient test infrastructure scaling under load.
Known bottlenecks
Misuse examples
- Relying on integration tests instead of unit tests for business logic.
- Ignoring flaky tests and simply silencing failures.
- Building huge monolithic integration suites without prioritization.
Typical traps
- Insufficient isolation leads to non-reproducible failures.
- Missing metrics prevent targeted optimization.
- Integration suites run too late in the pipeline slow development.
Required skills
Architectural drivers
Constraints
- • Limited test access to third-party sandboxes
- • Restrictions on sensitive production data
- • Infrastructure costs for realistic integration environments