use-fixtures registers fixture functions for a clojure.test namespace, arranging necessary side effects before and after tests. Fixtures support per-test execution with :each or one-time namespace setup with :once. section 22.9
Run setup around every test
(defn setup [tests] (println "### before") (tests) (println "### after")) (use-fixtures :each setup) (deftest a-test (is (= 1 1))) (deftest b-test (is (= 1 1))) (run-tests) ;; ### before ;; ### after ;; ### before ;; ### after ;; Ran 2 tests containing 2 assertions.
A fixture receives a zero-argument test runner, calls it between setup and cleanup, and thereby recreates conditions such as files or database tables. Fixtures do not run when test-ns-hook is defined. section 22.9
