simplecov icon indicating copy to clipboard operation
simplecov copied to clipboard

cucumber and rspec results not merged

Open opsb opened this issue 15 years ago • 11 comments

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

opsb avatar Mar 10 '11 17:03 opsb

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!

colszowka avatar Apr 02 '11 12:04 colszowka

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.

dkln avatar Apr 13 '11 06:04 dkln

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

colszowka avatar Aug 01 '11 15:08 colszowka

Ditto for me. Thanks for the solution.

softwaregravy avatar Aug 14 '11 04:08 softwaregravy

@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!

tute avatar Sep 13 '13 18:09 tute

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

colszowka avatar Sep 13 '13 19:09 colszowka

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!

tute avatar Sep 16 '13 16:09 tute

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'

colszowka avatar Sep 16 '13 16:09 colszowka

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.

tute avatar Sep 18 '13 17:09 tute

It seems @colszowka would like to say

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

gotva avatar Oct 23 '13 15:10 gotva

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

mathieujobin avatar Apr 15 '16 20:04 mathieujobin