I have a test suite in Clojure using core.test that I run by starting by server, starting emacs, connecting to my REPL using Cider, and evaluating
(run-tests 'im.user-test
'im.organization-test
'im.group-test
'im.content-test
'im.orders-test
'im.db-test
'im.collection-test)
The problem is to run the above, I need to first open up each one of those files and evaluate them in the REPL before the above will work because the repl doesn't know about these classes. If I try to require the test without going to the file and evaluating it, I get the error "Could not locate im/orders_test__init.class or im/orders_test.clj on classpath. Please check that namespaces with dashes use underscores in the Clojure file name."
Each of my test files is in /test and for example my main test file looks like.
(ns im.core-test
(:import datomic.Util)
(:require
[im.db :as db]
[im.models.user :as user]
[clojure.java.io :as io]
[clojure.test :refer :all]
[clj-http.client :as client]
[datomic.api :as d]
[environ.core :refer [env]]))
(defn reload-db [test-fn]
(with-redefs [db/uri db/testuri]
(db/reload-db)
(with-redefs [db/conn (d/connect db/testuri)]
(test-fn))))
(comment
(run-tests 'im.user-test
'im.organization-test
'im.group-test
'im.content-test
'im.orders-test
'im.db-test
'im.collection-test))
and for example a test file would look like this
;; app_root/test/orders_test.clj
(ns im.orders-test
(:require
[im.models.order :as o]
[im.db :as db]
[clojure.test :refer :all]))
So, is there a way to automatically load all the test classes, or am I going about this entirely wrong in general?
Aucun commentaire:
Enregistrer un commentaire