Repository navigation
Description
I've been at this for several days now with no luck.
I am attempting to add code coverage to my rails application, and want to do get overall coverage numbers for my Unit, functional and selenium tests. I am using minitest and jruby 1.7.19 (if that matters), and starting Simplecov in an initializer file so that I can get coverage numbers from my tomcat server process for selenium tests.
I've tried a number of configurations based on a recommendations I've read in various posts, and nothing has yielded expected results so far. My current set up looks like this:
# config/initializers/000_simplecov.rb
if ENV[ 'COVERAGE' ]
require 'simplecov'
require 'simplecov-teamcity-summary'
SimpleCov.start 'rails' do
SimpleCov.merge_timeout 5600
at_exit do
SimpleCov.result.format!
SimpleCov::Formatter::TeamcitySummaryFormatter.new.format SimpleCov.result if ENV[ 'TEAMCITY_VERSION' ]
end
end
endAnd I've also made use of the command_name method to distinguish various test suites, which I've placed at the very top of 1 of the test files in each of the suites, as recommended by the Simplecov documentation:
# test/functional/some_functional_test.rb
SimpleCov.command_name 'test:functionals'# test/unit/some_unit_test.rb
SimpleCov.command_name 'test:units'# test/selenium/some_selenium_test.rb
SimpleCov.command_name 'test:selenium'I seem to be getting coverage reporting for my Unit and functional tests. Models and controllers are reporting what seem to be believable numbers. However, for some of my selenium tests, In the report I am noticing that the same lib file is evaluated twice, but one has 0% coverage and the other has some percentage of coverage. This is throwing off the overall coverage numbers.
The 2 identical files in the report look like this:
lib/qa/psd_components/tools.rb #reporting 0% coverage
lib//qa/psd_components/tools.rb # reporting 98% coveragenotice the extra forward slash after lib in the second, which seems to be causing simplecov to treat it as a different file. I am not sure why this is happening. Maybe my current set up isn't correct. Any help would be much appreciated.
Activity
bf4 commentedon Jun 17, 2016
@Spitigala This is actually related to a PR I'd very much like to see (if I don't eventually make it myself):
Make it easy to build a rebuild fro result.json files on the filesystem.
Some links I've been looking at
But the problem can likely be solved in
PragTob commentedon Jan 25, 2017
I'd put my money on this being a result of incorrect coverage data generated by JRuby 1.7.x which is fixed in JRuby 9.1. I know, it might be hard to ask you to upgrade your JRuby installation but I think that's most of what can be done here.
If you disagree/the issue persists/whatever please feel free to reopen!