<div>
<div>
<span>Scroll down.<br>
</span>
<span><br>-- <br>Hakan Ensari<div>http://hakanensari.com<br></div><br></span>
<p style="color: #a0a0a0;">On Wednesday, 16 February 2011 at 22:41, Joel Chippindale wrote:</p>
<blockquote type="cite" style="border-left-style:solid;border-width:1px;margin-left:0px;padding-left:10px;">
<span><div><div>I tried out and then ditched spork at the end of 2009. The reasons for trying to get it running were the same as yours and the reasons for ditching it were the things that it looks like guard is meant to resolve (i.e. I found it to easy to end up running tests against stale codei), so I'd be very interested if you make any progress with this.<div>
<span></span><span></span><br></div></div></div></span></blockquote><div>This is similarly my second foray.</div><div><br></div><div>This fork that I stumbled upon thanks to a SO post does work. Yay!</div><div><br></div><div>https://github.com/irohiroki/guard-spork</div><div><br></div><div><div>Then, to get Cuke running with Spork, Guard, and nested folders, the yaml file needs some massage:</div><div><br></div><div>https://gist.github.com/822965</div></div><div><br></div><div>The above is not fully functional. I don't remember now what was missing, though.</div><div><br></div><div>Some more detail and links here:</div><div><br></div><div>http://stackoverflow.com/questions/4958325/how-do-i-ruby-debug-in-a-spec-or-feature-if-i-am-using-guard-and-spork</div><div><br></div><div>Overall, it feels guard-spork and so on are a bit of a moving target for now, so perhaps it's best to wait a few weeks for changes to settle.</div><div><br></div><div>The below are cool tweaks. Unfortunately, I'm on 1.9.2 and all MongoDb and Redis so can't apply them verbatim. Thanks for sharing though ;)</div><blockquote type="cite" style="border-left-style:solid;border-width:1px;margin-left:0px;padding-left:10px;"><span><div><div><div></div><div>In the meantime have two other suggestions that may improve your rspec/cucumber test performance<br><div><br></div><div>1. Skip dropping and rebuilding the database between cucumber runs.</div><div><br></div>
<div>Typically in development I run a small set of cucumber tests (by tagging them @wip). The rake task 'cucumber:wip' can be used to run these but this task depends on ''db:test:prepare' to drop and rebuild the database as part of the run.</div>
<div><br></div><div>I have found that our our project roughly half the time spent running 'cucumber:wip' is taken up with this database reset. Since the database rarely needs to change (in terms of schema) and our cucumber set up already ensures that no data leaks between scenarios, I run a modified version of the 'cucumber:wip' task, like the one below, which does not reset the database to speed up the tests (giving a performance improvement of roughly 50% on smaller numbers of scenarios.</div>
<div><br></div><div><div><font class="Apple-style-span" face="'courier new', monospace"> Cucumber::Rake::Task.new(:wip_fast, 'Run features that are being worked on WITHOUT running db:test:prepare') do |t|</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"> t.binary = vendored_cucumber_bin</font></div><div><font class="Apple-style-span" face="'courier new', monospace"> t.fork = true # You may get faster startup if you set this to false</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"> t.profile = 'wip'</font></div><div><font class="Apple-style-span" face="'courier new', monospace"> end</font></div></div>
<div><br></div><div>2. Tune your ruby garbage collection.</div><div><br></div><div>Ruby process may be spending a lot of time in garbage collection when you are running your tests. Typically you are CPU bound rather than memory bound when running tests and so ideally you would like ruby garbage collection less often than perhaps it does out of the box.</div>
<div><br></div><div>I use REE which makes it very easy to tune garbage collection (see <a href="http://www.rubyenterpriseedition.com/documentation.html#_garbage_collector_performance_tuning">http://www.rubyenterpriseedition.com/documentation.html#_garbage_collector_performance_tuning</a>) and find that the following settings improve the performance of running the cucumber scenarios on our project by 25% or more.</div>
<div><br></div><div><font class="Apple-style-span" face="'courier new', monospace"> RUBY_HEAP_MIN_SLOTS=1250000</font></div><div><font class="Apple-style-span" face="'courier new', monospace"> RUBY_HEAP_SLOTS_INCREMENT=500000</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"> RUBY_HEAP_SLOTS_GROWTH_FACTOR=1</font></div><div><font class="Apple-style-span" face="'courier new', monospace"> RUBY_GC_MALLOC_LIMIT=30000000</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"> RUBY_HEAP_FREE_MIN=100000</font></div><div><br></div><div>J.</div><div><br><div class="gmail_quote">On 11 February 2011 10:15, Hakan Ensari <span dir="ltr"><<a href="mailto:hakan.ensari@papercavalier.com">hakan.ensari@papercavalier.com</a>></span> wrote:<br><blockquote type="cite"><div><div>
<div>I have a question to you all LRUGers.</div><div><br></div><div><span>Being fed up with the excruciatingly slow boot of Rails when running tests, I finally got around to setting up Spork and Guard in a project. </span>After some fiddling, everything seemed wired up. Or so I thought.</div>
<div><span><br></span></div><div><span>For a starter, I cannot do ruby-debug if I start with `bundle exec guard.` </span>It does work if I start spork without guard, but what's the point of spork without guard?</div><div>
<br></div><div>Second bummer: Spork doesn't handle nested Cucumber feature folders out of the box. The answer to this I suppose is easier and involves some magic incantation in the `cucumber.yml` file requiring the feature folder etc., but I was so fed up with #1 that I did not get around figuring out the fix for this either.</div>
<div><br></div><div>Anyone with a functional relationship with the above tools care to share their story?</div><div><br></div><div>The gems involved -</div><div><br></div><div> * rspec (2.5.0)</div><div><div> * cucumber (0.10.0)</div>
<div> * cucumber-rails (0.4.0.beta.1 f3002fa)</div><div><div> * guard (0.3.0)</div><div> * guard-cucumber (0.2.3)</div><div> * guard-rspec (0.1.9)</div><div> * guard-spork (0.1.4)</div><div><div> * spork (0.9.0.rc3)</div>
</div></div></div><div><br></div><div><span>-- <br>Hakan Ensari<br><a href="http://hakanensari.com" target="_blank">http://hakanensari.com</a><br></span>
</div>
</div><br>_______________________________________________<br>
Chat mailing list<br>
<a href="mailto:Chat@lists.lrug.org">Chat@lists.lrug.org</a><br>
<a href="http://lists.lrug.org/listinfo.cgi/chat-lrug.org" target="_blank">http://lists.lrug.org/listinfo.cgi/chat-lrug.org</a><br>
<br></div></blockquote></div><br></div></div>
</div><div>_______________________________________________<br>Chat mailing list<br><a href="mailto:Chat@lists.lrug.org">Chat@lists.lrug.org</a><br><a href="http://lists.lrug.org/listinfo.cgi/chat-lrug.org">http://lists.lrug.org/listinfo.cgi/chat-lrug.org</a><br></div></div></span>
</blockquote>
<div>
<br>
</div>
</div>
</div>