Ensure Cobertura XML reports are standards-compliant #57
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
TL;DR
This PR fixes failing Cobertura converter tests and ensures the generated XML strictly follows Cobertura conventions.
It removes formatting inconsistencies, updates stale coverage values, and replaces compact empty elements (
<methods/>) with explicit tags (<methods></methods>).The result is Cobertura XML that passes all tests and is accepted by strict coverage parsers used by external tools.
Summary
This PR fixes the failing
testCoberturaConverter()test and corrects Cobertura XML output so it conforms more closely to the expected standard. The issue surfaced when external coverage tools (e.g. DataDog CI) rejected the generated reports as invalid, but the problem is more general: the XML did not consistently match Cobertura conventions.Problem
testCoberturaConverter()test was failing due to formatting mismatches and stale coverage data.<methods/>) instead of full form (<methods></methods>)standalone="yes"attribute in the XML declarationThese deviations, while valid XML, can cause strict Cobertura parsers to reject reports.
Changes Made
Test Infrastructure
assertXmlTestReportsAreEqual()to apply consistent formatting options ([.nodePrettyPrint, .nodeCompactEmptyElement]).Test Assets
cobertura.xmlfixture with current coverage values.standalone="yes".Standards Compliance
<methods></methods>instead of<methods/>.Testing
testCoberturaConverter()andtestCoberturaConverterExcludeFiles()now succeedImpact