'Using SimpleCov to display Cucumber code coverage
Does anyone have any experience using Cucumber and the code coverage tool SimpleCov? I'd added the following lines env.rb file so Cucumber will fire off SimpleCov-
require 'simplecov'
SimpleCov.start 'rails'
SimpleCov.coverage_dir 'coverage/cucumber'
It does what it is supposed EXCEPT that the output file lists 0 files test, 0 relevent lines, 0 lines covered, etc. Any idea how I can make the code coverage come out right?
Solution 1:[1]
Got this when using RSpec too, even when I made sure that I had:
require 'simplecov'
SimpleCov.start
at the very top of my spec/spec_helper.rb file. Turns out that I had accidentally required my code library under test after require 'spec_helper' in the actual spec file (i.e.: foo_spec.rb) (D'oh! ... Needed more sleep that day...)
So tip for newbies or sleep-deprived code junkies alike: Make sure you're actually requiring SimpleCov and starting the coverage analysis at the very beginning of your actual load order.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | TrinitronX |
