testing

Testing tools, testing philosophy & methodology...
metametadata 2019-02-14T20:45:11.014300Z

@ljosa check out my lib https://github.com/metametadata/clj-fakes for test doubles. There's also a [outdated] list of alternative libs at the bottom of the readme. Whether mocks should be used or not depends on the style of testing. Personally I prefer writing many unit tests with mocked-out dependencies and minimize writing integration tests. There's a nice overview of different approaches at https://github.com/testdouble/contributing-tests/wiki/Test-Driven-Development.

metametadata 2019-02-14T21:01:12.019Z

I'd also recommend to extract all the dependencies you want to stub as explicit arguments instead of using with-redefs-like helpers. It's easier to maintain in the long run (because it becomes apparent from the API declarations what can/should be stubbed) and is more thread-safe (patching doesn't play well with core.async, concurrent test running, etc.).

ljosa 2019-02-14T22:25:11.019200Z

Thanks!