Use Jacoco And GitHub Actions to Improve Code Coverage

Eclipse Collections has recently added a code coverage report via Jacoco using GitHub actions. For those not familiar, Jacoco is a free code coverage library. In short, it measures how much of our code has test coverage.

With this addition, anyone willing to contribute to Eclipse Collections can download the report, look for parts of code not covered by tests, and submit a PR with new tests that will improve the coverage.

The new report is available at Eclipse Collections GitHub Repository -> Action -> Coverage Report.

To generate a human-readable report, we need to use the report goal on our project pom.xml file. With this goal, JaCoCo can generate the report in different formats (e.g. HTML, XML, CSV) that help us interpret the result. Below is an example of the report.

Code coverage report
Code coverage report

The report is simple and easy to navigate and you’ve different sorting options.

Now you can easily spot pieces of code without coverage, write the tests for it and contribute to Eclipse Collections.

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.