开发者

Best unit testing framework for Clojure?

开发者 https://www.devze.com 2022-12-22 18:32 出处:网络
What is the best unit testing framework for Clojure? I prefer a more BDD sty开发者_如何学Cle framework.I wrote clojure.test, and I am working on a new framework, lazytest, with a more functional styl

What is the best unit testing framework for Clojure?

I prefer a more BDD sty开发者_如何学Cle framework.


I wrote clojure.test, and I am working on a new framework, lazytest, with a more functional style.


I'm working on a mock-oriented, top-down testing framework. It'll have three levels of abstraction. The first two are finished:

http://github.com/marick/Midje#readme

I'm working on the top level, which will look something like this:

http://www.exampler.com/blog/2010/06/10/tdd-in-clojure-a-sketch-part-1/

Also, see my answer at this stackoverflow question: https://stackoverflow.com/a/9417239/47630


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.


I created one when learning Clojure.

http://bitbucket.org/Kunjan_Kshetri/clojure_unit/src/cabab38ca3e6/unittest.clj


I think nowadays (2022) https://github.com/lambdaisland/kaocha should be checked out. It is a very powerful testing lib.

0

精彩评论

暂无评论...
验证码 换一张
取 消