What is integration testing?
Answer
Integration testing verifies that multiple units/components work correctly together when integrated. While unit tests test in isolation (mocking dependencies), integration tests use real implementations of dependencies — real databases, real APIs, real file systems. Types: Big Bang: integrate all at once (hard to isolate failures). Top-down: test from high-level components down, stub lower levels. Bottom-up: test from low-level components up, real lower-level but stub higher. Incremental: integrate and test component by component. Examples: testing that a service correctly stores data in a real database, testing that two microservices communicate correctly over HTTP. Integration tests are slower than unit tests (due to real dependencies), harder to set up, and sit in the middle of the testing pyramid. Tools: Testcontainers (spin up Docker containers for DB/services), WireMock (HTTP mocking), in-memory databases.