Fork me on GitHub

For generative testing, is it a good idea to do stest/check on your functions as part of CI? If so, is there a common way to included them in your deftest's so they get called?


Apparently kaocha test runner will run specifications automatically, so this could be used as your test runner in the CI environment. Next weekl I'm going to try kaocha locally to run spec and then try kaocha on CircleCI. CircleCI has a kaocha orb which is a simple way to add common functionality to a build

😲 3

Nice, look forward to it!


Yes, Kaocha has first class support for this, it might still need improving though. If you have feedback please drop into #kaocha. Same thing for the Cirlce CI orb.

👍 3

I have a little helper function for doing this.

(defn check-ns-fdefs
   (check-ns-fdefs ns-sym-or-syms 1000))
  ([ns-sym-or-syms num-tests]
   (let [summary (-> (stest/enumerate-namespace ns-sym-or-syms)
                     (stest/check {:clojure.spec.test.check/opts
                                   {:num-tests num-tests}})
     (is (= (:total summary) (:check-passed summary))
         "generative check test failed, see output for details"))))
and then in a test namespace i can use
(deftest check-fdefs
  (check-ns-fdefs 'some.namespace 100))


not a perfect integration but does the job


Thanks, stealing this!