I just discovered midje, a testing library for clojure. Clojure already comes
with clojure.test
and it looks something like this:
An error looks like this
If you fix the problem it, will look like this:
With midje, it looks like
Error output looks like
If you correct it, it looks like
To get midje set up, you need to add this to ~/.lein/profiles.clj
Add this to project.clj
in your project root directory
Then you run the following to fetch the necessary files.
Once you have it set up, you can modify the file located in
test/<app>/midje.clj
directory (test/ttt/midje.clj
).
To get stubbing, you pass (provided <function-call> => <result>)
. For
example, assume foo
calls bar
, you can define: