Coverage — Cobertura Condition-Coverage Attributes
Cobertura with a condition-coverage attribute on every branching line, written in the "50% (1/2)" form. The percentage and the fraction can disagree in real reports, so a parser should read the fraction and treat the percentage as derived.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE coverage SYSTEM "http://cobertura.sourceforge.net/xml/coverage-04.dtd">
<coverage line-rate="0.9071" branch-rate="0.7083" lines-covered="127" lines-valid="140" branches-covered="17" branches-valid="24" complexity="32" version="2.1.1" timestamp="1786000462">
<sources>
<source>src</source>
</sources>
<packages>
<package name="cart" line-rate="0.8831" branch-rate="0.7143" complexity="11">
<classes>
<class name="pricing" filename="src/cart/pricing.js" line-rate="0.9091" branch-rate="0.7500" complexity="6">
<methods>
<method name="unitPrice" signature="()V" line-rate="1.0" branch-rate="1.0">
<lines><line number="2" hits="25"/></lines>
</method>
<method name="quantityMultiplier" signature="()V" line-rate="1.0" branch-rate="1.0">
<lines><line number="8" hits="8"/></lines>
</method>
<method name="roundHalfUp" signature="()V" line-rate="1.0" branch-rate="1.0">
<lines><line number="13" hits="9"/></lines>
</method>
<method name="applyTax" signature="()V" line-rate="1.0" branch-rate="1.0">
<lines><line number="19" hits="37"/></lines>
</method>
<method name="bulkRate" signature="()V" line-rate="1.0" branch-rate="1.0">
<lines><line number="25" hits="35"/></lines>
</method>
<method name="convertCurrency" signature="()V" line-rate="0.0" branch-rate="1.0">
<lines><line number="31" hits="0"/></lines>
</method>
</methods>
<lines>
<line number="2" hits="13" branch="false"/>
<line number="3" hits="21" branch="false"/>
<line number="4" hits="23" branch="false"/>
<line number="5" hits="10" branch="true" condition-coverage="100% (2/2)"/>
<line number="6" hits="8" branch="false"/>
<line number="8" hits="2" branch="false"/>
<line number="9" hits="47" branch="false"/>
<line number="10" hits="2" branch="false"/>
<line number="11" hits="0" branch="false"/>
<line number="12" hits="29" branch="false"/>
<line number="13" hits="41" branch="false"/>
<line number="15" hits="14" branch="true" condition-coverage="100% (2/2)"/>
<line number="16" hits="36" branch="false"/>
<line number="17" hits="40" branch="false"/>
<line number="18" hits="5" branch="false"/>
<line number="19" hits="33" branch="false"/>
<line number="20" hits="0" branch="false"/>
<line number="22" hits="47" branch="false"/>
<line number="23" hits="18" branch="false"/>Specifications
- Seed
- 61200
- Source Files
- 4
- Lines Found
- 140
- Lines Hit
- 127
- Line Pct
- 90.71
- Branches Found
- 24
- Branches Hit
- 17
- Branch Pct
- 70.83
- Functions Found
- 20
- Functions Hit
- 18
- Line Endings
- LF
- Format
- Cobertura XML
- Branch Lines
- 12
- Condition Coverage Format
- N% (taken/total)
- Packages
- 2
Testing contract
Expected to pass- Scenario
- Read branch outcomes from Cobertura condition-coverage attributes.
- Expected result
- The taken/total fraction is used as the source of truth and reproduces 17/24 branch outcomes overall.
What is a .xml file?
XML (Extensible Markup Language) is a verbose, self-describing markup language using nested tags, attributes, and namespaces to represent structured, hierarchical data. It supports schemas, entities, and validation and underlies many document and data formats. It remains common in enterprise, publishing, and interchange contexts.
How to use this file
Use an example XML file to test parsers, namespace and schema validation, XPath queries, and protection against entity-expansion and external-entity attacks.
How to use this file for testing
“Coverage — Cobertura Condition-Coverage Attributes” is a deterministic Novus Examples fixture for Conversion testing, Code parsing, Schema validation. The same content exported across many formats and linked as a group, so you can convert one and diff against the expected twin.
Documented properties for this file: seed 61200 · LF · Cobertura XML. Compare results against paired or grouped companions on this page when present (clean↔damaged, searchable↔scanned, or format twins) so scores stay reproducible across runs.
Download the file once, keep the path stable in CI or local scripts, and treat the spec table as the contract: dimensions, seeds, field lists, and roles are intentional. Corrupt or invalid samples are labelled as such — expect parsers to fail loudly rather than silently accept them.
Test and coverage reports document their totals (suites, cases, passes, failures, skips, covered lines) in the spec table. Point your CI dashboard, coverage gate, or report converter at the file and assert those counts survive; format twins carry identical numbers so a conversion can be scored exactly.
Code examples
import xml.etree.ElementTree as ET
tree = ET.parse("cobertura-condition-coverage.xml")
root = tree.getroot()
print(root.tag, [c.tag for c in root][:5])Related files
- xmlCoverage — Clover XMLThe Clover serialisation, whose <metrics> element rolls statements, conditionals and methods into a single elements/coveredelements pair. Anything reading only that pair reports a blended percentage that matches none of the other three formats unless the components are separated first. Every file in this group describes the same four-file source tree and reports 127/140 lines, 17/24 branch outcomes and 18/20 functions, so a converter can be diffed against a known answer.

- xmlCoverage — Cobertura XMLThe Cobertura serialisation of the same run, with packages, classes, per-method line rates and condition-coverage attributes on every branching line. Cobertura expresses coverage as rates rather than counts, so this is the file that catches converters rounding a percentage into a hit count. Every file in this group describes the same four-file source tree and reports 127/140 lines, 17/24 branch outcomes and 18/20 functions, so a converter can be diffed against a known answer.

- xmlCoverage — JaCoCo Method-Level CountersPer-method INSTRUCTION, LINE, COMPLEXITY and METHOD counters for all 20 methods, 2 of which were never entered. This is the detail a "which functions are untested" report needs and the level at which most converters stop.

- xmlCoverage — JaCoCo Multi-Module <group>The aggregate form a multi-module build produces: packages nested inside a <group> rather than directly under <report>. Parsers with a hardcoded report/package path find nothing here and report a module with no coverage at all.

- xmlCoverage — JaCoCo with Every Counter TypeAll six JaCoCo counter types present at every level of the document — method, class, sourcefile, package and report. Tools usually read only the report-level LINE counter; this file is for checking that per-method and per-package rollups agree with it.

- xmlCoverage — JaCoCo with Several Session RecordsA report merged from three separate JVM sessions, each recorded as its own <sessioninfo> with start and dump timestamps. The counters are already the merged totals, so summing per-session anything from this file is a mistake it exists to catch.

Generated by generation/testing.py. Free for any use, no attribution required — license.