Re:How to write unit tests in C++ relying on non-code files?
by bluGill on Friday February 23, 2024 @12:24PM
(#39483502)
Like 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.
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.