This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-07-04
Channels
- # announcements (6)
- # babashka (5)
- # beginners (57)
- # biff (6)
- # business (32)
- # clj-together (1)
- # clojars (10)
- # clojure (56)
- # clojure-europe (76)
- # clojure-nl (4)
- # clojure-norway (40)
- # clojure-serbia (1)
- # clojure-spec (5)
- # clojure-uk (10)
- # clojurescript (3)
- # cursive (12)
- # data-science (1)
- # datascript (4)
- # datomic (35)
- # docs (4)
- # emacs (28)
- # events (5)
- # hyperfiddle (9)
- # matrix (1)
- # off-topic (28)
- # practicalli (4)
- # re-frame (14)
- # shadow-cljs (2)
- # testing (5)
Hello everyone, I am using the clojure/test library and I am running my tests with a fixture that grabs a snapshot at the end of every test. In the fixture I want to get the name of the test so I can make each snapshot distinguishable. What would you folks recommend?
@eitan In the https://github.com/exercism/clojure-test-runner/blob/f8645948acec40ee0069ce794daede2e12631915/test-runner.clj#L111, we do this by overriding clojure.test's reporting methods with ones that capture the results in an atom. There is a dynamic var called clojure.test/*testing-vars*
which keeps track of the vars being tested. Depending on what data you need that might be enough, but keep in mind that the order is randomized
What you suggested worked. I overwrote the reporting method for :begin-test-var so it stores the name of the test in an atom. I then used what was in the atom for each screenshot I took.
cool!