Skip to content

Commit

Permalink
Merge pull request #100 from jakubch1/main
Browse files Browse the repository at this point in the history
Better navigation + upgrade packages
  • Loading branch information
jakubch1 authored Feb 14, 2024
2 parents 71919b6 + 16fe697 commit 6946725
Show file tree
Hide file tree
Showing 15 changed files with 46 additions and 40 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/Calculator_Scenario10.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ jobs:
- name: Install dotnet-coverage
run: dotnet tool install -g dotnet-coverage
- name: Instrument Calculator.Core.dll
run: dotnet-coverage instrument --session-id TagScenario10 "./bin/Debug/net7.0/Calculator.Core.dll"
run: dotnet-coverage instrument --session-id TagScenario10 "./bin/Debug/net8.0/Calculator.Core.dll"
- name: Instrument Calculator.Console.dll
run: dotnet-coverage instrument --session-id TagScenario10 "./bin/Debug/net7.0/Calculator.Console.dll"
run: dotnet-coverage instrument --session-id TagScenario10 "./bin/Debug/net8.0/Calculator.Console.dll"
- name: Start code coverage collection session
run: dotnet-coverage collect --session-id TagScenario10 --server-mode --background -f cobertura -o $GITHUB_WORKSPACE/report.cobertura.xml
- name: Run (add)
Expand Down
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ Code coverage results: output.coverage.

For existing projects to get latest features and best performance please keep up to date below references:
```xml
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="Microsoft.CodeCoverage" Version="17.8.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="Microsoft.CodeCoverage" Version="17.9.0" />
```

If your solution doesn't contain any C++ code it is recommended to disable native code coverage by adding into configuration below flags:
Expand All @@ -67,6 +67,12 @@ Check other configuration options [here](docs/configuration.md).
* [Configuration](docs/configuration.md)
* [Performance data](/docs/performance/README.md)

## Samples

* [Unit tests, E2E, console applications, merging, exclusions, static instrumentation](samples/Calculator/README.md)
* [MSTest Runner, Native AOT](samples/Algorithms/README.md)
* [Visual Studio](samples/VisualStudio/README.md)

## Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeCoverage.MSBuild" Version="17.10.1" />
<PackageReference Include="Microsoft.CodeCoverage.MSBuild" Version="17.10.3" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="MSTest" Version="3.2.0" />
<PackageReference Include="Microsoft.Testing.Extensions.TrxReport" Version="1.0.0" />
<PackageReference Include="Microsoft.Testing.Extensions.CodeCoverage" Version="17.10.1" />
<PackageReference Include="Microsoft.CodeCoverage.MSBuild" Version="17.10.1" />
<PackageReference Include="MSTest" Version="3.2.1" />
<PackageReference Include="Microsoft.Testing.Extensions.TrxReport" Version="1.0.1" />
<PackageReference Include="Microsoft.Testing.Extensions.CodeCoverage" Version="17.10.3" />
<PackageReference Include="Microsoft.CodeCoverage.MSBuild" Version="17.10.3" />
</ItemGroup>

<ItemGroup>
Expand Down
12 changes: 6 additions & 6 deletions samples/Calculator/scenarios/scenario10/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ git clone https://github.com/microsoft/codecoverage.git
cd codecoverage/samples/Calculator/src/Calculator.Console/
dotnet build
dotnet tool install -g dotnet-coverage
dotnet-coverage instrument --session-id TagScenario10 "./bin/Debug/net7.0/Calculator.Core.dll"
dotnet-coverage instrument --session-id TagScenario10 "./bin/Debug/net7.0/Calculator.Console.dll"
dotnet-coverage instrument --session-id TagScenario10 "./bin/Debug/net8.0/Calculator.Core.dll"
dotnet-coverage instrument --session-id TagScenario10 "./bin/Debug/net8.0/Calculator.Console.dll"
dotnet-coverage collect --session-id TagScenario10 --server-mode --background -f cobertura
dotnet run --no-build add 10 24
dotnet run --no-build multiply 10 24
Expand All @@ -35,9 +35,9 @@ You can also use [run.ps1](run.ps1) to execute this scenario.
- name: Install dotnet-coverage
run: dotnet tool install -g dotnet-coverage
- name: Instrument Calculator.Core.dll
run: dotnet-coverage instrument --session-id TagScenario10 "./bin/Debug/net7.0/Calculator.Core.dll"
run: dotnet-coverage instrument --session-id TagScenario10 "./bin/Debug/net8.0/Calculator.Core.dll"
- name: Instrument Calculator.Console.dll
run: dotnet-coverage instrument --session-id TagScenario10 "./bin/Debug/net7.0/Calculator.Console.dll"
run: dotnet-coverage instrument --session-id TagScenario10 "./bin/Debug/net8.0/Calculator.Console.dll"
- name: Start code coverage collection session
run: dotnet-coverage collect --session-id TagScenario10 --server-mode --background -f cobertura -o $GITHUB_WORKSPACE/report.cobertura.xml
- name: Run (add)
Expand Down Expand Up @@ -92,13 +92,13 @@ steps:
- task: Bash@3
inputs:
targetType: 'inline'
script: 'dotnet-coverage instrument --session-id TagScenario10 "$(Build.SourcesDirectory)/samples/Calculator/src/Calculator.Console/bin/Debug/net7.0/Calculator.Core.dll"'
script: 'dotnet-coverage instrument --session-id TagScenario10 "$(Build.SourcesDirectory)/samples/Calculator/src/Calculator.Console/bin/Debug/net8.0/Calculator.Core.dll"'
displayName: 'Instrument Calculator.Core.dll'

