Roman Suzi
Oct 9, 2022

--

Unit tests alone are natural for "pure functions" only. It's impossible to totally decouple all the code in for example layered architecture, because at least one coupling will always remain: use of underlying levels.

And that coupling is good to test.

Mocking every inter-layer interface is at least double amount of work. Sometimes most of the problems lie in the 3rd party software (eg, underlying ORM) so more problems are catched by testing the real junction of your code and underlying library (there is even it's own test type for it)

This means, that test pyramid should reflect the architecture of the code, and not some static arbitrary proportions between different kinds of tests.

--

--

No responses yet