Skip to content

Commit

Permalink
Generate HTML Test Results report with built-in Logger
Browse files Browse the repository at this point in the history
  • Loading branch information
jrnelson90 committed Dec 6, 2023
1 parent 88a2e31 commit cbf0e79
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 31 deletions.
14 changes: 4 additions & 10 deletions .github/workflows/4_6_2_Core_Unit_Tests_Win.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,7 @@ jobs:
- name: Setup .NET Core
uses: actions/setup-dotnet@master
with:
dotnet-version: |
3.1.x
${{ env.DOTNET_VERSION }}
dotnet-version: ${{ env.DOTNET_VERSION }}

- name: Setup Step CLI
run: "Invoke-WebRequest -Method 'GET' -uri 'https://dl.smallstep.com/gh-release/cli/docs-cli-install/v0.24.4/step_windows_0.24.4_amd64.zip' -Outfile 'C:\\temp\\step_windows_0.24.4_amd64.zip'; tar -oxzf C:\\temp\\step_windows_0.24.4_amd64.zip -C 'C:\\Program Files';"
Expand All @@ -73,10 +71,6 @@ jobs:
- name: Install ReportGenerator Coverage Tool
run: dotnet tool install --global dotnet-reportgenerator-globaltool --version 5.2.0

- name: Install TrxToHtml Tool
run: dotnet tool install -g Samhammer.TrxToHtml
working-directory: ./certify/src/Certify.Tests/Certify.Core.Tests.Unit

- name: Install Dependencies
run: dotnet restore
working-directory: ./certify/src/Certify.Tests/Certify.Core.Tests.Unit
Expand All @@ -86,11 +80,11 @@ jobs:
working-directory: ./certify/src/Certify.Tests/Certify.Core.Tests.Unit

- name: Run Certify.Core.Tests.Unit Tests
run: dotnet test Certify.Core.Tests.Unit.dll -v normal -f net462 --logger trx --collect:"XPlat Code Coverage" --results-directory "TestResults-4_6_2-${{ runner.os }}" /testadapterpath:C:\%HOMEPATH%\.nuget\packages\coverlet.collector\6.0.0\build\netstandard1.0
run: dotnet test Certify.Core.Tests.Unit.dll -v normal -f net462 --logger trx --logger html --collect:"XPlat Code Coverage" --results-directory "TestResults-4_6_2-${{ runner.os }}" /testadapterpath:C:\%HOMEPATH%\.nuget\packages\coverlet.collector\6.0.0\build\netstandard1.0
working-directory: ./certify/src/Certify.Tests/Certify.Core.Tests.Unit/bin/Debug/net462

- name: Generated HTML Reports
run: trx-to-html && reportgenerator -reports:./certify/src/Certify.Tests/Certify.Core.Tests.Unit/bin/Debug/net462/TestResults-4_6_2-${{ runner.os }}/**/coverage.cobertura.xml -targetdir:./certify/src/Certify.Tests/Certify.Core.Tests.Unit/bin/Debug/net462/TestResults-4_6_2-${{ runner.os }}
- name: Generated HTML Coverage Report
run: reportgenerator -reports:./certify/src/Certify.Tests/Certify.Core.Tests.Unit/bin/Debug/net462/TestResults-4_6_2-${{ runner.os }}/**/coverage.cobertura.xml -targetdir:./certify/src/Certify.Tests/Certify.Core.Tests.Unit/bin/Debug/net462/TestResults-4_6_2-${{ runner.os }}

- name: Upload Certify.Core.Tests.Unit Test Results
uses: actions/upload-artifact@master
Expand Down
16 changes: 5 additions & 11 deletions .github/workflows/8_0_Core_Unit_Tests_Linux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,7 @@ jobs:
- name: Setup .NET Core
uses: actions/setup-dotnet@master
with:
dotnet-version: |
3.1.x
${{ env.DOTNET_VERSION }}
dotnet-version: ${{ env.DOTNET_VERSION }}

- name: Setup Step CLI
run: wget https://dl.smallstep.com/gh-release/cli/docs-cli-install/v0.23.0/step-cli_0.23.0_amd64.deb && sudo dpkg -i step-cli_0.23.0_amd64.deb
Expand All @@ -67,11 +65,7 @@ jobs:
run: docker pull smallstep/step-ca

- name: Install ReportGenerator Coverage Tool
run: dotnet tool install --global dotnet-reportgenerator-globaltool --version 5.2.0

- name: Install TrxToHtml Tool
run: dotnet tool install -g Samhammer.TrxToHtml
working-directory: ./certify/src/Certify.Tests/Certify.Core.Tests.Unit
run: dotnet tool install --global dotnet-reportgenerator-globaltool --version 5.2.0

- name: Install Dependencies
run: dotnet restore
Expand All @@ -82,11 +76,11 @@ jobs:
working-directory: ./certify/src/Certify.Tests/Certify.Core.Tests.Unit

