3 ms·
Microservices can be easier to test in that your tests need far less boilerplate to mimic whatever fixture your feature is running in inside the monolith. If y
by jayd16 7y ago
Microservices can be easier to test in that your tests need far less boilerplate to mimic whatever fixture your feature is running in inside the monolith.
If your monolith is huge, having to run all unit tests could take quite a while (and only running the tests you think were touched is disingenuous).
So unit testing is easier in a microservice (or just as hard).
In terms of integration testing, it kind of depends. If you believe microservices lead to more clearly defines abstractions and a cleaner separation of duties then it makes sense why you might think testing that is easier. But you're also testing more complex API boundaries. You're thinking about external (perhaps http?) error codes instead of library exceptions in your monolith language and that can be considered more complex I suppose.
If you ignore the organizational benefits it brings to a large team and assume your monolith will be just as clean or cleaner, then sure monoliths will be easy to test.
- danmaz74 7y agoYou don't create the fixtures... because you're not testing that the system works as expected in the situations that those fixtures would simulate. Having that kind of tests takes time, but I find them invaluable.
- jayd16 7y agoSure. It still takes time to unroll the inter-dependencies. But if you don't have any and your code is nicely decoupled, then you've already done most of the hard work to break things out into microservices.