Generating code coverage metrics

Code Coverage tells you how much of your application is tested.

CircleCI provides a number of different options for code coverage reporting, using built-in CircleCI features combined with open source libraries, or using partners.

See coverage in CircleCI

It’s straightforward to see simple coverage results from your build. Simply add a coverage library to your project, and configure it to write the results out to CircleCI’s artifacts directory. CircleCI will upload coverage results and make them visible as part of your build.

Adding and configuring a coverage library


In Ruby 1.9, you add the simplecov gem and configure your test suite to add code coverage.

In your Gemfile, add the simplecov gem:

gem 'simplecov', :require => false, :group => :test

In test/test_helper.rb, spec/spec_helper.rb, Cucumber’s env.rb, or in your test suite’s startup hooks, initialize SimpleCov.

require 'simplecov'

# save to CircleCI's artifacts directory if we're on CircleCI
  dir = File.join(ENV['CIRCLE_ARTIFACTS'], "coverage")


The simplecov README has more details.

Python, Node, Java, PHP, etc

We’re working on a guide for other languages. In the meantime, add your coverage library of choice. Options include:

Configure your library to save results in the directory specified by the CIRCLE_ARTIFACTS environment variable. Alternatively, add a command to copy your artifacts into the artifacts directory.

Seeing the results in the CircleCI UI

We will upload your coverage files, which will allow you view them from the “Artifacts” tab on the build page:

You can also get them via the CircleCI API.

And then of course, by viewing the generated HTML, you can see beautifully rendered HTML in the UI.

Using a Code Coverage service

You can easily send coverage results from CircleCI to a number of external code quality services:


If you’re a Codecov customer, integration with CircleCI can be as easy as

    - bash <(curl -s

No upload token is required for open source repositories.

Codecov’s Bash uploader detects all coverage reports from all languages and details for the CircleCI build to create a single, cohesive coverage report. Codecov will automatically handle the merging of coverage stats in parallel builds.

For more information find an example of your language here:


If you’re a Coveralls customer, follow their guide to set up your coverage stats. You’ll need to add COVERALLS_REPO_TOKEN to your CircleCI environment variables.

Coveralls will automatically handle the merging of coverage stats in parallel builds.

Code Climate

If you’re a Code Climate customer, follow the instructions under Repo Settings -> Test Coverage from your repo on the Code Climate site. You’ll need to add your CODECLIMATE_REPO_TOKEN to your CircleCI environment variables.

Code Climate does not currently support CircleCI’s parallelization. Contact us if you’d like to use this.


Follow the instructions from PullReview to configure the appropriate coverage reporter. You’ll need to add PULLREVIEW_REPO_TOKEN to your environment variables.

Under construction

Code coverage is an area where our support is evolving. We’d love to have your feedback about how we could support it better. Let us know how you’re using it, how you’d like to use it, and what we could do better!