Midje icon indicating copy to clipboard operation
Midje copied to clipboard

Implement the clojure.test protocol

Open bbatsov opened this issue 9 years ago • 6 comments

Basically this would allow tools like cider-test to run midje tests, which would benefit a lot of Clojure developers. More details - https://github.com/clojure-emacs/cider#using-cider-test-with-alternative-test-libraries and https://github.com/clojure-emacs/cider/issues/1606

bbatsov avatar Mar 19 '16 14:03 bbatsov

I'm happy to entertain pull requests. But note: clojure.test is a least-common-denominator model for testing, equivalent to the original Junit. Should Cider restrict users to that? - forcing all testing frameworks into that mold - or should it actually engage with the differing approaches of other frameworks? That is: where were Midje users when cider-test was solidified?

marick avatar Sep 05 '16 22:09 marick

Sorry for the necropost, but as an user of both Midje and Cider, this feature would really benefit me. For it to be compatible with Cider, would the Midje lib have to implement clojure.test protocols for each checker and fact macro?

PabloReszczynski avatar Jun 12 '18 21:06 PabloReszczynski

Hey @PabloReszczynski, always good to hear from users regarding what would be useful to them.

I briefly looked into this in the past and I didn't see a clear path forward; something about needing to extend fact to allow them to be named, like clojure.test allows. This sorta goes against the current way Midje is constructed.

That said, I'll try and get some time soon to dive into this again and re-assess how this might be implemented.

philomates avatar Jun 13 '18 08:06 philomates

The last couple of times I looked, I concluded that clojure.test model (later codified in clojure.test) couldn't represent Midje tests. The opposite I think is true.

That would suggest expanding the protocol to be a superset, rather than a strict subset, of the available testing tools.

marick avatar Jun 25 '18 23:06 marick

Should Cider restrict users to that? - forcing all testing frameworks into that mold - or should it actually engage with the differing approaches of other frameworks? That is: where were Midje users when cider-test was solidified?

I guess I saw this pretty late, but for the sake of completeness let me answer. We never intended to restrict people to clojure.test - it happened that someone contributed functionality to support clojure.test early on (mostly as a replacement for the popular at the time clojure-test-mode). Afterwards people started asking for support for other tools, but we realized we can't just add dependencies to every test library that exists to cider-nrepl - we either needed some shared protocol they needed to implement or the support for them had to packaged as CIDER extensions. A proper protocol that all such libraries would implement would be an idea solution, but no one really expressed the desire to work on one, so we were left with only a single option - suggest people to implement the clojure.test protocol as some compromise (or just adapt the cider-test functionality and distribute some extension).

I certainly would love to see CIDER have a native integration with every test library that exists, but that's a lot of work as it stands, and our resources are tiny.

bbatsov avatar Jun 26 '18 11:06 bbatsov

At the first clojure conj, I proposed that the three (at the time) test frameworks implement some commonality. Found no interest. I think that was a missed opportunity.

However, to be honest: communities that have supported more than one "official" framework don't seem to have benefited all that much. It's better when the dominant framework absorbs the others. It's unfortunate that clojure.test was so minimal compared to what other languages built on.

marick avatar Jun 26 '18 23:06 marick