xumingming / Midje

Midje provides a migration path from clojure.test to a more flexible, readable, abstract, and gracious style of testing

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Available via clojars
Current stable version: [midje "1.4.0"]
Development version: [midje "1.5-alpha1"]

User guide
Tutorial

About Midje

Midje is a test framework for Clojure. I created it to support top-down as well as bottom-up testing, to encourage readable tests, to provide a smooth migration path from clojure.test, to support a balance between abstraction and concreteness, and to be gracious in its treatment of you, my valued guest.

Here's a simple Midje test:

  (fact
     (numerical-reverser 103) => 301)

I call this a "fact" because, in a world without mutability, it just is a fact that the numerical-reverser of 103 is 301. Since I work test-first, I like to think of programming as making false claims about the world of the program, then changing that world to make the claims true.

I use the arrow because I think of tests as examples. When people show snippets of code as examples, they often use an arrow to separate what you type from what you should expect to see.

The object on the right-hand side of the arrow can be a function, in which case the value of the left-hand side is passed to it. So this is also a fact:

 (fact
   (numerical-reverser 103) => odd?)

Midje comes with a selection of predefined checkers that are more useful for testing than odd? is.

Learning Midje

There is a tutorial introduction. Midje's features are described in the user guide. If anything there is unclear, ask in the mailing list or in the #midje channel on freenode. If you like videos of people programming, here's an 8-minute infomercial that concentrates on transitioning from clojure.test.

Contributors

  • Sean T. Allen
  • Alex Baranosky
  • Phillip Calçado
  • Stuart Halloway
  • Wilkes Joiner
  • Ben Mabey
  • Alan Malloy
  • Brian Marick
  • Bob Martin
  • Paudi Moriarty
  • Dmitri Naumov
  • Sébastien RoccaSerra
  • Harri Salokorpi
  • Greg Spurrier

About

Midje provides a migration path from clojure.test to a more flexible, readable, abstract, and gracious style of testing

License:MIT License