A .NET library for creating, parsing, and manipulating Visual Studio test playlist files. Supports advanced playlist building and integration with test runners.
$ dotnet add package trx-to-vsplaylistA command-line tool for converting TRX test result files into Visual Studio Test Playlist (V1) files. Supports filtering by test outcome, merging multiple TRX files, and combining existing playlists with automatic de-duplication.
.trx test result files to Visual Studio .playlist files (V1 format)--separate option--skip-empty optionconvert - Convert TRX file(s) to a playlistConverts one or more TRX test result files into a Visual Studio Test Playlist. When multiple TRX files are provided, tests are automatically de-duplicated by default.
<trx-files>: Path(s) to the TRX file(s) to convert (one or more required)--output, -o: Path to the output playlist file or directory (optional). If not specified, the playlist will be saved in the same directory as the first TRX file with the same name but .playlist extension. When a directory is specified, the output file will be created in that directory.--outcome, -f: Test outcomes to include (optional, repeatable). Accepts one or more of: Passed, Failed, Skipped, NotExecuted, etc.--skip-empty: Do not create a playlist file if there are no tests (optional)--separate: When multiple TRX files are provided, create separate playlist files for each instead of merging into one. Output path must be a directory (optional)Convert a single TRX file with all tests:
trx-to-vsplaylist convert results.trx
Convert a single TRX file to a specific directory:
trx-to-vsplaylist convert results.trx --output OutputDir
Convert only failed tests to a playlist:
trx-to-vsplaylist convert results.trx --outcome Failed
Convert passed and failed tests, specifying output file:
trx-to-vsplaylist convert results.trx --outcome Passed Failed --output my_playlist.playlist
Merge multiple TRX files (e.g., from different target frameworks) into a single playlist (default behavior):
trx-to-vsplaylist convert test-net8.0.trx test-net6.0.trx test-net48.trx --output merged.playlist
Merge multiple TRX files with only failed tests:
trx-to-vsplaylist convert test-net8.0.trx test-net6.0.trx --outcome Failed --output failures.playlist
Create separate playlists from multiple TRX files (output must be a directory):
trx-to-vsplaylist convert test-net8.0.trx test-net6.0.trx --output OutputDir --separate
Create separate playlists with only failed tests, skipping empty ones:
trx-to-vsplaylist convert test-net8.0.trx test-net6.0.trx --outcome Failed --separate --skip-empty --output OutputDir
Skip creating a playlist if no tests match the filter:
trx-to-vsplaylist convert results.trx --outcome Failed --skip-empty
--output can be either a file path or a directory. If it's a directory, the playlist will be created in that directory with the same name as the TRX file.--separate with multiple TRX files, --output must be a directory, not a file path. This will create one playlist per TRX file in that directory.--output can be a file path or directory. If it's a directory, the merged playlist will be created with the name of the first TRX file.merge - Merge playlist filesMerges multiple existing playlist files into a single playlist with automatic de-duplication of tests. Supports file globbing patterns for easy batch operations.
<playlist-files>: Path(s) or glob pattern(s) to the playlist file(s) to merge (one or more required). Supports wildcards like *.playlist or **/*.playlist--output, -o: Path to the output merged playlist file or directory (optional when all input files are in the same directory)
merged.playlist in that directory.playlist) are treated as file paths\ or /) are treated as directory paths--skip-empty: Do not create a playlist file if there are no tests (optional)The merge command supports file globbing patterns using standard wildcards:
* matches zero or more characters (except directory separators)** matches any number of directory levels (recursive search)
https://learn.microsoft.com/dotnet/core/extensions/file-globbing?WT.mc_id=8B97120A00B57354Merge multiple playlist files with explicit output:
trx-to-vsplaylist merge playlist1.playlist playlist2.playlist playlist3.playlist --output combined.playlist
Merge to a specific directory:
trx-to-vsplaylist merge playlist1.playlist playlist2.playlist --output C:\Users\foo\Downloads\playlists
# Creates C:\Users\foo\Downloads\playlists\merged.playlist
Recursively find and merge all playlists:
trx-to-vsplaylist merge "TestResults\**\*.playlist" --output ./all-frameworks.playlist
When a project targets multiple frameworks (e.g., net8.0, net6.0, net48), running tests generates separate TRX files for each framework. Use the convert command with multiple TRX files to create a single, de-duplicated playlist:
trx-to-vsplaylist convert \
TestResults/MyProject_net8.0.trx \
TestResults/MyProject_net6.0.trx \
TestResults/MyProject_net48.trx \
--outcome Failed \
--output failed-tests.playlist
Alternatively, create separate playlists for each framework:
trx-to-vsplaylist convert \
TestResults/MyProject_net8.0.trx \
TestResults/MyProject_net6.0.trx \
TestResults/MyProject_net48.trx \
--outcome Failed \
--output TestResults \
--separate
Generate a playlist of all failed tests across multiple test runs:
Option 1: Direct conversion (recommended)
trx-to-vsplaylist convert proj1-results.trx proj2-results.trx --outcome Failed --output all-failures.playlist
Option 2: Convert then merge
# Convert each TRX to a playlist
trx-to-vsplaylist convert proj1-results.trx --outcome Failed --output proj1-failures.playlist
trx-to-vsplaylist convert proj2-results.trx --outcome Failed --output proj2-failures.playlist
# Merge all failure playlists
trx-to-vsplaylist merge proj1-failures.playlist proj2-failures.playlist --output all-failures.playlist
Create individual playlists for each TRX file while filtering:
trx-to-vsplaylist convert \
*.trx \
--outcome Failed Skipped \
--output playlists \
--separate \
--skip-empty
This creates one playlist per TRX file in the playlists directory, containing only failed and skipped tests, and skips files with no matching tests.
The following values are supported for the --outcome option (case-insensitive):
PassedFailedSkippedNotExecutedInconclusiveTimeoutPendingWhen multiple TRX or playlist files are merged, tests are automatically de-duplicated by their fully qualified test name (case-insensitive comparison). This is especially useful when:
MIT License. See LICENSE for details.