Skip to content

A .NET 5 solution example, to get metric coverage from the different project of the solution.

License

Notifications You must be signed in to change notification settings

jke94/NetCoreCoverage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Code coverage in .NET 5 (C#)

A .NET 5 solution example, to get metric coverage from the differents projects of the solution.

Medium Post

Code coverage in .NET 5 (C#)

Description

In this project has been used the following tools and NuGet Packages to extract the metric solutions:

Getting Started

Dependencies or tool necessaries

  • Visual Studio Community 2019
  • .NET 5.0

Installing

  • Clone project.
  • Open NetCoreCoverage.sln

Steps (using dotnet command)

1. Build the solution in release target (from the base repository folder).

>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/"

dotnet test

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

reportgenerator

4. Visualize the results with in the browser.

reportgenerator

Help

Any advice for common problems or issues.

Authors

Javier Carracedo

Twitter Profile: @JaviKarra94

Version History

License

This project is licensed under the Mit License, see the LICENSE.md file for details.

About

A .NET 5 solution example, to get metric coverage from the different project of the solution.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages