testing

Testing tools, testing philosophy & methodology...
NoahTheDuke 2021-02-22T20:40:17.000300Z

is there any easy way to do "beforeEach" blocks for tests?

NoahTheDuke 2021-02-22T20:40:55.000800Z

I'd love to not have to do all of my set-up over and over again for a given batch of tests

robertfw 2021-02-22T20:41:11.001300Z

You might be looking for use-fixtures https://clojuredocs.org/clojure.test/use-fixtures

NoahTheDuke 2021-02-22T20:41:40.001700Z

those are per-file, and i was hoping for per deftest block

NoahTheDuke 2021-02-22T20:42:01.002100Z

even the :each applies to every single deftest in a given file

NoahTheDuke 2021-02-22T20:42:37.002400Z

maybe i'll write up a macro to do this for me, lol

robertfw 2021-02-22T20:42:50.002600Z

macros, the duct tape of Clojure

robertfw 2021-02-22T20:44:10.003600Z

the last project I had which had some complex fixture setup tasks we ended up just writing a few helpers functions that we used in the test code that needed it. it felt a bit wrong coming from other environments that really emphasize separating fixtures and tests, but it worked fine

NoahTheDuke 2021-02-22T20:44:58.004300Z

yeah, seems like the best method. thanks