run-tests runs tests in one or more namespaces and prints a final summary. With no arguments, it runs the current namespace. section 22.9
Use run-tests when you want namespace-level test execution with summarized results:
- Runs the current namespace when called without arguments. section 22.9
- Reports test, assertion, pass, failure, and error counts in a summary map. section 22.9
- Differs from test-ns by adding a summary at the end; run-all-tests handles all loaded namespaces and namespace filtering. section 22.9
Running the current namespace
(run-tests) ;; Testing running-tests ;; Ran 3 tests containing 3 assertions. ;; 0 failures, 0 errors. ;; {:test 3, :pass 3, :fail 0, :error 0, :type :summary} section 22.9
(ns running-tests)
(require '[clojure.test :refer [is deftest run-tests]])
(deftest a (is (= 4 (+ 2 2))))
(deftest b (is (= 4 (+ 2 2))))
(deftest c (is (= 4 (+ 2 2))))
(run-tests)
;; Testing running-tests
;;
;; Ran 3 tests containing 3 assertions.
;; 0 failures, 0 errors.
;; {:test 3, :pass 3, :fail 0, :error 0, :type :summary}
Inspect a complete namespace-level run and its printed summary. section 22.9
