As a newbie to clojure, I have used leiningen to create a sample project with
lein new app first-project
which gave me this directory
Start a REPL with lein repl
, then use require
(require '[clojure.test :refer [run-tests]])
(require 'your-ns.example-test :reload-all)
(run-tests 'your-ns.example-test)
I prefer to stay in the user
namespace, as opposed to changing it with in-ns
as mentioned by another answer. Instead, pass the namespace as an argument to run-tests
(as shown above).
I'd also recommend staying away from (use 'clojure.test)
; that is why I suggested (require '[clojure.test :refer [run-tests]])
above. For more background, read http://dev.clojure.org/jira/browse/CLJ-879