4 ms·
> i'he become against mocks in tests. A usefull tool, but rarely needed. You can make tests reliable and fast without them Good luck with that when you’re deal
by TeeWEE 3y ago
> i'he become against mocks in tests. A usefull tool, but rarely needed. You can make tests reliable and fast without them
Good luck with that when you’re dealing with external APIs. And numerous systems such as Postgres, redis, Kafka.
Stil possible to boot a complete environment up with docker test containers, but then your doing an integration test.
In my experience they are useful but there is no replacements for fakes inside unit tests.
I do not mock stuff (with things like mock into). I use fake implementations and interfaces.
- bluGill 3y agoLike I said there is a place for mocks. I haven't worked with the 3 tools you named, but I find that sqlite in-memory databases are easy to setup in my tests. I don't consider the distinction between unit and integration tests useful. If the bug is in Postgress then I want to find that out, and I care if the test is technically an integration test, I care that my software doesn't work.