- name: Run Certify.Core.Tests.Unit Tests
run: dotnet test Certify.Core.Tests.Unit.dll -v normal -f net8.0 --logger trx --collect:"XPlat Code Coverage" --results-directory "TestResults-8_0-${{ runner.os }}" /testadapterpath:$HOME/.nuget/packages/coverlet.collector/6.0.0/build/netstandard1.0
run: dotnet test Certify.Core.Tests.Unit.dll -v normal -f net8.0 --logger trx --logger html --collect:"XPlat Code Coverage" --results-directory "TestResults-8_0-${{ runner.os }}" /testadapterpath:$HOME/.nuget/packages/coverlet.collector/6.0.0/build/netstandard1.0
working-directory: ./certify/src/Certify.Tests/Certify.Core.Tests.Unit/bin/Debug/net8.0

- name: Generated HTML Reports
run: trx-to-html && reportgenerator -reports:./certify/src/Certify.Tests/Certify.Core.Tests.Unit/bin/Debug/net8.0/TestResults-8_0-${{ runner.os }}/**/coverage.cobertura.xml -targetdir:./certify/src/Certify.Tests/Certify.Core.Tests.Unit/bin/Debug/net8.0/TestResults-8_0-${{ runner.os }}
- name: Generated HTML Coverage Report
run: reportgenerator -reports:./certify/src/Certify.Tests/Certify.Core.Tests.Unit/bin/Debug/net8.0/TestResults-8_0-${{ runner.os }}/**/coverage.cobertura.xml -targetdir:./certify/src/Certify.Tests/Certify.Core.Tests.Unit/bin/Debug/net8.0/TestResults-8_0-${{ runner.os }}

- name: Upload Certify.Core.Tests.Unit Test Results and Coverage
uses: actions/upload-artifact@master
Expand Down
14 changes: 4 additions & 10 deletions .github/workflows/8_0_Core_Unit_Tests_Win.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,7 @@ jobs:
- name: Setup .NET Core
uses: actions/setup-dotnet@master
with:
dotnet-version: |
3.1.x
${{ env.DOTNET_VERSION }}
dotnet-version: ${{ env.DOTNET_VERSION }}

- name: Setup Step CLI
run: "Invoke-WebRequest -Method 'GET' -uri 'https://dl.smallstep.com/gh-release/cli/docs-cli-install/v0.24.4/step_windows_0.24.4_amd64.zip' -Outfile 'C:\\temp\\step_windows_0.24.4_amd64.zip'; tar -oxzf C:\\temp\\step_windows_0.24.4_amd64.zip -C 'C:\\Program Files';"
Expand All @@ -72,10 +70,6 @@ jobs:
- name: Install ReportGenerator Coverage Tool
run: dotnet tool install --global dotnet-reportgenerator-globaltool --version 5.2.0

- name: Install TrxToHtml Tool
run: dotnet tool install -g Samhammer.TrxToHtml
working-directory: ./certify/src/Certify.Tests/Certify.Core.Tests.Unit

- name: Install Dependencies
run: dotnet restore
working-directory: ./certify/src/Certify.Tests/Certify.Core.Tests.Unit
Expand All @@ -85,11 +79,11 @@ jobs:
working-directory: ./certify/src/Certify.Tests/Certify.Core.Tests.Unit

- name: Run Certify.Core.Tests.Unit Tests
run: dotnet test Certify.Core.Tests.Unit.dll -v normal -f net8.0 --logger trx --collect:"XPlat Code Coverage" --results-directory "TestResults-8_0-${{ runner.os }}" /testadapterpath:C:\%HOMEPATH%\.nuget\packages\coverlet.collector\6.0.0\build\netstandard1.0
run: dotnet test Certify.Core.Tests.Unit.dll -v normal -f net8.0 --logger trx --logger html --collect:"XPlat Code Coverage" --results-directory "TestResults-8_0-${{ runner.os }}" /testadapterpath:C:\%HOMEPATH%\.nuget\packages\coverlet.collector\6.0.0\build\netstandard1.0
working-directory: ./certify/src/Certify.Tests/Certify.Core.Tests.Unit/bin/Debug/net8.0

- name: Generated HTML Reports
run: trx-to-html && reportgenerator -reports:./certify/src/Certify.Tests/Certify.Core.Tests.Unit/bin/Debug/net8.0/TestResults-8_0-${{ runner.os }}/**/coverage.cobertura.xml -targetdir:./certify/src/Certify.Tests/Certify.Core.Tests.Unit/bin/Debug/net8.0/TestResults-8_0-${{ runner.os }}
- name: Generated HTML Coverage Report
run: reportgenerator -reports:./certify/src/Certify.Tests/Certify.Core.Tests.Unit/bin/Debug/net8.0/TestResults-8_0-${{ runner.os }}/**/coverage.cobertura.xml -targetdir:./certify/src/Certify.Tests/Certify.Core.Tests.Unit/bin/Debug/net8.0/TestResults-8_0-${{ runner.os }}

- name: Upload Certify.Core.Tests.Unit Test Results and Coverage
uses: actions/upload-artifact@master
Expand Down

0 comments on commit cbf0e79

Please sign in to comment.