Skip to content
Novus Examples
xml4.5 KB

TestNG — testng-results.xml

TestNG's own result document, with suite/test/class/test-method nesting, signature attributes and full stack traces in CDATA. TestNG has no error status, so the errored case is reported as FAIL and the header attributes read failed=2. Reports the same canonical run as the JUnit dialect files: 12 tests, 9 passed, 1 assertion failure, 1 error and 1 skip.

Preview — first 49 linesxml
<?xml version="1.0" encoding="UTF-8"?>
<testng-results ignored="0" total="12" passed="9" failed="2" skipped="1">
  <reporter-output/>
  <suite name="Checkout Suite" duration-ms="7450" started-at="2026-08-07T09:14:22Z" finished-at="2026-08-07T09:14:29Z">
    <test name="cart" duration-ms="2400" started-at="2026-08-07T09:14:22Z" finished-at="2026-08-07T09:14:24Z">
      <class name="cart.PricingTest">
        <test-method status="PASS" signature="appliesUnitPrice()[pri:0, instance:cart.PricingTest@1a2b]" name="appliesUnitPrice" duration-ms="643" started-at="2026-08-07T09:14:22Z" finished-at="2026-08-07T09:14:23Z"/>
        <test-method status="PASS" signature="appliesQuantityMultiplier()[pri:0, instance:cart.PricingTest@1a2b]" name="appliesQuantityMultiplier" duration-ms="659" started-at="2026-08-07T09:14:22Z" finished-at="2026-08-07T09:14:23Z"/>
        <test-method status="PASS" signature="roundsHalfUpAtTwoDecimals()[pri:0, instance:cart.PricingTest@1a2b]" name="roundsHalfUpAtTwoDecimals" duration-ms="1042" started-at="2026-08-07T09:14:22Z" finished-at="2026-08-07T09:14:23Z"/>
        <test-method status="PASS" signature="rejectsNegativeQuantity()[pri:0, instance:cart.PricingTest@1a2b]" name="rejectsNegativeQuantity" duration-ms="1048" started-at="2026-08-07T09:14:22Z" finished-at="2026-08-07T09:14:23Z"/>
        <test-method status="FAIL" signature="appliesTaxToSubtotal()[pri:0, instance:cart.PricingTest@1a2b]" name="appliesTaxToSubtotal" duration-ms="352" started-at="2026-08-07T09:14:22Z" finished-at="2026-08-07T09:14:23Z">
          <exception class="java.lang.AssertionError">
            <message><![CDATA[expected:<12.60> but was:<12.59>]]></message>
            <full-stacktrace><![CDATA[java.lang.AssertionError: expected:<12.60> but was:<12.59>
	at cart.PricingTest.appliesTaxToSubtotal(PricingTest.java:88)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
]]></full-stacktrace>
          </exception>
        </test-method>
      </class>
    </test>
    <test name="cart" duration-ms="2400" started-at="2026-08-07T09:14:22Z" finished-at="2026-08-07T09:14:24Z">
      <class name="cart.DiscountTest">
        <test-method status="PASS" signature="appliesPercentageDiscount()[pri:0, instance:cart.DiscountTest@1a2b]" name="appliesPercentageDiscount" duration-ms="147" started-at="2026-08-07T09:14:22Z" finished-at="2026-08-07T09:14:23Z"/>
        <test-method status="PASS" signature="stacksDiscountsInDeclaredOrder()[pri:0, instance:cart.DiscountTest@1a2b]" name="stacksDiscountsInDeclaredOrder" duration-ms="327" started-at="2026-08-07T09:14:22Z" finished-at="2026-08-07T09:14:23Z"/>
        <test-method status="PASS" signature="ignoresExpiredCoupon()[pri:0, instance:cart.DiscountTest@1a2b]" name="ignoresExpiredCoupon" duration-ms="893" started-at="2026-08-07T09:14:22Z" finished-at="2026-08-07T09:14:23Z"/>
        <test-method status="SKIP" signature="appliesLoyaltyTier()[pri:0, instance:cart.DiscountTest@1a2b]" name="appliesLoyaltyTier" duration-ms="700" started-at="2026-08-07T09:14:22Z" finished-at="2026-08-07T09:14:23Z">
          <reporter-output>loyalty tiers are disabled in the CI profile</reporter-output>
        </test-method>
      </class>
    </test>
    <test name="checkout" duration-ms="2400" started-at="2026-08-07T09:14:22Z" finished-at="2026-08-07T09:14:24Z">
      <class name="checkout.SessionTest">
        <test-method status="PASS" signature="createsSessionForNewCart()[pri:0, instance:checkout.SessionTest@1a2b]" name="createsSessionForNewCart" duration-ms="783" started-at="2026-08-07T09:14:22Z" finished-at="2026-08-07T09:14:23Z"/>
        <test-method status="FAIL" signature="expiresSessionAfterTimeout()[pri:0, instance:checkout.SessionTest@1a2b]" name="expiresSessionAfterTimeout" duration-ms="695" started-at="2026-08-07T09:14:22Z" finished-at="2026-08-07T09:14:23Z">
          <exception class="java.net.ConnectException">
            <message><![CDATA[Connection refused: sessions.example.com:5432]]></message>
            <full-stacktrace><![CDATA[java.net.ConnectException: Connection refused: sessions.example.com:5432
	at checkout.SessionStore.open(SessionStore.java:41)
	at checkout.SessionTest.expiresSessionAfterTimeout(SessionTest.java:57)
]]></full-stacktrace>
          </exception>
        </test-method>
        <test-method status="PASS" signature="restoresCartOnResume()[pri:0, instance:checkout.SessionTest@1a2b]" name="restoresCartOnResume" duration-ms="161" started-at="2026-08-07T09:14:22Z" finished-at="2026-08-07T09:14:23Z"/>
      </class>
    </test>
  </suite>
</testng-results>

Specifications

Seed
61200
Encoding
UTF-8
Line Endings
LF
Format
TestNG results
Total
12
Passed
9
Failed
2
Skipped
1
Ignored
0
Error Mapping
no error status; the errored case is reported as FAIL

Testing contract

Expected to pass
Scenario
Extract per-class outcomes from a TestNG result document.
Expected result
Three classes are found holding 12 test-methods, with the errored case reported as FAIL carrying a java.net.ConnectException exception element.

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

“TestNG — testng-results.xml” is a deterministic Novus Examples fixture for Conversion testing, Log parsing, Error handling. 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 · 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("testng-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.