bmuschko / gradle-clover-plugin

Gradle plugin for generating a code coverage report using Clover
Apache License 2.0
74 stars 49 forks source link

Console reporter #117

Closed resah closed 5 years ago

resah commented 6 years ago

Is it possible to write code coverage information to console?

We are using GitLab-CI, which reads coverage information from console output during build and shows this directly in related merge requests.

Right now I am using jacoco and would love to switch to this awesome clover plugin.

Alex-Vol-SV commented 6 years ago

If you enable XML report you can probably create a new task that uses XMLSlurper to pick the values out of the XML report and print them. Instead of just running the cloverGenerateReport or cloverAggregateReports task you would run your own task which would depend on either of the above as needed and then would pick the values out of the clover.xml summary. You would do that to print the desired values as part of the task action.

I could add that feature in the clover tasks either as what I just described or some more internalized functionality that possibly works even with XML report disabled. Although, I am not sure there is a proper API to get the necessary information from clover without enabling the report to use XML.

khamburg-dev commented 5 years ago

plus 1. I would like to be able to show the coverage percentage in the build console output without having to open the report.

Alex-Vol-SV commented 5 years ago

Added console reporter feature when XML reports are used. The feature is activated automatically when the XML report is generated.

See update in README