Back to Xunit

xUnit.net XML Format v1

site/docs/format-xml-v1.md

latest5.0 KB
Original Source

xUnit.net v1 XML Format

[!NOTE] This documentation for the v1 XML format is provided for historical purposes only. New transformations should use the XML Format v2, which is the XML format used for transformations by xUnit.net v2 and v3.

xUnit.net v1 exposed XML in several ways:

  • As the native xUnit.net XML output;
  • As the XML document used for output transformations;
  • As the callback from Executor for version-resilient test runner authors.

The top level element of the document during transformation is the assembly element, and represents a single test assembly. During execution, the top level element will be the element currently being reported on.

<assembly>{ #assembly }

The assembly node contains information about the run of a test assembly. Transformations are handed a single assembly node as their XML document to transform against.

AttributeValue
environmentThe environment the tests were run in (32- vs. 64-bit and .NET version)
failedThe number of tests that failed
nameThe fully qualified pathname of the assembly
passedThe number of tests that passed
run-dateThe date the test run began
run-timeThe time the test run began
skippedThe number of tests that were skipped
timeThe time, in fractional seconds, spent running tests
totalThe number of tests run
ChildCardinalityPurpose
<class>0..*The classes run within the assembly

<class>{ #class }

The class node contains information about the tests run in a single test class. It also contains information about failures related to the class itself (i.e., during the creation or disposable of fixture data associated with IUseFixture<T>).

AttributeValue
failedThe number of tests that failed
nameThe full type name of the class
passedThe number of tests that passed
skippedThe number of tests that were skipped
timeThe time, in fractional seconds, spent running tests
totalThe number of tests run from the class
ChildCardinalityPurpose
<failure>0..1Contains fixture related failure info
<test>0..*Contains the tests run within this class

<failure>{ #failure }

A failure node describes a failure of a class or test.

AttributeValue
exception-typeThe full type name of the exception that was thrown
ChildCardinalityPurpose
<message>1The exception message
<stack-trace>0..1The stack trace of the exception

<reason>{ #reason }

A reason node contains information about why a test was skipped.

ChildCardinalityPurpose
<message>1The reason the test was skipped

<start>{ #start }

The start node is only available via Executor, not for Transformations. It indicates that a test is about to start running, and can be used to update runner status to indicate such.

AttributeValue
methodThe name of the method
nameThe display name of the test
typeThe full type name of the class

<test>{ #test }

The test node contains information about a single test execution.

AttributeValue
methodThe name of the method
nameThe display name of the test
resultOne of Pass, Fail, or Skip
timeThe time, in fractional seconds, spent running the test (not present for Skip results)
typeThe full type name of the class
ChildCardinalityPurpose
<failure>0..1Present if the test result is Fail
<output>0..1Contains any text was written to Console.Out or Console.Error
<reason>0..1Present if the test result is Skip
<traits>0..1Present if the test has any trait metadata

<trait>{ #trait }

The trait node contains information about a single name/value pair of metadata about a test.

AttributeValue
nameThe name of the trait
valueThe value of the trait

<traits>{ #traits }

The traits node contains zero or more trait nodes which contain the metadata about a test.

ChildCardinalityPurpose
<trait>0..*Nodes representing the traits of the test