Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support to the latest Cobertura format #164

Closed
lmussier opened this issue Feb 13, 2017 · 8 comments

Comments

Projects
None yet
6 participants
@lmussier
Copy link

commented Feb 13, 2017

Hi,

Could you add the support of the latest cobertura format coverage-04.dtd for xml output?

Thanks.

@lmussier lmussier changed the title Add support to Add support to the latest Cobertura format Feb 13, 2017

@dishmal

This comment has been minimized.

Copy link

commented Aug 15, 2017

Any idea of if/when this would happen to support TFS usage?

@shreyaskambl

This comment has been minimized.

Copy link

commented Sep 6, 2017

VSTS only accepts cobertura-04.dtd format. It would be great if we can have it implemented

@libPhipp

This comment has been minimized.

Copy link
Contributor

commented Jan 6, 2018

That would be great indeed. The only difference between Cobertura's 03.dtd and the new 04.dtd is in the coverage element. Five new required attributes were introduced:

lines-covered
lines-valid
branches-covered
branches-valid
complexity

Does anyone know what information is expected in those attributes? Do we already have that elsewhere or may be at least the summands? Can we get the information from print_xml_report's parameter "covdata"?

@latk

This comment has been minimized.

Copy link
Member

commented Jan 6, 2018

This issue seems to be quite important.

The meaning of these attributes can probably be derived from the Cobertura implementation itself. Their XMLReport class looks like a good starting point. Since they use the same code to generate reports for all DTDs, we can do the same.

Calculating cyclomatic complexity is clearly out of scope for gcovr, but I think the other parameters can be derived from the CoverageData objects.

If someone wants to take a go at this:

  1. Run the XML tests to verify that gcovr currently works: python gcovr/tests/test_gcovr.py GcovrXml
  2. Add the new required attributes to the report and use the 04.dtd.
  3. Re-run the XML tests. They should now fail due to the added attributes.
  4. For each failing tests, compare the actual report with the reference XML report. If there are no discrepancies other than the new attributes, replace the reference file with the new report.
  5. The tests should now pass again.
  6. Create a pull request to the master branch and mention this issue in the description.

Perhaps we also need to add a command line flag so that the DTD version can be selected explicitly.

@denniswjackson

This comment has been minimized.

Copy link

commented Jan 7, 2018

@libPhipp

This comment has been minimized.

Copy link
Contributor

commented Jan 7, 2018

I gave it a try and created a pull request for this issue. For the complexity value I have just copied the fixed '0.0' that we also have in the package- and class-elements for example. The tests didn't fail as expected, after my changes, as assertMatchesXmlBaseline() from pyutilib.th doesn't seem to compare doctype nor attributes.

@latk latk referenced this issue Jan 7, 2018

Merged

Saner XML tests #188

@latk

This comment has been minimized.

Copy link
Member

commented Jan 7, 2018

Thanks to @libPhipp's work in #186, we now use the newer Cobertura format.

Everyone: please test the current version with your setup (Jenkins plugins, VSTS, ...) and report any related problems in this thread.

To test this new feature, you must install gcovr directly from Github and not from PyPI. For example:

$ pip install git+https://github.com/gcovr/gcovr.git

@latk latk closed this Jan 7, 2018

@latk latk removed the help wanted label Jan 7, 2018

@libPhipp

This comment has been minimized.

Copy link
Contributor

commented Jan 8, 2018

Today I have tested the new state of the master branch in combination with VSTS and it works like a charm. The coverage statistics are now exported and also the html report can be included:
coverage

Thanks a lot for your amazing help, @latk !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.