Skip to content
Novus Examples
xml13.1 KB

Coverage — Cobertura with Several Source Roots

Three <source> roots with class filenames given relative to them, which is how Cobertura represents a multi-root project. A viewer must try each root in turn to resolve a file; one that assumes a single root shows "source not found" for most of the report.

Preview — first 50 linesxml
<?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>/builds/novus/checkout-service/src</source>
    <source>/builds/novus/checkout-service/generated</source>
    <source>/usr/lib/node_modules</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"/>
244 lines total — download for the full file.

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
Source Roots
3
Filenames Are Relative
true

Testing contract

Expected to pass
Scenario
Resolve a Cobertura class filename against several declared source roots.
Expected result
Each relative filename resolves under exactly one of the three roots, and an unresolvable path is reported rather than silently skipped.

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 with Several Source Roots” 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-sources-block.xml")
root = tree.getroot()
print(root.tag, [c.tag for c in root][:5])

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