Skip to content

Commit

Permalink
Setup Ace.Grograpi.Infrastructure code coverage and report tools/scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
dimitrietataru committed Aug 18, 2024
1 parent 1a1a4ad commit 21f39ec
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="ReportGenerator" Version="5.3.8" />
<PackageReference Include="xunit" Version="2.9.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand All @@ -37,6 +38,7 @@
</ItemGroup>

<ItemGroup>
<None Remove="run-test-coverage.ps1" />
<None Update="xunit.runner.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
$Project = "Ace.Geograpi.Infrastructure";
$Root = "..\.cov";
$ReportGeneratorPath = ".nuget\packages\reportgenerator\5.3.8\tools\net8.0\ReportGenerator.dll";

dotnet test --collect:"XPlat Code Coverage" --settings .\runsettings --results-directory "$Root\raw\$Project";
dotnet "$env:USERPROFILE\$ReportGeneratorPath" "-reports:$Root\raw\$Project\*\coverage.cobertura.xml" "-targetdir:$Root\reports\$Project" "-historydir:$Root\reports\.history\$Project" -reporttypes:Html;
dotnet "$env:USERPROFILE\$ReportGeneratorPath" "-reports:$Root\raw\$Project\*\coverage.cobertura.xml" "-targetdir:$Root\reports\$Project" "-historydir:$Root\reports\.history\$Project" -reporttypes:Badges;

Read-Host -Prompt "Press any key to continue.."
26 changes: 26 additions & 0 deletions src/tests/Ace.Geograpi.Infrastructure.IntegrationTests/runsettings
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8" ?>
<RunSettings>
<DataCollectionRunSettings>
<DataCollectors>
<DataCollector friendlyName="XPlat code coverage">
<Configuration>
<Format>json,cobertura</Format>
<UseSourceLink>true</UseSourceLink>
<IncludeTestAssembly>false</IncludeTestAssembly>
<Include>[Ace.Geograpi.Infrastructure]*</Include>
<Exclude>[Migrations]*</Exclude>
<ExcludeByFile>**/*.g.cs,**/GlobalUsings.cs,**/DependencyInjection.cs,**/Migrations/*.cs</ExcludeByFile>
</Configuration>
</DataCollector>
</DataCollectors>
</DataCollectionRunSettings>
<InProcDataCollectionRunSettings>
<InProcDataCollectors>
<InProcDataCollector
assemblyQualifiedName="Coverlet.Collector.DataCollection.CoverletInProcDataCollector, coverlet.collector, Version=6.0.2, Culture=neutral, PublicKeyToken=null"
friendlyName="XPlat Code Coverage"
enabled="True"
codebase="coverlet.collector.dll" />
</InProcDataCollectors>
</InProcDataCollectionRunSettings>
</RunSettings>

0 comments on commit 21f39ec

Please sign in to comment.