Search code examples
rubyhudsonrakejenkinsrcov

How to get Hudson to see rcov results?


I am currently working to integrate rcov with our Hudson server.

I am able to run rcov via rake and get the results with out issue (see rake file below). When I run things via Hudson - calling the rake task - the tests with coverage are clearly generated and displayed in the console.

But at almost the end, the following shows up in the console:

** Execute test:coverage
Recording test results
No test report files were found. Configuration error?
Build wasn't successful, skipping rcov coverage report
Finished: FAILURE

Rake task

desc 'Aggregate code coverage for unit, functional and integration tests'
  task :coverage => "test:coverage:clean"
  %w[unit functional].each do |target|
    namespace :coverage do
      Rcov::RcovTask.new(target) do |t|
        t.libs << "test"
        t.test_files = FileList["test/#{target}/*_test.rb"]
        t.output_dir = "coverage"
        t.verbose = true
        t.rcov_opts << '--rails --aggregate coverage.data'
      end
    end
    task :coverage => "test:coverage:#{target}"
  end

Going to coverage/ I see output file. The coverage.data file is present as well.

Any thoughts on what might be going wrong here? Am I missing something blindingly obvious?


Solution

  • Hudson will not pull the coverage results if the build has failed further up the chain. I ran into this issue when one test was failing, and could not figure out why coverage was not being reported.