XML Format
xUnit.net exposes 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.
Important Note: Because the XML format evolves with newer versions of xUnit.net, there is no associated schema for the XML file. Users who consume XML, either for transforms or for version independent runners, must be conscious of the fact that some XML features may or may not be present, depending on the version of xunit.dll that was linked against the test project. Each element, its attributes, and its children, indicate which version of xunit.dll the values were introduced with.
Table of Contents
assembly element
| Element | Introduced |
| <assembly> | 1.0 |
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.
| Attribute | Introduced | Value |
| name | 1.0 | The fully qualified pathname of the assembly |
| run-date | 1.0 | The date the test run began |
| run-time | 1.0 | The time the test run began |
| time | 1.0 | The time, in fractional seconds, spent running tests |
| total | 1.0 | The number of tests run |
| passed | 1.0 | The number of tests that passed |
| failed | 1.0 | The number of tests that failed |
| skipped | 1.0 | The number of tests that were skipped |
| environment | 1.5 | The environment the tests were run in (32- vs. 64-bit and .NET version) |
| Child | Introduced | Value |
| <class> | 1.0 | [0..*] The classes run within this assembly |
class element
| Element | Introduced |
| <class> | 1.0 |
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>).
| Attribute | Introduced | Value |
| name | 1.0 | The full type name of the class |
| time | 1.0 | The time, in fractional seconds, spent running tests |
| total | 1.0 | The number of tests run |
| passed | 1.0 | The number of tests that passed |
| failed | 1.0 | The number of tests that failed |
| skipped | 1.0 | The number of tests that were skipped |
| Child | Introduced | Value |
| <test> | 1.0 | [0..*] Contains the tests run within this class |
| <failure> | 1.0 | [0..1] Contains fixture related failure info |
failure element
| Element | Introduced |
| <failure> | 1.0 |
A failure node describes a failure of a
class or
test.
| Attribute | Introduced | Value |
| exception-type | 1.1 | The full type name of the exception that was thrown |
| Child | Introduced | Value |
| <message> | 1.0 | [1] The exception message (in CDATA until 1.2) |
| <stack-trace> | 1.0 | [0..1] The stack trace of the exception (in CDATA until 1.2) |
reason element
| Element | Introduces |
| <reason> | 1.0 |
A reason node contains information about why a test was skipped.
| Child | Introduced | Value |
| <message> | 1.0 | [1] The reason the text was skipped (in CDATA until 1.2) |
start element
| Element | Introduced |
| <start> | 1.1 |
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.
| Attribute | Introduced | Value |
| name | 1.1 | The display name of the test |
| type | 1.1 | The full type name of the class |
| method | 1.1 | The name of the method |
test element
| Element | Introduced |
| <test> | 1.0 |
The test node contains information about a single test execution.
| Attribute | Introduced | Value |
| name | 1.0 | The display name of the test |
| type | 1.0 | The full type name of the class |
| method | 1.0 | The name of the method |
| result | 1.0 | One of "Pass", "Fail", or "Skip" |
| time | 1.0 | The time, in fractional seconds, spent running the test (not present for "Skip" results) |
| Child | Introduced | Value |
| <failure> | 1.0 | [0..1] Present if the test result is "Fail" |
| <reason> | 1.0 | [0..1] Present if the test result is "Skip" |
| <traits> | 1.0 | [0..1] Present if the test has any trait metadata |
| <output> | 1.1 | [0..1] Contains any text written to Console.Out or Console.Error (in CDATA until 1.2) |
trait element
| Element | Introduced |
| <trait> | 1.0 |
The trait node contains information about a single name/value pair of metadata about a
test.
| Attribute | Introduced | Value |
| name | 1.0 | The name of the trait |
| value | 1.0 | The value of the trait |
traits element
| Element | Introduced |
| <traits> | 1.0 |
The traits node contains zero or more
<trait> nodes which contain the metadata about a
test.
| Child | Introduced | Value |
| <trait> | 1.0 | [0..*] Nodes representing the traits of the [test|#test] |