The clojure.test/report multimethod is what you're looking for. You can add
a method for the :begin-test-var or :end-test-var types:
(defmethod clojure.test/report :begin-test-var [m]
(println (-> m :var meta :name)))
The report var itself is dynamic, so you can override it that way if you
want to make things a little cleaner:
(defmulti custom-report :type)
(defmethod custom-report :default [m]
(clojure.test/report m))
(defmethod custom-report :begin-test-var [m]
(println (-> m :var meta :name)))
(binding [clojure.test/report custom-report]
(clojure.test/run-all-tests))
- James
On 1 September 2015 at 06:51, Mayank Jain <[email protected]> wrote:
> Hi,
>
> I would like clojure.test to print name of each test as it runs. Currently
> it only prints on failure.
> I would like it to print even when it passes.
> Is there a way to do this? Maybe through writing some each fixture?
>
> Currently I have written this function
>
> (defn print-test
> []
> (println (last (map #(:name (meta %)) *testing-vars*))))
>
> And I add this print-test to each test at the top.
>
> (deftest valid-test
> (print-test)
> (let []
> ....))
>
>
> Is there a better way?
>
> Thanks.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to [email protected]
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.