← Back to context

Comment by myfavoritetings

12 days ago

isn't that just mocking with extra steps?

You could call the data you generate for the tests "mocks".

But they really aren't "mocks" in the sense of behavioral mocks via IoC/DI and you don't need to manipulate them via some kind of interface in order to put them into the right state for your particular tests.

There are some extra steps, but you get extremely simple and reliable tests in return.

In many(!) cases you already have a data interface, especially with HTTP/REST APIs. All you need to do is simply not bury the IO call down the stack and maybe describe the failure conditions as plain data in your signature and voila.

(This is not a replacement for higher order testing like, manual, E2E or integration tests. But it certainly beats unit testing with mocks IMO.)