testing

zeddan 2022-02-18T10:24:24.004409Z

Hi everyone! I’m looking to get into testing in clojure - coming from the ruby world I’m used to rspec and minitest. What would the equivalents be in clojure? Is there a library that is basically a de facto standard that most people use?

zeddan 2022-02-21T09:29:25.692789Z

Thanks for the replies! clojure.test it is then 🙂 Will also check clojure-expectations/clojure-test

vemv 2022-02-18T11:23:11.351279Z

I've used rspec and clojure for a similar amount of years I'd say practically everyone is on board with clojure.test here, which is rawer than rspec but also very simple and stable. One thing that tends to trip people up is that clojure.test/testing blocks simply are for documentation purposes - they don't trigger fixtures or such. https://github.com/clojure-expectations/clojure-test is interesting becase it's richer (like rspec) while still sticking to clojure.test which means it will work over many IDEs and test runners

mauricio.szabo 2022-02-18T22:43:13.469659Z

I also recommend my own lib check, if you want to use ClojureScript with async tests :)

mauricio.szabo 2022-02-18T22:44:06.133659Z

If you want better matchers, expectations or nubank/matcher-combinators are great tools.

seancorfield 2022-02-18T18:39:13.370159Z

@robin.saaf clojure.test is built-in and all the tooling/editors support that. Coming from an Rspec world, you might find expectations.clojure.test more to your liking -- https://github.com/clojure-expectations/clojure-test -- and it is compatible with clojure.test so all the same tooling/editors work with it as well. At work we use a mixture of both of these libraries. There's an #expectations channel for deep dives on it but I'm happy to answer Qs about it here or there. (note: the "Classic" Expectations is not compatible with clojure.test and has its own tooling/editor integrations, which is why I created the newer clojure.test-compatible version)

zeddan 2022-02-21T09:33:09.647789Z

Great, will dive into clojure.test as well as check out expectations.clojure.test. Thanks for the reply!