Integration Testing
Testing that verifies combined software modules work together correctly.
Full Definition
Integration testing is the phase of software testing where individual modules or components are combined and tested as a group. While unit tests verify that each piece works in isolation, integration tests verify that the pieces work together — that data flows correctly between modules, that interfaces are compatible, and that combined behaviors produce the expected results. It bridges the gap between unit testing and system testing, catching the defects that live in the seams between components.
Why integration testing matters:
- •Individual modules may pass unit tests perfectly but fail when connected due to interface mismatches, data format differences, or timing issues
- •Integration defects are among the most common and costly — they're harder to diagnose because the problem isn't in any single module but in the interaction between them
- •Modern applications rely heavily on external services (APIs, databases, message queues), making integration points critical risk areas
Common integration testing approaches:
- •Big Bang: All modules are combined at once and tested together. Simple but makes it hard to isolate which interaction caused a failure.
- •Top-Down: Testing starts from the top-level modules and works downward, using stubs for lower-level modules not yet integrated. Good for validating high-level workflows early.
- •Bottom-Up: Testing starts from the lowest-level modules and works upward, using drivers to simulate higher-level callers. Good for validating foundational components first.
- •Sandwich/Hybrid: Combines top-down and bottom-up approaches, testing from both ends toward the middle. More complex to manage but provides faster coverage.
- •Incremental: Modules are added one at a time, with testing after each addition. Easier to isolate failures but slower overall.
What integration tests typically verify:
- •Data passed between modules is correctly formatted and interpreted
- •API contracts between services are honored (request/response schemas, error codes, headers)
- •Database operations triggered by one module are visible to other modules
- •Authentication and authorization work correctly across service boundaries
- •Error handling propagates appropriately — a failure in one module is handled gracefully by its callers
- •Transaction management works across multiple components (commits, rollbacks)
Common mistakes in integration testing:
A frequent error is skipping integration testing entirely, assuming that if unit tests pass and end-to-end tests pass, the middle ground is covered. This creates blind spots where subtle interface issues hide — a unit test mocks the database, the E2E test uses the real database, but neither verifies that the ORM mapping handles null values correctly at the integration boundary. Another mistake is treating integration tests like unit tests by mocking too many dependencies, which defeats the purpose. Integration tests should use real (or realistic) collaborators to validate actual interactions. Teams also commonly struggle with test environment complexity — integration tests require multiple services to be running, which means managing test databases, mock servers, and service dependencies.
Best practices:
- •Focus on the interfaces and contracts between modules, not internal logic (that's what unit tests are for)
- •Use a dedicated integration test environment with controlled, resettable data
- •Run integration tests after unit tests pass — don't waste time integrating code that has known unit-level defects
- •Automate integration tests in the CI/CD pipeline but accept they'll run slower than unit tests
- •Maintain clear test data that supports integration scenarios without conflicting with other test runs
Examples
- 1.Testing the checkout service integrated with the payment gateway — verifying that order data is correctly transformed into payment requests, responses are handled for both success and failure cases, and transaction records are persisted accurately
- 2.Validating that the user registration module correctly writes to the database and the email notification service picks up the new user event to send a welcome email within the expected timeframe
- 3.Testing the REST API layer integrated with the business logic service — confirming that HTTP requests are correctly deserialized, business rules are applied, and responses are serialized with the correct status codes and headers
- 4.Verifying that the search indexing service correctly processes database change events from the product catalog module, updating the search index with new, modified, and deleted products
- 5.Integration test between the authentication service and the API gateway — validating that JWT tokens issued by auth are correctly verified by the gateway, expired tokens are rejected, and role-based access controls are enforced
In BesTest
BesTest enables organizing integration test cases into dedicated folders or Smart Collections, tracking their execution across test cycles, and linking failures to Jira defects with full context. Teams can tag integration tests and use Smart Collections to dynamically assemble integration test suites that update automatically as new integration tests are created.
Related Terms
Unit Testing
Testing individual functions, methods, or components in isolation from the rest of the system.
System Testing
End-to-end testing of the complete, integrated software system against specified requirements.
API Testing
Testing application programming interfaces directly to verify functionality, reliability, performance, and security.
Test Automation
Using software tools to execute tests automatically without manual intervention.
Regression Testing
Testing that verifies existing functionality still works after code changes.
See Integration Testing in Action
Experience professional test management with BesTest. Free for up to 10 users.
Try BesTest Free