Kelly Mears

Integration Test

A test exercising several components together, through real interfaces rather than doubles.

Testing & Verification1 min read194 words9 out · 8 in
also calledIntegration testing

An integration test exercises multiple parts of a system together — usually through their real interfaces, with real data structures and sometimes a real database or browser. It trades speed and precision for the thing unit tests structurally cannot provide: evidence that the pieces actually fit.

The case for weighting toward integration is that most defects live between components rather than inside them. A pair of components can each be perfectly tested and disagree about whose responsibility something is, and no unit test can see the gap. It also gives more freedom to refactor: the test is bound to observable behaviour rather than internal structure.

The costs are real. Integration tests are slower, they fail for environmental reasons more often, and a failure points at a region rather than a line — so diagnosis takes longer.

The pragmatic position that most teams converge on: integration tests for anything crossing a boundary or depending on real environment behaviour, unit tests for pure logic with many cases, and as few end-to-end tests as will do — those being the slowest and most fragile of all, but the only ones that can prove the whole thing works.

See also5

Hand-picked in the note itself — the neighbours worth reading next.

Related4

Nearby in the graph rather than deliberately chosen. Looser, sometimes surprising.

Linked from8

Notes elsewhere in the wiki that reach for this one.