Clojure Testing

Aug 2, 2016

Clojure start-up time can be expensive especially when using ClojureScript. Here’s a couple items I’ve used to reduce start-up test execution time.

Run all namespaces

1
lein test                                             

Run a specific namespace

1
lein test :only cc.jbx.blog                                       

Run a test case

1
lein test :only cc.jbx.blog/test-rendering-post

In a REPL

1
2
3
4
5
6
7
8
9
(use 'clojure.test)
(defn test-blog []
"""
This is just a little helper function to make reloading and running the tests more efficient.
"""
(require 'cc.jbx.blog :reload-all)
(run-tests 'cc.jbx.blog))

(test-blog)

tags: [ clojure testing ]