One of these tools is Autotest, part of the Zentest package. The installation is simple:
gem install zentestWhile Zentest helps you write unit tests and synchronize your code with them, Autotest does exactly one thing: once started, it will re-run the tests whenever a file is saved. It's clever about it and only runs the tests that are deal with code in the saved files.
Eric Hodel, the creator of Autotest, explains his mode of work that led him to write Autotest:
Before I wrote autotest I was making fine-grained saves that were syntactically correct. I wrote autotest to automate the running of tests so I wouldn't have to choose which tests to run. My changes were so small that I spent an annoying fraction of my time editing my command line.This also mentions another benefit of running the tests: the code gets loaded and checked at every save. Compare this to modern Java IDEs, that run a big set of static analyzers such as syntax and semantic checkers over code, either incrementally or when a save happens. A similar level of automated checking is achieved with Autotest, while still leaving developers in their preferred editor.
A plugin interface also allows to extend Autotest. This is as simple as creating a ".autotest" file in the project root. In this, either
require
existing plugins, or write some custom handlers for various hooks:Autotest.add_hook :red { |autotest| p "Failures!" }The first parameter is the name of the hook this hooks into - in this case a test failure. This code will simply print out "Failures!" if the tests didn't pass. This also allows to invoke other tools, depending on the outcome of the tests or simply at every save. Plugins for integration with Emacs or acoustic feedback are available.
Have you heard of Autotest before? Are you considering to use it?