Jake McCrary

Quicker Feedback From Failing Tests

Over the last couple of years I’ve desired quicker feedback from my Clojure tests. This has resulted in the development of lein-autoexpect and more recently lein-test-refresh. Each tool monitors your project for changes and on change uses tools.namespace to reload your code and then reruns either your expectations or clojure.test tests. Using tools like these has changed my development process.

Version 0.5.0 of lein-test-refresh was released last week. This release enables even quicker feedback by tracking which tests fail and after reloading your code it runs those tests first. Only when your previously failed tests pass does it then rerun all of your tests.

lein-test-refresh has had quite a few features added since I last wrote about it. The readme will always have the latest list but as of the time of writing this they include:

  • Reloads code and reruns tests on changes to your project’s code.
  • Runs previously failing tests first.
  • Supports custom notification commands.
  • Built in Growl support.
  • Can notify after test success and failure or just after failure.
  • Supports a subset of Leiningen test selectors.
  • Reports on your tests running time.

I don’t have enough experience with the new lein-test-refresh to say how having failing tests will affect my development practices. I don’t expect this to change my development practices but it will enable quicker feedback. Quick feedback cycles are what it is all about.

Acknowledgments

Most of the ‘rerun failed tests first’ feature was hashed out and spiked during a mob programming session organized by Zee Spencer. This happened at a company conference put on by Outpace in Las Vegas. Many developers were involved but two that most influenced the final result were Joel Holdbrooks and Timothy Pratley.

Looking forward to the next article? Never miss a post by subscribing using e-mail or RSS. The e-mail newsletter goes out periodically (at most once a month) and includes reviews of books I've been reading and links to stuff I've found interesting.

Comments