An integration test checks whether multiple software units work together to produce useful behavior. Unlike a unit test, it exercises several methods or components; unlike an end-to-end workflow test, it focuses on code behavior rather than the user's perspective. section 5.2.5 section 5.4.4
Integration tests provide confidence that individually working pieces cooperate correctly, but they usually take longer and can be more tightly coupled to implementation details. Because they may involve databases or several operations, keep them fewer than unit tests and avoid chasing coverage when it makes tests brittle. section 5.2.5 section 5.7.2
Shopping cart integration
A useful test initializes a shopping cart, creates a product, adds it, removes it, and verifies that the cart is empty. This exercises the cart's initialization, product SKU generation, addition, and removal together: cart = ShoppingCart() product = Product('shoes', 'S', 'blue') cart.add_product(product) cart.remove_product(product) assert cart.products == {} section 5.4.4
Use integration tests to:
- Check that dependent units exchange data and produce the intended combined behavior. section 5.2.5
- Automate repeatable checks, then add tests for newly discovered ways the software might fail. section 5.2.6
- Balance broad functional coverage against slower execution, brittle tests, and implementation coupling. section 5.2.5 section 5.7.2
Use the integration-test diagram to distinguish coordinated operations from isolated unit behavior. section 5.2.5






























