A .NET 5 solution example, to get metric coverage from the differents projects of the solution.
In this project has been used the following tools and NuGet Packages to extract the metric solutions:
- Visual Studio Community 2019
- .NET 5.0
- Clone project.
- Open NetCoreCoverage.sln
>dotnet build NetCoreCoverage.sln --configuration Release
2. Run the unit tests from the solution in relase target (from the base repository folder) and generate results. This command will displayed in the command line the results of the coverage, and futhermore, this command will generate a file (.\TestResults\coverage.cobertura.xml)
>dotnet test NetCoreCoverage.sln --configuration Release /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura /p:Exclude="[xunit*]\*" /p:CoverletOutput="../TestResults/"
3. Generate report coverage metrics in html format. This command consume the '.\TestResults\coverage.cobertura.xml' file and generate a output folder with a index.hmtl file to visualize the results in a browser.
>reportgenerator "-reports:TestResults\coverage.cobertura.xml" "-targetdir:TestResults\html" -reporttypes:Html
Any advice for common problems or issues.
Javier Carracedo
Twitter Profile: @JaviKarra94
This project is licensed under the Mit License, see the LICENSE.md file for details.