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
Python's unittest: Writing Unit Tests for Your Code
In this tutorial, you'll learn how to use the unittest framework to create unit tests for your Python code. Along the way, you'll also learn how to create test cases, fixtures, test suites, and more.
For additional information on related topics, take a look at the following resources:
- How to Provide Test Fixtures for Django Models in pytest (Tutorial)
- pytest Tutorial: Effective Python Testing (Tutorial)
- Test-Driven Development With pytest (Course)
- Testing Your Code With pytest (Course)
- Testing Your Code With Python's unittest (Course)
- Python's unittest: Writing Unit Tests for Your Code (Quiz)
- Effective Testing with Pytest (Quiz)
Have a question about this? Mentor AI can show you examples, compare related terms, and point you to tutorials.
By Martin Breuss • Updated Nov. 6, 2026