xUnit.net v2 XML Format

Several runners—including the console, MSBuild, and DNX runners—are capable of generating XML reports after tests have been run. Some of those runners also support running XSL-T transformations against that XML (some built-in examples include transformations to HTML and NUnit format). This page documents the format of the XML emitted from v2 runners.

The top level element of the document is the assemblies element.

Elements

Note: The XML format changed from v1 to v2. If you are looking for documentation on the old v1 format, the CodePlex site still contains that documentation.

The assemblies element is the top-level element of the document.

Child Elements

ElementCardinalityPurpose
<assembly> 0..* One child element for each test assembly

The assembly element contains information about the run of a single test assembly. This includes environmental information.

Attributes

NameValue
name The fully qualified path name of the test assembly.
config-file The fully qualified path name of the test assembly configuration file.
test-framework The display name of the test framework that ran the tests.
environment The runtime environment in which the tests were run.
run-date The date when the test run started, in yyyy-mm-dd format.
run-time The time when the test run started, in 24-hour hh:mm:ss format.
time The number of seconds the assembly run took, in decimal format.
total The total number of test cases run in the assembly.
passed The total number of test cases in the assembly which passed.
failed The total number of test cases in the assembly which failed.
skipped The total number of test cases in the assembly that were skipped.
errors The total number of environmental errors experienced in the assembly.

Child Elements

ElementCardinalityPurpose
<errors> 0..1 Container for the environmental errors experienced in the test assembly.
<collection> 0..* One collection element for every test collection in the test assembly.

The collection element contains information about the run of a single test collection.

Attributes

NameValue
name The name of the test collection.
time The number of seconds the test collection run took, in decimal format.
total The total number of test cases run in the test collection.
passed The total number of test cases in the test collection which passed.
failed The total number of test cases in the test collection which failed.
skipped The total number of test cases in the test collection that were skipped.

Child Elements

ElementCardinalityPurpose
<test> 1..* One test element for every test in the test collection.

The error element contains information about an environment failure that happened outside the scope of running a single unit test (for example, an exception thrown while disposing of a fixture object).

Attributes

NameValue
type A code which indicates what kind of failure it is.
name The name of the item that caused the failure.

Child Elements

ElementCardinalityPurpose
<failure> 1 Contains information about the failure.

The errors element is a container for 0 or more error elements.

Child Elements

ElementCardinalityPurpose
<error> 0..* One error element for every environmental error that occurred.

The failure element contains information a test failure.

Attributes

NameValue
exception-type The fully qualified type name of the exception that caused the failure.

Child Elements

ElementCardinalityPurpose
<message> 0..1 The failure message as a CDATA block.
<stack-trace> 0..1 The stack trace as a CDATA block.

The test element contains information about the run of a single test.

Attributes

NameValue
name The display name of the test.
type The fully qualified type name of the class that contained the test.
method The name of the method that contained the test.
time The number of seconds the test run took, in decimal format.
result The result of the test. Valid values include Pass, Fail, and Skip.

Child Elements

ElementCardinalityPurpose
<traits> 0..1 Container for 1 or more trait elements.
<failure> 0..1 For failing tests, contains information about the failure.
<reason> 0..1 For a skipped test, contains the reason text as a CDATA block.

The trait element contains a single trait name/value pair.

Attributes

NameValue
name The name of the trait
value The value of the trait

The traits element is a container for 1 or more trait elements.

Child Elements

ElementCardinalityPurpose
<trait> 1..* One trait element for every trait name/value pair associated with the test.
Copyright © 2017 .NET Foundation. Contributions welcomed at https://github.com/xunit/xunit.github.io.