Simplecov: cucumber and rspec results not merged

Created on 10 Mar 2011  路  11Comments  路  Source: simplecov-ruby/simplecov

When I run

rake spec cucumber

and check the coverage I'm finding that the cucumber results overwrite the rspec results. This is easy to confirm because I have a couple of classes with 100% rspec coverage but only 50% cucumber coverage. I've tried setting

SimpleCov.use_merging true

but no luck. My understanding is that they should be merged by default, is this correct? If not how's it done?

I'm using ruby 1.9.2p136, rails 3.0.5 and simplecov 0.4.1

Most helpful comment

It seems @colszowka would like to say

# features/support/env.rb
SimpleCov.command_name 'Cucumber'
# spec/spec_helper.b
SimpleCov.command_name 'RSpec'

All 11 comments

Hi, sorry for the late response, I obviously forgot to reply :(

Is your test-suite long-running? If so, it's possible cucumber is slipping out of the merge timeout, which defaults to 10 minutes. If you need more, you can configure that using SimpleCov.merge_timeout 60 (i.e.). Check out the README section on result merging, things should be explained there.

Please let me know if this fixes the problem!

Had this problem too but made the mistake to add the SimpleCov.start line in spec/spec_helper.rb AND in features/support/env.rb. Only adding it to the spec/spec_helper.rb file solved the problem for me.

Hm, that's awkward. Does cucumber load spec_helper when using RSpec automatically in Rails?

Ditto for me. Thanks for the solution.

@colszowka I see something funny: cucumber before rspec coverage is aggregated, but not rspec before cucumber (cucumber overwrites).

| Runnning... | % covered |
| --- | --: |
| rspec | 83.81 |
| cucumber | 78.36 |
| rspec ; cucumber | 78.36 |
| cucumber ; rspec | 90.57 |

$ head -n2 features/support/env.rb spec/spec_helper.rb
==> features/support/env.rb <==
require 'simplecov'
SimpleCov.start 'rails'

==> spec/spec_helper.rb <==
require 'simplecov'
SimpleCov.start 'rails'

Had to switch the steps in CI to get the aggregated. Why could it be? Thanks for your gem!

What version of simplecov and ruby are you on? Did you try specifying SimpleCov.command_name explicitly?

Tute Costa [email protected] schrieb:

@colszowka I have a funny thing: cucumber before rspec are aggregated,
but not rspec before cucumber (cucumber always overwrites).

Runnning rspec alone: 83.81%
Running cucumber alone: 78.36%
Running cucumber after rspec: 78.36%
Running rspec after cukes: 90.57%

$ head -n2 features/support/env.rb spec/spec_helper.rb
==> features/support/env.rb <==
require 'simplecov'
SimpleCov.start 'rails'

==> spec/spec_helper.rb <==
require 'simplecov'
SimpleCov.start 'rails'

Had to switch the steps in CI to get the aggregated. Why could it be?
Thanks for your gem!


Reply to this email directly or view it on GitHub:
https://github.com/colszowka/simplecov/issues/29#issuecomment-24414931

Hi! I'm using simplecov v0.7.1, didn't try to specify the commands by hand. Sometimes I run it as part of guard (rspec && cucumber with some switches), and I tried this with: be rspec and be cucumber -f progress. I guess I should tell simplecov about the bundle exec ~ be alias?
Thank you!

First thing, please try 0.8.0.pre2. As a last resort, you can add:

# features/support/env.rb
SimpleCov.command_name = 'Cucumber'
# spec/spec_helper.b
SimpleCov.command_name = 'RSpec'

Semaphore App complained with cannot load such file -- lockfile (LoadError) (even though it's in the Gemfile.lock). didn't try command names yet. Thanks for your help.

It seems @colszowka would like to say

# features/support/env.rb
SimpleCov.command_name 'Cucumber'
# spec/spec_helper.b
SimpleCov.command_name 'RSpec'

I am still getting this issue with simplecov-0.11.2

I tried setting the command_name to various values.

I am getting different behavior depending I run rspec or cucumber first

Was this page helpful?
0 / 5 - 0 ratings

Related issues

juanbrein picture juanbrein  路  4Comments

DannyBen picture DannyBen  路  4Comments

doublephi picture doublephi  路  6Comments

MMore picture MMore  路  5Comments

vkodimut picture vkodimut  路  6Comments