Skip to content

Add unit tests with CI/CD automation and comprehensive test reporting #4

Add unit tests with CI/CD automation and comprehensive test reporting

Add unit tests with CI/CD automation and comprehensive test reporting #4

Workflow file for this run

name: Unit Tests
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Restore dependencies
run: dotnet restore http.sln
- name: Build
run: dotnet build http.sln --no-restore --configuration Release
- name: Run tests
run: dotnet test http.Tests/http.Tests.csproj --no-build --configuration Release --verbosity normal --logger "trx;LogFileName=test-results.trx" --collect:"XPlat Code Coverage" --results-directory ./TestResults
- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: test-results
path: TestResults/**/*.trx
retention-days: 30
- name: Upload coverage results
uses: actions/upload-artifact@v4
if: always()
with:
name: coverage-results
path: TestResults/**/coverage.cobertura.xml
retention-days: 30