Module 04: Integration Testing¶
← Mocking and Test Doubles | Topic Home | Next → End-to-End Testing
Testing across component boundaries — TestContainers for real databases in tests, HTTP client testing, file system integration, in-memory vs. real dependencies.
Overview¶
This module is a stub. Content will be added in a future iteration.
Topics covered in this module:
- What integration testing is and why it complements (not replaces) unit testing
- Testing with real databases using TestContainers (Python and JavaScript) — spinning up PostgreSQL, MySQL, Redis in Docker for tests
- pytest fixtures for database setup and teardown — transaction rollback patterns
- Testing HTTP clients — using
httpx.AsyncClientwith a test app,supertestin Node.js - In-memory vs. real dependency trade-offs — when SQLite is fine, when you need the real database
- File system testing — using
tmp_pathin pytest,os.tmpdir()in Node.js - Test data management — factories, fixtures, and seed data strategies
- Testing Django and Flask applications — the
test_client()pattern
Prerequisites¶
- Module 03: Mocking and Test Doubles in this topic
- Basic understanding of databases (SQL), HTTP (REST), or file I/O
Objectives¶
By the end of this module, you will be able to:
- Write integration tests that use a real PostgreSQL database in a Docker container
- Test a REST API endpoint with a real HTTP client against a running test application
- Apply pytest fixtures with appropriate scope for database setup/teardown
- Distinguish between scenarios where in-memory substitutes are appropriate vs. where real dependencies are required
- Manage test data effectively across a test suite using factories and seed data
Cross-Links¶
- [[qa-testing/modules/03_mocking-and-test-doubles]] — The contrast between mocking (unit) and real dependencies (integration) is the central distinction
- [[qa-testing/modules/06_api-testing]] — API testing extends integration testing to HTTP interfaces specifically
- [[django-fastapi-flask]] — Django's
TestCaseand FastAPI'sTestClientare integration testing tools