[rspec-users] Cucover: coverage-aware 'lazy' cucumber runs

Matt Wynne matt at mattwynne.net
Sun Apr 12 12:27:58 EDT 2009

On 10 Apr 2009, at 23:40, Ashley Moran wrote:

> On 10 Apr 2009, at 19:39, Matt Wynne wrote:
>> It's feasible I think, and something I'd definitely like to add for  
>> my own purposes eventually. I think RCov works with JRuby too,  
>> though I've not tried it myself.
> Hmmm - the JRuby process is just running Cucumber, where my Merb  
> code is all in MRI.  It's the MRI process that needs to run RCov,  
> right?  (I've never used it beyond inspecting its coverage reports.)

Ah right, OK, that might make things a little simpler then :)

After a few iterations, I settled on Cucover using Rcov as a  
library[1], slipping in a call to Rcov::CallSiteAnalyzer#run_hooked  
into the Cucumber AST. This makes it easy for me to pull out just the  
data I need from the Rcov result objects, rather than trying to parse  
the Rcov binary's output.

>> The code is really pretty simple so if you want to pull it down and  
>> take a look maybe we can have a chat directly about it would work.  
>> I think the problem would be around how the external process gets  
>> started (and it's coverage observed) but your situation should be  
>> much easier than a selenium setup where the process could be on a  
>> remote box.
>> Just to be clear, are you calling Ruby to call Cucumber to call  
>> JRuby to call Celerity, as you seem to be suggesting?
> Currently what I've got is a rake file running in MRI, that calls  
> jrake, that runs the Cucumber task in the JRuby process.  The  
> indirection there just so I can type `rake features`, as Merb won't  
> (currently) start up in JRuby, which prevents me from typing `jrake  
> features`.
> Part of my env.rb involves some code I wrote that wraps  
> daemon_controller to start my webapps.  I have a separate "features"  
> environment that is started on demand, so it's only available when  
> Cucumber is running.

So it sounds like what would need to happen is for those  
daemon_controller spawned webapps to be run with coverage, and that  
coverage passed back to Cucover, right? This sounds like an  
interesting challenge :D


Matt Wynne

More information about the rspec-users mailing list