Extension for VSTest and Microsoft.Testing.Platform that reports test results to GitHub Actions
$ dotnet add package GitHubActionsTestLogger✅ Project status: active. What does it mean?
Custom logger for dotnet test that reports test results in a structured format that GitHub Actions understands.
When using this logger, failed tests are listed in workflow annotations and highlighted in code diffs.
💬 If you want to chat, join my Discord server.
📦 NuGet: dotnet add package GitHubActionsTestLogger

To use GitHub Actions Test Logger, follow these steps:
--logger GitHubActions to dotnet test:name: CI
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2.3.3
- name: Install .NET
uses: actions/setup-dotnet@v1.7.2
with:
dotnet-version: 5.0.x
- name: Build & test
run: dotnet test --configuration Release --logger GitHubActions
⚠️ Ensure that your test project references Microsoft.NET.Test.Sdk version 16.8.0 or higher. Older versions of this package may not work properly with custom test loggers.
⚠️ If you are using .NET SDK v2.2 or lower, you need to enable
<CopyLocalLockFileAssemblies>property in your test project.
GitHub Actions Test Logger has a few options that you can override to customize its behavior.
In order to pass an option to the logger, include it as an additional parameter inside --logger:
dotnet test --logger "GitHubActions;option1=foo;option2=bar"
formatSpecifies the format used when logging test results to the console.
The following replacement tokens are available:
$test -- replaced with the display name of the test$outcome -- replaced with the error message (in case of an exception) or the outcome of the test$traits.TRAIT_NAME -- replaced with the value of a trait named TRAIT_NAMEDefault: $test: $outcome.
Examples:
$test: $outcome -> MyTests.Test1: AssertionException: Expected 'true' but found 'false'[$traits.Category] $test: $outcome -> [UI Tests] MyTests.Test1: AssertionException: Expected 'true' but found 'false'report-warningsSpecifies whether to additionally report warnings for tests that have neither failed nor succeeded (i.e. skipped or inconclusive). If disabled, only failed tests will be reported.
Can be set to either true or false.
Default: true.