Fork me on GitHub

I have a fixture with fixture-type :each set up for running Playwright tests in nbb. I'm trying to access the test name from within the fixture, but calling clojure.test/*testing-vars* from within the fixture function returns an empty list. Is that expected? Is there another way to get at the test name from within the fixture?


@rahx1t I tested this with CLJS and the result there is the same. There is also an open issue for JVM Clojure for this: The way I usually solve this is via the report multimethod:

(require '[cljs.test :as t])

(defmethod t/report [::t/default :begin-test-var] [m]
  (println "====" (str  (ns-name *ns*) "/") (:name (meta (:var m)))))

(t/deftest foo
  (prn :foo))

(t/run-tests 'user)


Thanks for checking! Your suggestion above would allow us to access the test name within the t/report multimethod, but is there a way to get it from that multimethod into the fixture? Our use case is that we currently use fixtures to set up the browser instance for each test, and we store the browser instance inside of an atom that is then referenced from inside of the test. We're working on a way to parallelize tests, but that's failing at the moment. I suspect it might be due to tests running in parallel attempting to access the same browser instance stored inside of the atom. What I'd like to do is allow the fixture to store each test's browser instance within under its own keyed test-name After writing that out, I guess I'd also need to also figure out how to get the test name from within the test so I can access the correct browser from within the test. Makes me wonder if I should move away from a fixture for this use case and instead just use a setup function that i call before each test (


Also I guess this is not an NBB issue, so I'd be happy to post somewhere more appropriate 🙂


Maybe try #clojurescript for now, I'm afk for some 💤 now, but if it works in CLJS but not in NBB, do let me know - and also keep me posted about whether you figured it out

thanks3 1

Unfortunately I didn't get any new info for us about accessing tests in fixtures


That's a pity. You could maybe write a custom deftest macro which saves the name somewhere

💡 1