DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
  1. DZone
  2. Software Design and Architecture
  3. Performance
  4. Message Cowboy - Code Coverage Reports with Cobertura and Coveralls

Message Cowboy - Code Coverage Reports with Cobertura and Coveralls

Ivan K user avatar by
Ivan K
·
Feb. 11, 15 · Interview
Like (0)
Save
Tweet
Share
6.06K Views

Join the DZone community and get the full member experience.

Join For Free

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. -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>cobertura-maven-plugin</artifactId>
                <version>2.6</version>
                <configuration>
                    <format>xml</format>
                    <maxmem>256m</maxmem>
                </configuration>
            </plugin>
            <!-- Submit code coverage report to Coveralls.io. -->
            <plugin>
                <groupId>org.eluder.coveralls</groupId>
                <artifactId>coveralls-maven-plugin</artifactId>
                <version>3.0.1</version>
                <configuration>
                    <!-- Since I use Travis CI I do not have to put my Coveralls token here. -->
                </configuration>
            </plugin>
        </plugins>
    </build>

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

language: java
jdk:
- oraclejdk7

after_success:
  - 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!


Code coverage

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

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • How Observability Is Redefining Developer Roles
  • Data Engineering Trends for 2023
  • Upgrade Guide To Spring Data Elasticsearch 5.0
  • The Role of Data Governance in Data Strategy: Part II

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: