With continuous integration and unit testing, tracking how much of your code is covered by tests comes as natural requirement to detect code that could break. One could go as far as considering low test coverage a code smell.
The less of your code is covered by tests, the higher the chance that something will break as features are added, as code changes, as code is refactored.
Today, we’re thrilled to be a part of their newest feature addition: making test coverage an integral part of measuring code quality on their platform.
This new test coverage tracking integrates neatly with your builds on Travis CI with a few simple steps.
When integrated, here’s the view you’re getting. You can see how coverage for our controller handling Stripe subscriptions needs to be improved, but now we can actually see it.
Code Climate tracks any changes in coverage over time, showing you and telling you when things got better or when they got worse.
To get started, all you need to do is sign up for a Code Climate account and one for Travis CI too, and follow these steps:
codeclimate-test-reporterto your Gemfile:
gem "codeclimate-test-reporter", group: :test, require: nil
Add the following lines to your
test_helper.rb, at the very top:
require "codeclimate-test-reporter" CodeClimate::TestReporter.start
Add the Code Climate repository token to your
addons: code_climate: repo_token: 1213....
You’ll find these steps in the settings for your repository on Code Climate as well and on the repositories on Travis CI.
As a Travis CI customer, we have a special deal for you as well to get started on Code Climate.
We’re happy to be a partner in Code Climate’s new offering!