← All install guides

Agent-friendly version of this page: /install/dotnet.md

Installing TestGlance for .NET (xUnit / NUnit / MSTest)

1. Make tests emit JUnit XML

dotnet test doesn't emit JUnit XML on its own. Add the JUnit logger NuGet package to every test project:

# from repo root
dotnet add <PathToTestProject>/<Test>.csproj package JunitXml.TestLogger

…or add it to Directory.Packages.props / each test .csproj:

<ItemGroup>
  <PackageReference Include="JunitXml.TestLogger" Version="*" />
</ItemGroup>

Then run tests with the junit logger:

mkdir -p test-results
dotnet test --logger "junit;LogFilePath=test-results/{assembly}.xml"

{assembly} expands per project so multi-project solutions don't overwrite each other. The JunitXml.TestLogger package works with xUnit, NUnit, and MSTest.

2. Add the TestGlance step to CI

If the project already has a CI workflow that runs the tests, add this step to the test job (after the test step), and merge the permissions: block at the workflow's top level:

permissions:
  contents: read
  pull-requests: write
 
# ...inside the test job, after the test step:
- uses: testglance/action@v1
  if: always()
  with:
    github-token: ${{ github.token }}

If no CI workflow runs the tests yet, create .github/workflows/testglance.yml that runs the project's tests and then runs the TestGlance step.

if: always() matters — TestGlance should still run when tests fail. TestGlance auto-discovers anything matching **/test-results/*.xml, so no report-path is needed when reports land under test-results/.

3. Confirm with the user before committing

Summarize the diff and ask the user to confirm before staging or committing. Do not push.