Skip to content

dogguts/githubtestlogger

Repository files navigation

GitHub Test Logger

Unit Test logger for Visual Studio Test Platform (vstest) and GitHub actions

CI Release

Screenshot

Screenshot

Packages

Stable CI
GitHub.TestLogger Nuget GPR

Usage

Github Test Logger can report test results automatically to your GitHub workflow.

⚠️ This logger can only be used from within a GitHub workflow, since it requires several environment variables provided by GitHub to access the GitHub Api.

For a complete example: githubtestlogger-example

Add a reference to the GitHub Logger nuget package in your test project:

#Package manager
Install-Package GitHub.TestLogger -Version 1.0.0

or

#CLI
dotnet add package GitHub.TestLogger --version 1.0.0

Use the following command line in tests

dotnet test --logger "github;GITHUB_TOKEN=${{secrets.GITHUB_TOKEN}}"

Parameters

Parameters can be set with the command line, or through Environment variables.

Name Parameter Environment Default
Github token (mandatory) GITHUB_TOKEN [N/A] The github token that will be used to access the GitHub Api to publish the test results. Usually ${{secrets.GITHUB_TOKEN}}
Name (optional) name GHL_CHECKRUN_NAME The job name the test report will be published under. test-report

Eg. to publish test result with name "my-test-report":

dotnet test --logger "github;name=my-test-report;GITHUB_TOKEN=${{secrets.GITHUB_TOKEN}}"

LICENSE

MIT