Saturday, October 02, 2010

Watchr is teh awesome

Autotest spoiled me for immediate feedback during the development cycle. So as I was going through the Relevance functional koans for Clojure, I had a little Watchr script continually re-running the tests from the exercise at every file save. This is what that script looked like:

There's barely anything there. All it does is run the "" script that comes with the koans whenever a ".clj" file in anywhere under the "src/koans" directory is saved. It's just a simple little thing, but so very useful.

I later discovered a fork of those koans (from David Laing) that adds JavaScript lessons. So I adapted my watchr script to start the KoansRunner file in Safari, reload the test page, and scroll to the bottom on every save of the JavaScript files.

I can't say enough about the value of rapid feedback from automated tests during the learning/development cycle. The absence of context switching to manually rerun the tests is great WIN.

1 comment:

Colin Jones said...

That's a great idea. Lazytest, a new testing framework for Clojure, has a watchr/autotest-like runner built in. I might convert the koans to use that rather than clojure.test, because it really is a bit of a hassle to run tests as things are - people are always disappointed they can't easily run them from their IDE without some setup.

Thanks for the tip!

p.s. I'd love to get some patches to add more koans now that you're done going through them! :)