Hi, I’m mostly quite happy using autotest with rspec, but there’s one
thing that’s been bothering me, and as my test suite grows larger it’d
becoming more painful.
Autotest re-runs the entire suite whenever a spec that had previously
failed passes for the first time. I find that incompatible with
writing tests first in classic TDD style. I write the test which fails
(because there’s no implementation yet), and then just implement the
method and watch it pass. But now autotest decides to re-run the
entire test suite, which takes a couple of minutes, and in the
meantime I’m stuck waiting to see if my next spec will pass or not.
Is it possible to change that behavior somehow, so that it doesn’t re-
run the entire suite every time?
Thanks,
Paul
On Fri, Feb 22, 2008 at 11:18 AM, Paul D. [email protected]
wrote:
meantime I’m stuck waiting to see if my next spec will pass or not.
Is it possible to change that behavior somehow, so that it doesn’t re-
run the entire suite every time?
Interesting idea. How would you want autotest to decide when to run
everything?
In the end, this belongs in ZenTest, not RSpec, but we can certainly
discuss it here 
Cheers,
David
On Feb 22, 2008, at 12:18 PM, Paul D. wrote:
meantime I’m stuck waiting to see if my next spec will pass or not.
Is it possible to change that behavior somehow, so that it doesn’t re-
run the entire suite every time?
I had the same problem - and decided that Autotest wasn’t for me.
I’m much smarter than autotest, so I know which files I should be re-
running, and when.
If, as David suggests, you can figure out a good strategy on when to
rerun the full suite, continue to use it (just modify the mappings
in ~/.autotest (or RAILS_ROOT/.autotest)). Otherwise, autotest is
pretty much out (unless you want to work on Deeptest, or
SpecDistributed).
Scott
On Sat, Feb 23, 2008 at 6:10 AM, David C. [email protected]
wrote:
entire test suite, which takes a couple of minutes, and in the
meantime I’m stuck waiting to see if my next spec will pass or not.
Is it possible to change that behavior somehow, so that it doesn’t re-
run the entire suite every time?
Interesting idea. How would you want autotest to decide when to run everything?
In the end, this belongs in ZenTest, not RSpec, but we can certainly
discuss it here 
Would be interesting to have the ability to run multiple tests at once.
For example, one test runner could repeatedly run (or once a minute,
or whatever) the entire test suite. And one test runner could run the
related tests for the file you change.
Perhaps two autotest instances, running off different test databases?
On Sat, Feb 23, 2008 at 10:39 PM, Joe Van D. [email protected]
wrote:
For example, one test runner could repeatedly run (or once a minute,
or whatever) the entire test suite. And one test runner could run the
related tests for the file you change.
Perhaps two autotest instances, running off different test databases?
That’s exactly my approach. I have 3 separate tests running, of which
“rake test:recent” is run whenever the files change, and the re-check
interval is just one second. However, “rake test:units” and “rake
test:functionals” – sorry, my tests are still in Test::Unit
–
check the files only once a minute now.
I use rstakeout.rb for the task. I added simple file locking support
to prevent multiple instances running on the same time when requested
(by default, it allows concurrency).
See this pastie: http://pastie.caboo.se/pastes/152014
and use is as follows:
save this as mystakeout.sh or similar
ruby rstakeout.rb -t 1 --sync “rake test:recent” “spec//*.rb"
"app//.rb"
ruby rstakeout.rb -t 60 --sync “rake test:all_but_integration”
"spec/**/.rb” “app/**/*.rb”
…or something.
–
“One day, when he was naughty, Mr Bunnsy looked over the hedge into
Farmer Fred’s field and it was full of fresh green lettuces. Mr
Bunnsy, however, was not full of lettuces. This did not seem fair.”
– Terry Pratchett, Mr. Bunnsy Has An Adventure