This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-01-04
Channels
- # announcements (8)
- # babashka (78)
- # beginners (15)
- # calva (6)
- # cider (12)
- # clerk (1)
- # clojure (46)
- # clojure-dev (13)
- # clojure-europe (15)
- # clojure-norway (5)
- # clojure-portugal (1)
- # clojure-uk (1)
- # clojurescript (23)
- # clr (29)
- # conjure (4)
- # core-async (10)
- # cryogen (1)
- # data-science (8)
- # hoplon (4)
- # hyperfiddle (11)
- # introduce-yourself (3)
- # jobs (6)
- # kaocha (12)
- # lsp (11)
- # malli (8)
- # membrane (11)
- # releases (1)
- # shadow-cljs (20)
- # spacemacs (47)
- # tools-deps (1)
Hi. Is there a way to run tests N times using kaocha? I need to run tests from command line without JVM restart.
you can do this with a fixture tho i don't recommend it: (defn n-times [n] (fn [f] (doseq [_ n] (f))))
and then (use-fixtures :each (n-times 100))
in the namespace of your choosing, then run kaocha selecting the single test
Personally I would use a shell script, a for loop that calls the test runner each time. A separate script avoids changing oradding complexity to existing code
Could also be done with a tools.build function, which would use a single jvm instance to run the test multiple times
@frank I need to test I/O library via network with some complex state. Multiple test run helps me to find bugs in library implementation. Practically it helps to reorder network packets.
The solutions already mentioned are simpler, but you could do this with a plugin or a hook. There's an existing Kaocha plugin to rerun tests that you could probably use as a basis for a run N times plugin: https://github.com/AndreaCrotti/kaocha-retry
@U01FJUDL57C thanks. I tried it, but it has no effect - no retries. May be plugins interfere each other.
@U097654L8 Hmm, consider reporting it as an issue. Note that this plugin only retries tests when they fail fails.
Oh. I expected retries when all tests are passed and stop retry if any fails.