leiningen 2022-01-03

is there a way to impose order on the test namespaces that are run with lein test?

Not that I am aware of. I think people using clojure.test typically make any ordering constraints on order of steps, e.g. setup, do-thing1, do-thing2, do-thing3, teardown, all within a single test, never between differently named tests.

clojure.test does have a mechanism to call a function before each test is run, and/or when a test is finished.

also is there a way to run a specific function before all tests are run, not before the tests in the namespace?

How to use test-ns with lein test?

Lein test simply runs all tests in all namespaces recursively in the given directory

note that I mean run a function before all tests are run in all ns with lein test

Did you see my replies to your previous message? There is a link to an example of how to do that if you are using clojure.test

Let’s say I create this:

(defmethod test/migrations :begin-test-var [m]
    (user/start)
    (user/reset-db))
Where do I put this in my lein project and how to call it before lein test?

I’m not making myself clear

I mean this: 1. run fn-1 and fn-2 2. Run all tests in all namespaces NOT 1. Run fn-1 Run fn-2 2. Run test 1 3. Run fn-1 Run fn-2 4. Run test 2 …

I do not know of a way built into clojure.test to do that

except to change how you structure your tests in your namespaces, so there is only one deftest

but I'm not necessarily the most expert on clojure.test capabilities, either.

You can look into test ns hooks.

Which is actually a feature of clojure.test I believe.