Wednesday, June 17, 2015

Objective-C: Travis-CI and (2/2)

Until now we've added to our repository just the support for Travis-CI. Now it's time for which is basically the second part of this Pull Request.

Coveralls is a service that analyses your code and gives a percentage of code that is covered by some tests.

If your code is already on Github, you can navigate now to and activate the support for your repository, otherwise you can do it at the end, but then the next commit will show up on As we already had for the Travis-CI;

1) This service will start after Travis-CI so he needed to invoke it when Travis-CI has finished. This can be done by adding it to the .travis.yml
after_success: bundle exec slather
As you may already expect he had to include slather into our Gemfile and execute it
source ''
gem 'cocoapods'
gem 'rake'
gem 'slather'
gem 'xcpretty'
Slather, as Travis-CI needs its own configuration file which is .slather.yml in this case

2) If you'd run now the bundle exec slather command you'll probably end up with an error as Xcode is not generating coverage files if they are not needed. There are basically two flags to set in the xcodeproject file
Basically there are the methods to set these flags

  1. Open Xcode, search in Build settings for Instrument Program Flow and Generate Test Coverage Files and set both of them to YES which will generate the needed files on every build
  2. You can do the same executing the command $ slather setup path/to/project.xcodeproj which will automatically set those flags
  3. Add the parameters to the build command in the Rakefile which will generate them only when you execute the rake build.

3) Now as in Travis-CI just add the badge to the readme
[![Coverage Status](](

No comments: