What is the TRX file format?
A .trx file is an XML-based test results file generated by the Microsoft Visual Studio test infrastructure. The format was introduced with Visual Studio .NET 2003 and the MSTest framework, and it remains the default output format for both mstest.exe and the cross-platform dotnet test runner.
The file is a plain UTF-8 XML document whose root element is <TestRun> within a Microsoft-specific XML namespace. Inside, it records <TestSettings> (run configuration), <TestDefinitions> (test method names and assemblies), <Results> with one <UnitTestResult> per test case (outcome, duration, timestamps, error messages, stack traces), and a <ResultSummary> with aggregate Passed/Failed/Inconclusive counts. The schema is defined in vstst.xsd, which ships with Visual Studio in the Common7/IDE/ directory.
.trx files are not created automatically - they require explicit logger configuration. To generate one, pass --logger trx to dotnet test, or supply the equivalent flag to mstest.exe. Azure DevOps and TFS parse .trx files natively through the Publish Test Results task, rendering pass/fail reports in the pipeline UI.
Because .trx is an XML format, any text editor can open it. Visual Studio Code with the C# Dev Kit provides richer visualization. The format is Microsoft-centric; cross-platform CI systems such as GitHub Actions or Jenkins typically prefer JUnit XML test reports. Since Visual Studio 2022 and the .NET SDK, .trx generation is also supported on Linux and macOS via dotnet test.
Security & safety
RISK: LOWTRX files are plain UTF-8 XML - they contain test results, not executable code. Opening them in Visual Studio, VS Code, or a text editor is completely safe. Do not use third-party 'TRX viewer' downloads of unknown origin; they are unnecessary and may bundle adware. Visual Studio Community (free) or VS Code (free, open source) are the safe and sufficient openers.
Format details
in a nutshellPrograms that open TRX files
Technical details
deep spec| File type | UTF-8 XML document (plain text) |
| Root XML element | `<TestRun>` in the Microsoft vstst XML namespace |
| Schema file | `vstst.xsd` - ships with Visual Studio in `Common7/IDE/` |
| Generator command | `dotnet test --logger trx` or `mstest.exe /logger:trx` |
| Typical file size | 5 KB - 10 MB (scales with test count and stack trace verbosity) |
| Per-test record element | `<UnitTestResult>` - stores outcome, duration, timestamps, error message, and stack trace |
| Summary element | `<ResultSummary>` - aggregate Passed, Failed, Inconclusive, and Total counts |
| Results container | `<Results>` element holding all `<UnitTestResult>` children |
| Not generated by default | Requires explicit `--logger trx` flag; not created on a plain `dotnet test` run |
| Platform support | Windows, Linux, macOS (via cross-platform .NET SDK) |
| Azure DevOps integration | Natively parsed by the Publish Test Results pipeline task |
| Cross-platform CI format | JUnit XML preferred by non-Microsoft CI systems (GitHub Actions, Jenkins, GitLab CI) |
| Generator format variation | TRX from `mstest.exe` differs slightly from TRX produced by `dotnet test`; both are valid |
| Compression | None - plain XML; large test suites with stack traces can produce multi-MB files |
| Released | 2003 (Visual Studio .NET 2003, MSTest framework) |
| Latest version | vstst.xsd schema current as of Visual Studio 2022; vstest also generates TRX in .NET SDK 2026 |
| Specification | learn.microsoft.com |
TRX conversions
Community Q&A
asked by usersNo questions yet - be the first to ask about TRX files.