Skip to content

Test Runnersλ︎

A test runner is used to run one or more unit tests in a project and report the results. When there are failing tests, a test runners show details of how the failing test, showing actual and expected values.

Test runners may support specification testing with clojure.spec, checking data and functions conform to their specifications.

Test runners are called from either a Clojure editor, as a command line tool or within a continuous integration workflow.

Regularly run tests in a project to ensure implementations and design decisions made so far have not regressed.

Test runner Type Summary
cognitect-labs test runner clj Simple test runner
cljs-test-runner cljs Run all ClojureScript tests with one simple command.
Kaocha clj, cljs Full featured test runner
CIDER test runner clj CIDER built in test runner

CIDER test runner is ideal if using Emacs for Clojure development, as its build into CIDER.

Practicalli Recommends Kaocha test runner

Kaocha is a very feature rich test runner for Clojure and ClojureScript, BDD style cucumber tests, coverage and junit style reporting.

Practicalli Clojure CLI Config - test runner aliases

Practicalli Clojure CLI Config contains several aliases for test runners

  • :test/env adds the test directory to the class path and org.clojure/test.check library
  • clojure -X:test/run run Kaocha test runner
  • clojure -X:test/watch run Kaocha test runner in watch mode, running on file changes
  • clojure -M:test/cljs run Kaocha ClojureScript test runner
  • clojure -X:test/cognitect simple to use Cognitect test runner
  • :lib/kaocha adds Kaocha as a library to the class path, enabling Kaocha to run from an editor, e.g. Emacs Cider with Kaocha test runner

Practicalli REPL Reloaded aliases :repl/reloaded & :dev/reloaded also support Kaocha test runner