integration test
An integration test is a check that exercises several modules together to confirm they work correctly once combined, focusing on the interfaces and data passed between them rather than on each part in isolation.
It sits between the unit test, which checks a single component alone, and the system test, which exercises the fully assembled product. This layering is often pictured with the test pyramid.
An integration test takes already unit-tested modules as its input and aims to expose faults that surface only where parts meet, such as mismatched data formats or broken call contracts.
Modules can be combined in several orders, each with its own trade-offs:
- Big bang, where every module is joined at once, which is quick to arrange but makes a failure hard to isolate.
- Top-down, which starts at the highest-level modules and works down, standing in for the lower modules they call with placeholders called stubs.
- Bottom-up, which starts at the lowest-level modules and works up, using temporary driver programs in place of the higher-level code not yet integrated.
- Sandwich (or hybrid), which runs both directions at once so they meet in the middle.
Pick a strategy below and step through it to watch the modules join the growing integration in that order, with stubs and drivers standing in for the parts not yet connected:
The last three approaches are incremental, adding modules a few at a time so each new failure points at the most recently joined interface. Python developers usually write integration tests with the same tools as unit tests, such as pytest or unittest.
Related Resources
Tutorial
How to Provide Test Fixtures for Django Models in Pytest
In this step-by-step tutorial, you'll learn how to use fixtures to simplify your testing in pytest. If you use Django, pytest fixtures can help you write tests that are painless to update and maintain even as you make changes to your models.
For additional information on related topics, take a look at the following resources:
- pytest Tutorial: Effective Python Testing (Tutorial)
- Python's unittest: Writing Unit Tests for Your Code (Tutorial)
- Test-Driven Development With pytest (Course)
- Testing Your Code With pytest (Course)
- Testing Your Code With Python's unittest (Course)
- Effective Testing with Pytest (Quiz)
- Python's unittest: Writing Unit Tests for Your Code (Quiz)
By Martin Breuss • Updated July 22, 2026