简体   繁体   中英

How to skip Clojure Midje tests

If I have a Clojure test suite written using the Midje testing framework, how do I skip individual tests? For example, if I were using JUnit in Java and I wished to skip a single test, I would add an @Ignore attribute above that test method. Is there an equivalent to this for Midje?

I realise that I could add a label to my test metadata and then run the test suite excluding that label. For example, if I labelled my test with ":dontrun", I could then run the test suite with "lein midje :filter -dontrun". This would involve a change to my Continuous Integration task that runs the test suite though, and I'd prefer not to do this. Is there an equivalent test label of JUnit's @Ignore so that I only need to change the Midje test code and not change my Continuous Integration task?

future-fact does what you want, just substitute (or wrap) your fact with it:

(future-fact "an interesting sum"
   (sum-up 1 2) => 4)

This will, instead of executing the test code, print a message during the test run:

WORK TO DO "an interesting sum" at (some_tests.clj:23)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM