Skip to content
Novus Examples
xml9.4 KB

Coverage — Clover XML

The 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.

Preview — first 50 linesxml
<?xml version="1.0" encoding="UTF-8"?>
<coverage generated="1786000462000" clover="4.4.1">
  <project timestamp="1786000462000" name="Novus Checkout Service">
    <metrics statements="140" coveredstatements="127" conditionals="24" coveredconditionals="17" methods="20" coveredmethods="18" elements="184" coveredelements="162" complexity="32" loc="200" ncloc="200" packages="2" files="4" classes="4"/>
    <package name="cart">
      <metrics statements="77" coveredstatements="68" conditionals="14" coveredconditionals="10" methods="11" coveredmethods="9" files="2" classes="2"/>
      <file name="pricing.js" path="src/cart/pricing.js">
        <metrics statements="44" coveredstatements="40" conditionals="8" coveredconditionals="6" methods="6" coveredmethods="5" classes="1" loc="62" ncloc="62"/>
        <line num="2" count="25" type="method" name="unitPrice" visibility="public"/>
        <line num="3" count="21" type="stmt"/>
        <line num="4" count="23" type="stmt"/>
        <line num="5" count="10" type="cond" truecount="1" falsecount="1"/>
        <line num="6" count="8" type="stmt"/>
        <line num="8" count="8" type="method" name="quantityMultiplier" visibility="public"/>
        <line num="9" count="47" type="stmt"/>
        <line num="10" count="2" type="stmt"/>
        <line num="11" count="0" type="stmt"/>
        <line num="12" count="29" type="stmt"/>
        <line num="13" count="9" type="method" name="roundHalfUp" visibility="public"/>
        <line num="15" count="14" type="cond" truecount="1" falsecount="1"/>
        <line num="16" count="36" type="stmt"/>
        <line num="17" count="40" type="stmt"/>
        <line num="18" count="5" type="stmt"/>
        <line num="19" count="37" type="method" name="applyTax" visibility="public"/>
        <line num="20" count="0" type="stmt"/>
        <line num="22" count="47" type="stmt"/>
        <line num="23" count="18" type="stmt"/>
        <line num="24" count="29" type="cond" truecount="1" falsecount="0"/>
        <line num="25" count="35" type="method" name="bulkRate" visibility="public"/>
        <line num="26" count="42" type="stmt"/>
        <line num="27" count="17" type="stmt"/>
        <line num="29" count="33" type="stmt"/>
        <line num="30" count="0" type="stmt"/>
        <line num="31" count="0" type="method" name="convertCurrency" visibility="public"/>
        <line num="32" count="42" type="stmt"/>
        <line num="33" count="9" type="cond" truecount="1" falsecount="0"/>
        <line num="34" count="13" type="stmt"/>
        <line num="36" count="45" type="stmt"/>
        <line num="37" count="16" type="stmt"/>
        <line num="38" count="20" type="stmt"/>
        <line num="39" count="0" type="stmt"/>
        <line num="40" count="18" type="stmt"/>
        <line num="41" count="24" type="stmt"/>
        <line num="43" count="15" type="stmt"/>
        <line num="44" count="30" type="stmt"/>
        <line num="45" count="33" type="stmt"/>
        <line num="46" count="16" type="stmt"/>
        <line num="47" count="9" type="stmt"/>
        <line num="48" count="46" type="stmt"/>
        <line num="50" count="15" type="stmt"/>
165 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
OpenClover XML
Elements
184
Covered Elements
162
Line Types
stmt, cond, method

Testing contract

Expected to pass
Scenario
Decompose Clover's blended element metrics back into lines, branches and methods.
Expected result
elements=184 splits into 140 statements, 24 conditionals and 20 methods.

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 — Clover XML” 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 · OpenClover 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("clover-coverage.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.