Over a million developers have joined DZone.

Message Cowboy - Code Coverage Reports with Cobertura and Coveralls

· DevOps Zone

Download “The DevOps Journey - From Waterfall to Continuous Delivery” to learn learn about the importance of integrating automated testing into the DevOps workflow, brought to you in partnership with Sauce Labs.

After having spent some time trying to migrate my Message Coboy project from Maven to Gradle, I finally gave up. I guess Gradle is not for me and I do not see any significant gains in moving from Maven to Gradle, neither as far as my sparetime projects are concerned nor in the organization where I work.

The reason for me wanting to migrate to Gradle was not really Gradle in itself, but the cool badges with code coverage, download latest release etc that I saw on the Mockito project.
Fortunately there is a very nice Coveralls Maven plug-in with excellent documentation which I can recommend.

So what were the required modifications?
First I added the Cobertura and Coveralls plug-ins to the <build> section of my pom.xml:

            <!-- Generates code coverage report. -->
            <!-- Submit code coverage report to Coveralls.io. -->
                    <!-- Since I use Travis CI I do not have to put my Coveralls token here. -->

Second I added two lines in the .travis.yml file. The new version of the file looks like this:

language: java
- oraclejdk7

  - mvn clean cobertura:cobertura coveralls:report

Finally I signed up for Coveralls, which is free for all open-soruce projects, and copy-pasted the markup that displays the code coverage badge to the Message Cowboy ReadMe.md file.

Many thanks to the developer of the Coveralls Maven plug-in and to the generous folks at Coveralls!

Discover how to optimize your DevOps workflows with our cloud-based automated testing infrastructure, brought to you in partnership with Sauce Labs


Published at DZone with permission of Ivan K. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}