Code Coverage Metrics

From Anonymous on 2015/05/30 11:25:36 +0000

It’s very useful for developers to see test coverage for a project and its classes.

It’s very important for Product Owners and Project Managers to have access to this information without developer assistance so they can plan next stages of work, concentrate on deficient code or have an early warning system to begin asking questions or begin planning accordingly if test coverage starts to drop.

Other competing services such as Travis and Circle both implement support for Coveralls (and get Slather as a knock on benefit).

I propose Bitrise either builds in Coveralls and Slather support or rolls a Bitrise specific solution which takes advantage of the test coverage files delivered after an Xcode build.

Copied from original feature request:

From Vinayak Badrinathan on 2016/06/03 19:18:14 +0000

In case anyone else is looking for another way, here's what I did:

I enabled 'gather coverage data' under my test section in my scheme. I then added a lane in fastlane that does the following:

  • runs unit tests with the scheme mentioned above
  • invokes slather via the command line and captured stdout, stderr, and status via the gem Open3
  • added a regex that looks for the final test coverage results from slather's stdout output
  • if it's non-nil, the coverage number was parsed and we can write some logic to check that against the project's limit

Surely, the code in the gist can be cleaner, but it'll give you an idea of how you can add code coverage and a minimum threshold.

Example code:

From Kyle McAlpine on 2016/01/12 14:34:48 +0000

I've written a bit about this on the Bitrise contrib repo here:

It seems that Slather is not really being maintained anymore. Last commit was in October. So we're working on a replacement:

Goal is to output:

  • JSON
  • Cobertura
  • HTML

from the new Xcode Coverage.profdata code coverage file.

Contributors very much welcome :slight_smile:

From Bitrise on 2015/10/30 14:22:31 +0000

For this you now can use the Codecov step ( which will generate and upload a code coverage report to Codecov ( We haven't closed this idea, as we are curious what other related features you'd need.

Most of these things are possible now, the only thing which prevents you from easily checking the code coverage metrics of a build is: