• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Extending clojure unit tests

 
jay vas
Ranch Hand
Posts: 407
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys (btw thanks shawn for keeping the clojure thread alive !!!) :

I'm totally new to macros and extending clojure, so concrete examples would really help :

My problem : I have 3 types of unit tests - fail, succeed, and warning. However, default Leiningan test only seems to have 2 outputs : failures, and successes.
My happiness : I noted that the clojure.test package has a great API, and is really modular. Thus, I know my problem has a solution !
My new problem : How can I extend my unit tests to have 3 result types, and how can I integrate these result types with my build ?

In particular I want to know

1) How is success/failure defined/determined by clojure.test and how is this communicated to external programs (i.e. like jenkins) which automate clojure builds ??? We are planning on automating our builds, and I need to know how clojure conveys success/failure (for that matter, I don't even know how ANT defines/conveys success/failure, and I use ANT every day, so I have a long way to go as a build engineer) .

2) How can I define a "third" test result for tests that don't pass, but dont fail either (for example, in PHP, you can "skip" a unit test)??? I assume clojure might offer a flexible way of defining new test outputs. In particular I found a success? function uses a map.... But its not quite clear how it is used or extended to me.

Thanks !!!

 
Sean Corfield
Ranch Hand
Posts: 302
10
Clojure Linux Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From an automated build's point of view there are only successful tests and failing tests. There's no third state. I'm not sure what you're trying to achieve there?

For skipping tests, look at Leiningen's test selectors, described here: https://groups.google.com/group/leiningen/browse_thread/thread/e421df80db71b2ce

You can generate JUnit-compatible output (in theory) using the lein-test-out plugin: https://github.com/arohner/lein-test-out (caveat: I have not had much success integrating this with ant yet).
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic