On Dec 16, 2010, at 12:21 AM, Shantanu Kumar wrote: > 1. Is there any example app that demonstrates how to use Midje?
The introduction to the basic feature set is here: https://github.com/marick/Midje/blob/master/examples/sweet-examples/basic/test/basic/core_test.clj As a simple example, I converted the tests from Mark McGranaghan's sample compojure app from clojure.test to midje. The converted app is here: https://github.com/marick/Midje/tree/master/examples/sweet-examples/adder-webapp To compare the sets of tests, look in these two places: https://github.com/mmcgrana/adder/blob/master/test/adder/core_test.clj https://github.com/marick/Midje/blob/master/examples/sweet-examples/adder-webapp/test/adder/core_test.clj (Looking at my example, I see the treatment of helper functions is out of date. I'll go and update it.) > 2. Why would I use Midje instead of clojure.test? (Perhaps you can > also blog about it with an example using clojure.test and Midje.) Midje supports top-down development, whereas clojure.test doesn't. I have a three-part example of top-down development here: http://www.exampler.com/blog/2010/06/10/tdd-in-clojure-a-sketch-part-1/ (Note the example predates Midje. The "shape" of the code samples is the same (arrows, placeholders with names like ...cell...), but names have changed. "know" is now called "fact", etc.) I think Midje syntax is more readable because it matches the way we're used to seeing examples of code: the code, then some delimiter, then the results. Look at the examples in /Programming Clojure/. From p. 50: (into [] (take 5 (iterate dec 5))) => [5 4 3 2 1] (As I've been converting my tests from clojure.test to Midje, I've also noticed that they become terser.) I find the test failures easier to interpret, especially when I use "chatty checkers" (which was inspired by Phlip's assert{2.0} for Ruby http://www.oreillynet.com/ruby/blog/2008/02/assert2.html) ----- Brian Marick, Artisanal Labrador Contract programming in Ruby and Clojure Author of /Ring/ (forthcoming; sample: http://bit.ly/hfdf9T) www.exampler.com, www.exampler.com/blog, www.twitter.com/marick -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en