Watchr is a Rubygem to monitor file changes. It can run your unit tests (or pretty much anything else you want) on the changed files.
This script is set up to perform the entire test suite in the 'unit/' folder of the Yii PHP framework every time a .php file in the Yii folder has changed. It uses growl notifications (growlnotify) to display a green OK or a red X to signal if the tests succeeded or failed.
Growl might be Mac OS X only. There might be similar notification service apps on other platforms.
- watchr gem (gem install watchr)
- Yii (http://www.yiiframework.com/)
- PHPUnit (https://github.com/sebastianbergmann/phpunit/)
- growlnotify (http://growl.info/, included in 'Extras' folder in download)
- Install all the requirements
- Copy the watchr.rb script in the root of your Yii application (the one with the subfolders and framework).
- Copy the .watchr_images folder into your home folder.
- Run 'watchr watchr.rb' in the root of your Yii application.
For big test suites, it would be nice to only perform tests on the files that have actually changed. In my project, this is currently not an issue, as the entire test suite runs in a few seconds. If anyone wants to implement that, I'd be interested.