- task: Bash@3
inputs:
targetType: 'inline'
script: 'dotnet-coverage instrument --session-id TagScenario10 "$(Build.SourcesDirectory)/samples/Calculator/src/Calculator.Console/bin/Debug/net7.0/Calculator.Console.dll"'
script: 'dotnet-coverage instrument --session-id TagScenario10 "$(Build.SourcesDirectory)/samples/Calculator/src/Calculator.Console/bin/Debug/net8.0/Calculator.Console.dll"'
displayName: 'Instrument Calculator.Console.dll'

- task: Bash@3
Expand Down
4 changes: 2 additions & 2 deletions samples/Calculator/scenarios/scenario10/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ steps:
- task: Bash@3
inputs:
targetType: 'inline'
script: 'dotnet-coverage instrument --session-id TagScenario10 "$(Build.SourcesDirectory)/samples/Calculator/src/Calculator.Console/bin/Debug/net7.0/Calculator.Core.dll"'
script: 'dotnet-coverage instrument --session-id TagScenario10 "$(Build.SourcesDirectory)/samples/Calculator/src/Calculator.Console/bin/Debug/net8.0/Calculator.Core.dll"'
displayName: 'Instrument Calculator.Core.dll'

- task: Bash@3
inputs:
targetType: 'inline'
script: 'dotnet-coverage instrument --session-id TagScenario10 "$(Build.SourcesDirectory)/samples/Calculator/src/Calculator.Console/bin/Debug/net7.0/Calculator.Console.dll"'
script: 'dotnet-coverage instrument --session-id TagScenario10 "$(Build.SourcesDirectory)/samples/Calculator/src/Calculator.Console/bin/Debug/net8.0/Calculator.Console.dll"'
displayName: 'Instrument Calculator.Console.dll'

- task: Bash@3
Expand Down
4 changes: 2 additions & 2 deletions samples/Calculator/scenarios/scenario10/run.ps1
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
cd $PSScriptRoot/../../src/Calculator.Console
dotnet build
dotnet tool install -g dotnet-coverage
dotnet-coverage instrument --session-id TagScenario10 "./bin/Debug/net7.0/Calculator.Core.dll"
dotnet-coverage instrument --session-id TagScenario10 "./bin/Debug/net7.0/Calculator.Console.dll"
dotnet-coverage instrument --session-id TagScenario10 "./bin/Debug/net8.0/Calculator.Core.dll"
dotnet-coverage instrument --session-id TagScenario10 "./bin/Debug/net8.0/Calculator.Console.dll"
dotnet-coverage collect --session-id TagScenario10 --server-mode --background -f cobertura
dotnet run --no-build add 10 24
dotnet run --no-build multiply 10 24
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<UseAppHost>true</UseAppHost>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</ItemGroup>

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

Expand All @@ -10,9 +10,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="xunit" Version="2.6.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="xunit" Version="2.6.6" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ private double Execute(string arguments)
Process process = new Process();
process.StartInfo = new ProcessStartInfo()
{
FileName = Path.Combine(Directory.GetCurrentDirectory(), "..", "..", "..", "..", "..", "src", "Calculator.Console", "bin", Configuration, "net7.0", fileName),
FileName = Path.Combine(Directory.GetCurrentDirectory(), "..", "..", "..", "..", "..", "src", "Calculator.Console", "bin", Configuration, "net8.0", fileName),
Arguments = arguments,
UseShellExecute = false,
CreateNoWindow = true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

Expand All @@ -10,9 +10,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="xunit" Version="2.6.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="xunit" Version="2.6.6" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

Expand All @@ -10,10 +10,10 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="NUnit" Version="3.14.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="NUnit" Version="4.0.1" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageReference Include="NUnit.Analyzers" Version="3.9.0" />
<PackageReference Include="NUnit.Analyzers" Version="4.0.1" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

Expand All @@ -10,10 +10,10 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="7.0.13" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="xunit" Version="2.6.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3">
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="xunit" Version="2.6.6" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down

0 comments on commit 6946725

Please sign in to comment.