Travis CI Ruby Test Coverage

New Test Reporter Public Beta

Our new test reporter, with support for parallelized CI builds, is now in public beta! View its documentation here.

  1. Add the codeclimate-test-reporter and simplecov gems to your Gemfile:
group :test do
  gem "simplecov"
  gem "codeclimate-test-reporter", "~> 1.0.0"
end
  1. Start SimpleCov at the very top of your test/test_helper.rb, spec/spec_helper.rb, or Cucumber env.rb file:
require "simplecov"
SimpleCov.start
  1. Configure your .travis.yml file to use Code Climate:
addons:
  code_climate:
    repo_token: <token>
# regular test configuration
after_success:
  - bundle exec codeclimate-test-reporter

You can find your repo's token on your repo's settings page.

Troubleshooting

No coverage reported in the Code Climate UI or GitHub PR Status Updates?

  1. Make sure Build pushes is enabled on your repo settings page in Travis.
    Build pull requests can be enabled, but doesn't currently work with our reporters.
  1. Make sure you start all of the SimpleCov instructions at the very top of your test/test_helper.rb, spec/spec_helper.rb, or Cucumber env.rb file.

Travis CI Ruby Test Coverage