Skip to content
Novus Examples
xml449 B

JUnit XML — Truncated Mid-Element (intentionally corrupt)

An intentionally corrupt JUnit report: the file ends in the middle of a testcase attribute value, exactly as it would if the CI worker were killed while the reporter was still writing. Three elements are left unclosed and the document is not well-formed XML. A parser must fail loudly rather than report the two complete cases as the whole run.

Preview — first 6 linesxml
<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
  <testsuite name="checkout.AllTests" tests="12" failures="1" errors="1" skipped="1" time="7.450" timestamp="2026-08-07T09:14:22" hostname="ci-runner-04">
    <testcase classname="cart.PricingTest" name="appliesUnitPrice" time="0.643"/>
    <testcase classname="cart.PricingTest" name="appliesQuantityMultiplier" time="0.659"/>
    <testcase classname="cart.PricingTest" name="roundsHalfUpAtTwoDec

Specifications

Seed
61200
Intentionally Corrupt
true
Damage
file ends inside an attribute value
Unclosed Elements
testcase, testsuite, testsuites
Well Formed
false
Complete Testcases
2
Declared Tests
12
Line Endings
LF

Testing contract

Expected to fail
Scenario
Ingest a test report that was truncated while the runner was still writing it.
Expected result
XML parsing fails with an unexpected-end-of-document error and the build is marked as having no usable report — not as a passing two-test run.

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

“JUnit XML — Truncated Mid-Element (intentionally corrupt)” is a deterministic Novus Examples fixture for Error handling, Conversion testing, Log parsing. Deliberately corrupt and invalid files, clearly labelled, for testing how your tool fails.

Documented properties for this file: seed 61200 · damage: file ends inside an attribute value · LF · intentionally corrupt. 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("truncated-junit-results.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.