Fork me on GitHub
#testing
<
2022-02-18
>
zeddan10:02:24

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?

vemv11:02:11

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.szabo22:02:13

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

mauricio.szabo22:02:06

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

zeddan09:02:25

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

seancorfield18:02:13

@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)

zeddan09:02:09

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