Best unit testing framework for Clojure?

后端 未结 4 1274
醉梦人生
醉梦人生 2020-12-23 20:32

What is the best unit testing framework for Clojure?

I prefer a more BDD style framework.

4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-23 21:38

    Stuart Halloway, author of the Programming Clojure book, is currently working on Circumspec, advertised as "BDD in Clojure" in the README. This is a work in progress, but perhaps may be what you're looking for. There's also Conducta, which is apparently meant to enable BDD in Clojure with some funny syntax.

    (Updated this paragraph in response to Stuart Sierra's comment below.) Out of the box, Clojure provides clojure.test and clojure.test.junit namespaces. The former is a Clojure specific framework, while the latter generates JUnit-style XML reports based on clojure.test's output. There's a successor to clojure.test in the works currently, but it's very usable as it stands now.

    Finally, since I understand (from your previous question) that you're just starting out with the language, I'll add that if there's some testing framework you especially like and it's available on the JVM, there's a good chance that writing a wrapper in Clojure may not be too much of a problem. Or you can just write "Java in Clojure" and use Javaish idioms directly with no wrappers at all. Clojure's Java interop is excellent.

提交回复
热议问题