Skip to content

Latest commit

 

History

History
47 lines (37 loc) · 1.15 KB

README.md

File metadata and controls

47 lines (37 loc) · 1.15 KB

test-summary example: .NET

This produces a test summary for a .NET Core project.

Prerequisites

This makes use of JunitXml.TestLogger which allows dotnet test to emit JUnit XML output. To install this in your test package:

dotnet add package JunitXml.TestLogger --version 3.0.110

GitHub Actions Workflow

An example GitHub Actions workflow that builds a .NET Core project, runs the tests, runs the test-summary action and uploads the test summary markdown as an artifact.

name: Build and Test .NET Core

on:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]
  workflow_dispatch:

jobs:
  build:
    name: Build and Test
    runs-on: ubuntu-latest

    steps:
      - name: Check out repository
        uses: actions/checkout@v3
      - name: Build and test
        run: |
          dotnet build
          dotnet test --logger "junit;LogFilePath=results/tests.xml"
      - name: Create test summary
        uses: test-summary/action@dist
        with:
          paths: results/**/*.xml
        if: always()