Skip to content
Novus Examples
xml12.9 KB

Coverage — Cobertura with One Package per Directory

The same coverage split into one package per source directory with dotted names, the layout a JVM project produces. Reports that key on class name alone collide as soon as two packages hold a class of the same name, which this file is shaped to expose.

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>src</source>
  </sources>
  <packages>
    <package name="src.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"/>
242 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
Packages
2
Package Naming
dotted directory path

Testing contract

Expected to pass
Scenario
Aggregate Cobertura coverage by package rather than by class name.
Expected result
Each package's line-rate is the ratio of its own classes' lines, and the four classes remain distinguishable by package+class rather than class alone.

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 One Package per Directory” 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-multi-package.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.