Skip to content
Novus Examples
xml558 B

JUnit XML — Console Output in CDATA

Captured stdout and stderr wrapped in CDATA, where the stdout text itself looks like XML markup. A parser must treat the CDATA content as opaque characters; one that re-parses it finds a <report> element that does not exist.

Preview — first 11 linesxml
<?xml version="1.0" encoding="UTF-8"?>
<testsuite name="cart.PricingTest" tests="2" failures="0" errors="0" skipped="0" time="0.198">
  <testcase classname="cart.PricingTest" name="appliesUnitPrice" time="0.121"/>
  <testcase classname="cart.PricingTest" name="roundsHalfUpAtTwoDecimals" time="0.077"/>
  <system-out><![CDATA[<report status="partial">not real markup, just log text</report>
[INFO] wrote target/surefire-reports/cart.PricingTest.txt
]]></system-out>
  <system-err><![CDATA[WARNING: discount table cache was cold
]]></system-err>
</testsuite>

Specifications

Seed
61200
Encoding
UTF-8
Line Endings
LF
Tests
2
Has System Out
true
Has System Err
true
Cdata Contains Markup
true

Testing contract

Expected to pass
Scenario
Read captured console output that contains angle brackets inside CDATA.
Expected result
system-out is returned as literal text including the <report …> line, and no child element is created from it.

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 — Console Output in CDATA” is a deterministic Novus Examples fixture for Log parsing, Error handling, Conversion testing. Access logs and JSON-lines application logs — for testing log parsers, tailers, and ingestion pipelines.

Documented properties for this file: seed 61200 · UTF-8 · LF. 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("structure-system-out-cdata.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.