1.2.0 permalink Arrow_down_16x16
Wrap test runs in a fixture function to perform setup and
teardown. Using a fixture-type of :each wraps every test
individually, while:once wraps the whole run in a single function.

1 Example top

  • ; Assuming you have tests that need to be run with a database connection
    (defn db-fixture [f]
      (with-connection DB
        (f)))
    
    (use-fixtures :once db-fixture)
    
Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/test.clj:641 top

(defmulti use-fixtures
  "Wrap test runs in a fixture function to perform setup and
  teardown. Using a fixture-type of :each wraps every test
  individually, while:once wraps the whole run in a single function."
  {:added "1.1"}
  (fn [fixture-type & args] fixture-type))
Vars in clojure.contrib.test-is/use-fixtures: defmulti fn
Used in 0 other vars

Comments top

No comments for use-fixtures. Log in to add a comment.