This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-01-03
Channels
- # aleph (2)
- # announcements (13)
- # babashka (7)
- # beginners (36)
- # calva (26)
- # cider (11)
- # circleci (13)
- # clj-kondo (15)
- # clojure (105)
- # clojure-europe (79)
- # clojure-nl (3)
- # clojure-uk (6)
- # clojurescript (17)
- # conjure (4)
- # core-logic (2)
- # cursive (10)
- # data-science (5)
- # datalevin (11)
- # datalog (14)
- # eastwood (6)
- # emacs (2)
- # figwheel-main (1)
- # fulcro (34)
- # google-cloud (1)
- # graphql (3)
- # introduce-yourself (7)
- # jobs (1)
- # leiningen (17)
- # lsp (46)
- # malli (2)
- # minecraft (3)
- # missionary (19)
- # off-topic (31)
- # other-languages (49)
- # polylith (2)
- # portal (5)
- # practicalli (1)
- # quil (77)
- # releases (1)
- # remote-jobs (1)
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.
Here is one example I did of defining a clojure.test :begin-test-var
and :end-test-var
: https://github.com/clojure/core.rrb-vector/blob/master/src/test/clojure/clojure/core/rrb_vector/test_utils.clj#L52-L64
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.