Cedric Martin
Cedric Martin

Reputation: 6014

How to run Clojure code before each "lein test"?

How can I run some Clojure code before tests in test files are run?

I'd like to have some piece of Clojure code to be called either before running all the tests (say by doing lein test at the root of my lein project) or before running indidual tests. I don't want to duplicate that piece of code in several .clj files.

How can I do that? Is there some "special" .clj file that can be run before any test is run?

Upvotes: 2

Views: 1088

Answers (1)

RedDeckWins
RedDeckWins

Reputation: 2121

You probably want to use test fixtures. This question has a good answer on it that can get you started.

Upvotes: 3

Related Questions