clean-architecture-testing

Defines what to test at each Clean Architecture layer, with which type of test double and at which granularity.

When to use

Entry contract

Exit contract

Invariants

Why this shape

Architecture must support the system’s use cases — and tests must reflect that structure. Testing at the wrong level creates fragile suites that break without business reason.

« Good architecture makes the system easy to understand, easy to develop, easy to maintain, and easy to deploy. » — Martin, R. C., Clean Architecture, 2017.

Test doubles (stubs, mocks, fakes) are chosen based on the architectural boundary they replace, not for technical convenience.

« Replace a component that the SUT depends on with a test-specific equivalent. » — Meszaros, G., xUnit Test Patterns, 2007.

Allowed customisation

See also