I don't get autotest. It seems to simply runs the equivalent of "rake
spec" over and over again without pause, which completely swamps a CPU
core and abuses the disk. When you make a change to a file, rather than
manually running a spec and immediately confirming that it works, you
have to instead bounce over to the terminal running autotest and then
watch and wait until it finally gets around to running the spec that you
actually care about to see if it works before it scrolls off the screen,
or somehow wait for however long you think is right (?!) for the
non-presence of a warning message to assume your code runs. This seems
like a complete waste of time and resources.
If someone can explain the value of autotest, I'd appreciate it.
-igal
My two biggest problems with autotest is that it doesn't rerun enough
tests sometimes (eg, when I change a partial or something in lib/ - I
know I can help its guesses, but haven't done so often enough), and that
when a test raises an exception, the emitted stacktrace swamps the
output (something smarter could elide everything below the test, for
instance; so far, though, I've avoided the temptation to go off and
write my own client for its hooks).
...Bryan
As soon as you save a file, autotest will run the corresponding dependent tests.
For you Mac folks, there is a Leopard-only alternative, though I
haven't actually gotten it to work on my machine.
http://rails.aizatto.com/2007/11/28/taming-the-autotest-beast-with-fsevents/
-Sam
I've let autotest run for 10 minutes, and it completely, continuously
swamps one of the CPU cores. I believe the problem is that I'm using svn
and hg, which means that I have ~6000 total files in my Calagator
checkout directory. Using strace to watch the autotest process, I can
see it poking at every single one of those to run stat to check the
timestamps. This is a lousy way to do things. Unfortunately, Ryan Davis
has refused to support efficient kernel-level filesystem notification
systems, such as inotify.
Autotest apparently runs much more reasonably when it has fewer files to
monitor. Ryan claims it's possible to tell autotest to ignore stuff
(e.g. .hg, .svn, .git), but my Google-fu is weak and I absolutely can't
figure out how to do this, even after reading the rdoc and scanning
through autotest's code.
Ideas?
-igal
Awesome. That configuration file, plus an extra line for ignoring .hg
directories, completely solves my problem. The autotest process now
consumes just a few CPU cycles and picks up changes promptly because
it's only scanning the relevant files.
Why the heck aren't these exclusions in there by default? Why isn't the
documentation clearer about this? Why did Ryan decide to call these
"exceptions" -- a rather common term with a different meaning -- instead
of something like "exclude" or "ignore"? Ugh.
Thank you for the help, you've helped make this tool usable for me.
-igal
PS: I've committed the .autotest file to the application's Rails root.
Running autotest from there will load the contents of the file so
everyone else can take advantage of these exclusions.