TRX
The run as a Visual Studio test-results file (.trx) — the format Azure DevOps' Publish Test Results task, Visual Studio and VS Code read.
On this page
When to use it
On Azure DevOps, when the results should appear on the pipeline’s Tests tab with the charts and the per-test detail — the Publish Test Results task reads .trx natively (testResultsFormat: VSTest). Also when someone opens results in Visual Studio or VS Code. Outside the Microsoft tooling the format is rarely read; use JUnit there. Like JUnit it carries result and message, not the full definition.
How to set it
Output: trx
writes TestResults/cat-test-results-{timestamp}.trx. In a pipeline, a fixed name or a wildcard in the publish step:
Output:
- Format: trx
File: TestResults/cat-results.trx
See Settings. Not available on the Starter and Professional plans (MS Excel only). The Azure DevOps steps are in Integrations.
What it looks like
The sample run — the results section and the summary; the TestDefinitions, TestEntries and TestLists sections that the schema requires are left out here:
<TestRun id="3aa327e9-c934-4f29-a6cc-b6d69389bbaf" name="build@build-agent-01 2026-08-21 09:06:37" runUser="build-agent-01\build" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010">
<Times creation="2026-08-21T09:06:37.4369592+00:00" queuing="2026-08-21T09:06:37.4369592+00:00" start="2026-08-21T09:06:37.4369592+00:00" finish="2026-08-21T09:06:44.7333889+00:00" />
<Results>
<UnitTestResult executionId="2ecab40f-…" testId="aa6f2ccd-…" testName="[Smoke tests].[Airline dimension matches the source]" computerName="build-agent-01" duration="00:00:00.0755756" startTime="2026-08-21T09:06:38.2510955+00:00" endTime="2026-08-21T09:06:38.3266711+00:00" testType="13cdc9d9-ddb5-4fa4-a97d-d965ccfc6d4b" outcome="Passed" testListId="49c5253e-…" relativeResultsDirectory="2ecab40f-…" />
<UnitTestResult executionId="2ecab40f-…" testId="a1a02f1a-…" testName="[Data quality].[No booking without a passenger]" computerName="build-agent-01" duration="00:00:00.1389169" startTime="2026-08-21T09:06:38.3346170+00:00" endTime="2026-08-21T09:06:38.4735339+00:00" testType="13cdc9d9-ddb5-4fa4-a97d-d965ccfc6d4b" outcome="Failed" testListId="49c5253e-…" relativeResultsDirectory="2ecab40f-…">
<Output>
<ErrorInfo>
<Message>No row was expected, but at least 1 row exists.
MaximumErrorsLogged setting is set to 1. To see more data in the error message, set it to value between 2 and 50.
If the logs should not contain any data, set MaximumErrorsLogged to 0.
┌──────────┬────────┐
│BookingId │Airline │
╞══════════╪════════╡
│BK-1001 │CSA │
└──────────┴────────┘
CAT did NOT scan the entire set. There may be additional rows.
Description: A booking must reference an existing passenger.
First Data Source: DWH
First Query:
SELECT &#39;BK-1001&#39; AS BookingId, &#39;CSA&#39; AS Airline UNION ALL SELECT &#39;BK-1002&#39;, &#39;LH&#39;
</Message>
<StackTrace></StackTrace>
</ErrorInfo>
</Output>
</UnitTestResult>
<UnitTestResult executionId="2ecab40f-…" testId="6c267cc3-…" testName="[Smoke tests].[Flights table is loaded]" computerName="build-agent-01" duration="00:00:06.2492205" startTime="2026-08-21T09:06:38.4778644+00:00" endTime="2026-08-21T09:06:44.7270849+00:00" testType="13cdc9d9-ddb5-4fa4-a97d-d965ccfc6d4b" outcome="Failed" testListId="49c5253e-…" relativeResultsDirectory="2ecab40f-…">
<Output>
<ErrorInfo>
<Message>Error when executing the test: Invalid object name &#39;dbo.Flights&#39;.
Description:
First Data Source: DWH
First Query:
SELECT * FROM dbo.Flights
</Message>
<StackTrace></StackTrace>
</ErrorInfo>
</Output>
</UnitTestResult>
</Results>
…
<ResultSummary outcome="Failed">
<Counters total="3" executed="3" passed="1" failed="1" error="1" timeout="0" aborted="0" inconclusive="0" … />
</ResultSummary>
</TestRun>
Details
Structure. The Visual Studio TestRun schema: Times of the run, one UnitTestResult per test under Results (name = the test’s full name, duration, startTime, endTime, outcome), then TestDefinitions, TestEntries and TestLists the schema needs, and ResultSummary with the counters. computerName is the machine that ran the test; runUser the account.
Result mapping.
| Result | outcome |
Message |
|---|---|---|
Passed |
Passed |
none |
Failed |
Failed |
ErrorInfo/Message: the complete message |
Error |
Failed |
ErrorInfo/Message: Error when executing the test: … plus description and queries |
Inconclusive |
Failed |
ErrorInfo/Message: the reason |
The schema’s outcome has no slot CAT maps Error and Inconclusive to, so both come out Failed; the message tells them apart, and ResultSummary still counts error separately. The message text is HTML-encoded once more inside the XML (&#39; for an apostrophe), which the readers undo.
Written once, after the run. The Publish Test Results task publishes whatever the file says; set Fail if there are test failures on the task when a failed test should fail the pipeline.
Related
- JUnit — the format every other CI platform reads.
- Azure DevOps — the pipeline, step by step.