Better jcov integration

Alexey Fedorchenko alexey.fedorchenko at oracle.com
Thu Mar 22 00:55:29 UTC 2018


Hello Eric!

  The plugin that provides the requested Cobertura style reports was added to JCov OS repo.
  Please, take a look if it has all needed functionality. Thank you for the contribution.

—Alexey

> On Mar 2, 2018, at 5:49 PM, Alexey Fedorchenko <Alexey.Fedorchenko at oracle.com> wrote:
> 
> Hello, Eric!
> 
>  I will look at the patch more carefully next week, a few things that come to my mind for now:
> - You have added CoberturaReportGeneratorSPI, but never used it. It looks like after changes in the DefaultReportGeneratorSPI you do not need this additional class.
> - There is an assumption in the CoberturaReportGenerator that options.getSrcRootPaths() is not null, but if the user generates report by the command like:
> java -jar jcov.jar repgen -format cobertura -o cobertura.xml  //without specifying the “src” value // the user will get NullPointerException.
> (without sources only “filename” attributes are changed from the full path to the names, the rest cobertura-style report looks the same).
> 
> Could you, please, subscribe to the watchers list for CODETOOLS-7902125 <https://bugs.openjdk.java.net/browse/CODETOOLS-7902125> to continue this discussion there.
> 
> Thank you.
> 
> 
> —Alexey
> 
> 
>> On Mar 1, 2018, at 5:43 AM, Eric McCorkle <eric at metricspace.net> wrote:
>> 
>> I did manage to figure out why Jenkins wasn't highlighting the code.  It
>> seems that the "lines" fields in method entries need to also be
>> duplicated in the "class" entries.
>> 
>> The attached diff contains the changes.
>> 
>> On 02/28/2018 20:49, Eric McCorkle wrote:
>>> I should mention that I noticed that Jenkins at least doesn't seem to
>>> highlight the source in the coverage reports generated by the current
>>> patch.
>>> 
>>> I'm going to look into it a bit more.
>>> 
>>> On 02/28/2018 15:20, Alexey Fedorchenko wrote:
>>>> Hello, Eric!
>>>> 
>>>> Thank you for the report. I have added an issue for your request [1].
>>>> We will address it, I also think that having more report formats is a
>>>> good suggestion.
>>>> 
>>>> A few thoughts about the original problem of adding JCov to CI (Jenkins):
>>>> - use html publisher plugin to show JCov html report
>>>> - plot build data with plot plugin to look at the coverage trend for builds 
>>>> ( it will require using grep and sed to get data from
>>>> overview-summary.html to plot.csv )
>>>> - create JCov plugin for Jenkins.
>>>> 
>>>> The latest item and Maven plugin opens a little bit bigger discussion
>>>> for Code Tools projects:
>>>> Could we have tool's plugins sources in tool’s repository?
>>>> 
>>>> Thank you.
>>>> 
>>>> [1] https://bugs.openjdk.java.net/browse/CODETOOLS-7902125
>>>> 
>>>> —Alexey
>>>> 
>>>>> On Feb 28, 2018, at 4:42 AM, Eric McCorkle <eric at metricspace.net
>>>>> <mailto:eric at metricspace.net>> wrote:
>>>>> 
>>>>> Hello everyone,
>>>>> 
>>>>> I recently found myself needing better integration of jcov into various
>>>>> build/testing tools, so I did two things.  First, I modified the jcov
>>>>> tool to generate a report in the Cobertura XML format, which is used by
>>>>> Jenkins and other tools as an input format.  While these reports are
>>>>> inferior in my opinion to the HTML reports jcov generates, they do allow
>>>>> integration with other tools and CI systems.  Therefore, I think
>>>>> providing this functionality would likely encourage more people to use
>>>>> jcov over the alternatives.
>>>>> 
>>>>> I've attached the patch for this modification here, if anyone would like
>>>>> to review it.
>>>>> 
>>>>> 
>>>>> I've also mostly wrangled the Maven plugin API to create a plugin for
>>>>> using jcov in a Maven project (however, there is one remaining issue
>>>>> with documentation generation that I need to correct before I call the
>>>>> plugin "finished").  I'm not sure if that would be something that would
>>>>> be added to codetools, if the group ID should be something like
>>>>> "org.openjdk", or what else ought to be done about it.  I will gladly
>>>>> contribute the code if there's a desire to adopt it.
>>>>> <cobertura.diff>
>>>> 
>> <cobertura.diff>
> 



More information about the code-tools-dev mailing list