Trying to use rcov+spec+cucumber with jruby-1.5.x, but not getting the right coverage numbers

Hi,

(I actually filed a bug at http://jira.codehaus.org/browse/JRUBY-5185,
but since it did not get updated in a week, I’m now trying my luck
with the users mailing list)

I’m currently evaluating jruby, but before moving my production code
from Windows/MRI to jruby, I would need my usual BDD tools
(cucumber/spec) and coverage tools (rcov) to work together well.

It’s unfortunately not the case with jruby-1.5.x, when apparently this
works with jruby-1.4.1. Here’s my testcase:

  • git clone git://github.com/cmichon/calculator.git
  • on a fresh jruby-1.5.x (I of course tried 1.5.5 today), install the
    following gems: gherkin, rcov, cucumber
  • in the calculator subdirectory, just launch ‘rake’ and observe the
    low coverage

In the coverage subdirectory (it’s a html report), I should get 100%
on all 4 files. I do not get this with any jruby-1.5.x, whereas with
jruby-1.4.x or windows MRI 1.8/1.9 it works fine.

I tried this on windows and linux/ubuntu, so I would classify this as
a regression versus jruby-1.4.1.

I would like to know if someone has already met this issue and maybe had
a fix ?

Thanks and best regards,

Christian

With RCov are you getting any coverage? If so is it like half?

In Jruby there is a fix slated for jruby 1.6 that fixes a Carriage
return issue where the RCov output looks like it is all double spaced.

If this is not the issue can you share more information with me?

Thanks!
Jay

On Thu, Nov 18, 2010 at 4:44 PM, Christian MICHON

On Fri, Nov 19, 2010 at 3:25 AM, Jay McGaffigan [email protected]
wrote:

With RCov are you getting any coverage? If so is it like half?

yes, and in some code it’s even less, like 25%

In Jruby there is a fix slated for jruby 1.6 that fixes a Carriage
return issue where the RCov output looks like it is all double spaced.

If this is not the issue can you share more information with me?

I tried to build the latest jruby with git/jdk/ant but it did not work.

Could you please point me to this commit ?

If you read carefully my email, I shared the testcase. I can send you
a more detailed email with screenshots etc… Just let me know.

Thanks for the pointers.

Christian

Christian,

On Fri, Nov 19, 2010 at 1:23 AM, Christian MICHON
[email protected] wrote:

I tried to build the latest jruby with git/jdk/ant but it did not work.

Could you please point me to this commit ?

here is the issue I was referring too:
http://jira.codehaus.org/browse/JRUBY-4922

If you read carefully my email, I shared the testcase. I can send you
a more detailed email with screenshots etc… Just let me know.

I did see your test case and was asking for the screen shots (or your
coverage directory) I am running on a mac so if it’s the issue I
referred to above I will get different results. Are you using all the
latest for gherkin cucumber and rcov?
I’ll go install those and try.

On Fri, Nov 19, 2010 at 12:49 PM, Jay McGaffigan [email protected]
wrote:

Could you please point me to this commit ?

here is the issue I was referring too:
http://jira.codehaus.org/browse/JRUBY-4922

thanks! interesting…

If you read carefully my email, I shared the testcase. I can send you
a more detailed email with screenshots etc… Just let me know.

I did see your test case and was asking for the screen shots (or your
coverage directory) I am running on a mac so if it’s the issue I
referred to above I will get different results. Are you using all the
latest for gherkin cucumber and rcov?
I’ll go install those and try.

The coverage figures should do (attaching pictures might break the
attachment policy of this mailing list):
27.50% features/step_definitions/calculator_steps.rb
50.00% features/support/env.rb
35.29% lib/calculator.rb
100.00% spec/calculator_spec.rb
41.67% TOTAL

Here’s my tdd gem list:
cucumber (0.9.4)
gherkin (2.3.0)
rcov (0.9.9)
rspec (1.3.0)


Christian

http://detaolb.sourceforge.net/, a linux distribution for Qemu with Git
inside !

On Fri, Nov 19, 2010 at 1:04 PM, Jay McGaffigan [email protected]
wrote:

Christian,

I ran specs and rcov and it indeed looks like the fix I pointed to you
should fix the issue you are seeing.

cool! thanks a lot…

in your test case if you open all your files with something like
textpad and convert the format to unix you should see your coverage go
up (I’m not saying this is the solution you should be using but more
as another check)

I see. I’ll change my autofile settings in vim to make sure all *.rb,
*.feature, *.spec end up in unix format then.

I’ll update jira accordingly. Too bad this will wait for jruby-1.6,
but at least it’s a very good start for me again.

I can migrate my production code to jruby-1.5.5 and trust the code
coverage now :slight_smile:

Regards,

Christian

Christian,

I ran specs and rcov and it indeed looks like the fix I pointed to you
should fix the issue you are seeing.

in your test case if you open all your files with something like
textpad and convert the format to unix you should see your coverage go
up (I’m not saying this is the solution you should be using but more
as another check)

Jay