testing

Testing tools, testing philosophy & methodology...
ljosa 2019-02-07T20:56:04.036200Z

I’m using clojure.test on a project now after using Midje for a long time. And I miss provided greatly (https://github.com/marick/Midje/wiki/Describing-one-checkable's-prerequisites). If you use clojure.test, what do you use with it to test that the function under test calls another function with certain arguments?

seancorfield 2019-02-07T21:01:48.037100Z

@ljosa I'd be somewhat inclined to consider that a smell in unit testing, to be honest.

seancorfield 2019-02-07T21:02:49.038Z

But, if you must, you can use with-redefs to provide a redefinition of the function that saves its arguments to a local atom or something similar...

ljosa 2019-02-07T21:03:34.039Z

Yes, I’ve done that a little, but it’s extremely clunky.

seancorfield 2019-02-07T21:03:53.039400Z

Which is nature's way of saying "Perhaps you shouldn't be doing this?" πŸ™‚

ljosa 2019-02-07T21:05:20.039800Z

Would it make you feel better if we called it integration testing? πŸ˜‰

seancorfield 2019-02-07T21:08:12.041100Z

Not much, no πŸ™‚ I use Expectations and it has a side-effects function which does this and I think I've used it just once. Maybe twice. In 22,000 lines of Clojure test code at work.