When starting with Continuous Integration and Continuous Deployment, code coverage is one of the tools that improves your workflow significantly.
Being able to quickly grasp which parts of your application aren’t well tested is incredibly important. Especially tracking your code coverage over time is a powerful feature. With this in mind we were always searching for some way to help our users get started with integrating code coverage into their workflows. Today we are happy to announce that we worked together with Coveralls.io to integrate their code coverage service.
Using Coveralls for Code Coverage
Coveralls automatically collects your code coverage data, uploads it to their servers and gives you a nice interface to dig into it. They even show you trends and changes on coverage for all of your files. Really awesome.
At the beginning Coveralls supported only Ruby, but through user contribution they now support many different languages including Python, PHP, NodeJS, C/C++ and Scala according to their docs. Coveralls is a product of the great team at Lemur Heavy whose portfolio is impressive (they’ve created the Heroku Postgres Interface for example).
Getting started with Coveralls
Starting with Codeship and Coveralls is easy. Their docs do a great job of guiding you, but all there is to set up your Ruby app is add a .coveralls.yml file to your codebase that contains your Coveralls key:
It is also possible to set this in the Environment setting of your Codeship project
then simply require the Gem in your Gemfile
gem 'coveralls', require: false
and put the initializers into your spec_helper.rb or env.rb depending on which framework you use
If you want to combine the coverage data from different frameworks, add the following to your spec_helper.rb and env.rb (also take a look at Coverallsdocs on that topic).
Then you need to add a rake task that pushes your coverage report as soon as your build is finished.
This will push to Coveralls only if your tests are successful.
Code coverage is just one more tool to use to build great software. By making this ridiculously easy Coveralls have taken away any excuse not to do it. Combined with Continuous Integration and Deployment on the Codeship you can build better software faster. Have fun coding.