jacoco-badge-generator icon indicating copy to clipboard operation
jacoco-badge-generator copied to clipboard

Feature Req: Generate badges from JaCoCo reports in xml format

Open japarson opened this issue 2 years ago • 7 comments

Is your feature request related to a problem? Please describe. The Pester PowerShell testing framework allows users to output code coverage reports as JaCoCo xml files. However, this action requires input in the form of csv files.

Describe the solution you'd like A new input option jacoco-xml-file that works for JaCoCo xml files.

Describe alternatives you've considered I could not find any simple way to convert from csv to xml. I could also request that the Pester framework add an option to output as csv, but I think it makes more sense to start here.

Additional context N/A

Thank you for your consideration!

japarson avatar Oct 11 '22 04:10 japarson

@japarson I'm not familiar with Pester so I took a look at it. Based on their docs it looks like only the xml report is generated. It looks like they adopted jacoco's xml format but not jacoco itself.

Anyway, I think xml report support is a reasonable request. It shouldn't be difficult to parse. I don't think an input to turn on option is likely necessary, and can probably just go by file extension. I know jacoco uses the standard xml extension when it generates an xml report. Can you confirm whether Pester's report uses xml file extension as well?

cicirello avatar Oct 11 '22 18:10 cicirello

@japarson I'm not familiar with Pester so I took a look at it. Based on their docs it looks like only the xml report is generated. It looks like they adopted jacoco's xml format but not jacoco itself.

Anyway, I think xml report support is a reasonable request. It shouldn't be difficult to parse. I don't think an input to turn on option is likely necessary, and can probably just go by file extension. I know jacoco uses the standard xml extension when it generates an xml report. Can you confirm whether Pester's report uses xml file extension as well?

Pester reports use the xml file extension by default: image

Thank you so much for considering this request. I mentioned the new input option to turn it on because I saw there was an input specifically for csv files: jacoco-csv-file. Would I still use this input for an xml file?

japarson avatar Oct 11 '22 18:10 japarson

@japarson when I replied earlier I had forgotten that the input has csv in its name. So a new input definitely makes more sense.

cicirello avatar Oct 11 '22 22:10 cicirello

@japarson when I replied earlier I had forgotten that the input has csv in its name. So a new input definitely makes more sense.

I should have included my reasoning in the original post. My bad there.

Thinking it through some more, I think there are actually 2 options here:

  1. Change the name of the existing input to jacoco-file and add some documentation about the possible input types.
    • This is a "major" level breaking change (in the context of semantic versioning).
  2. Add a new input specifically for xml files jacoco-xml-file.
    • This is a "minor" level change.

I'm not sure what the best option is. What do you think?

japarson avatar Oct 11 '22 23:10 japarson

I thought of an additional option, essentially a variation of the first one: Create a new input without csv/xml in its name, and deprecate the existing jacoco-csv-file input, but keep it around for now. It avoids the potential downside of just adding jacoco-xml-file (e.g., might cause confusion leading to false assumption that both reports are needed, as well as the possibility that jacoco might later introduce yet another format). But at the same time it temporarily avoids a breaking change.

cicirello avatar Oct 12 '22 17:10 cicirello

Hi @cicirello Thanks :). I wanted to know if this support is added or not? I am trying to use the command line utility but it doesn't work for xml with and without file type format jacoco-xml-file and jacoco-file.

manoj-paypay avatar Jan 05 '23 10:01 manoj-paypay

Hi @manoj-paypay no, it doesn't support JaCoCo XML reports yet, only the CSV reports at the present time.

cicirello avatar Jan 05 '23 11:01 cicirello