Skip to content

Commit

Permalink
Setup Ace.Grograpi.Web code coverage and report tools/scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
dimitrietataru committed Aug 11, 2024
1 parent 9b92e99 commit 412274a
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/tests/Ace.Geograpi.Application.Tests/runsettings
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<UseSourceLink>true</UseSourceLink>
<IncludeTestAssembly>false</IncludeTestAssembly>
<Include>[Ace.Geograpi.Application]*</Include>
<ExcludeByFile>**/DependencyInjection.cs,**/GlobalUsings.cs,**/IApplicationMarker.cs</ExcludeByFile>
<ExcludeByFile>**/*.g.cs,**/GlobalUsings.cs,**/DependencyInjection.cs</ExcludeByFile>
</Configuration>
</DataCollector>
</DataCollectors>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,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 Down
9 changes: 9 additions & 0 deletions src/tests/Ace.Geograpi.Web.Tests/run-test-coverage.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
$Project = "Ace.Geograpi.Web";
$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.."
25 changes: 25 additions & 0 deletions src/tests/Ace.Geograpi.Web.Tests/runsettings
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?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.Web]*</Include>
<ExcludeByFile>**/*.g.cs,**/GlobalUsings.cs,**/AppConfiguration*.cs,**/Program.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 412274a

Please sign in to comment.